Skip to content

Urgent: Fix breaking bug on url joining resulting in paths like ///path. #699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2014

Conversation

STRML
Copy link
Contributor

@STRML STRML commented Sep 12, 2014

This commit can completely break production apps and this or a similar hotfix needs to be deployed ASAP.

@3rd-Eden
Copy link
Contributor

@STRML Could you add test so @jcrugzz doesn't break it again ;-)?

@STRML
Copy link
Contributor Author

STRML commented Sep 12, 2014

Yep - working on that right now, just figured I should get the fix in ASAP.

On Sep 12, 2014, at 12:57 PM, Arnout Kazemier [email protected] wrote:

@STRML Could you add test so @jcrugzz doesn't break it again ;-)?


Reply to this email directly or view it on GitHub.

@3rd-Eden
Copy link
Contributor

Yes, it should, but I can't release a new version anyways as I don't have publish rights (which is why I haven't merged it in yet either)

@STRML
Copy link
Contributor Author

STRML commented Sep 12, 2014

Ok. I have amended the commit to include a test.

On Sep 12, 2014, at 1:01 PM, Arnout Kazemier [email protected] wrote:

Yes, it should, but I can't release a new version anyways as I don't have publish rights (which is why I haven't merged it in yet either)


Reply to this email directly or view it on GitHub.

3rd-Eden added a commit that referenced this pull request Sep 12, 2014
Urgent: Fix breaking bug on url joining resulting in paths like `///path`.
@3rd-Eden 3rd-Eden merged commit 107b9da into http-party:master Sep 12, 2014
@3rd-Eden
Copy link
Contributor

Thanks a lot for contribution. Will make sure that is out as fast as possible.

@cronopio
Copy link
Contributor

Pubished as v1.4.3. Thanks for the reports and contributions.

@jcrugzz
Copy link
Contributor

jcrugzz commented Sep 12, 2014

@STRML thanks a ton for the fix. I go and try and fix a windows bug and I do something terrible xD. Im very curious of the case that caused the path to be prefixed with /. Would you mind sharing?

@STRML
Copy link
Contributor Author

STRML commented Sep 12, 2014

@jcrugzz It could happen two ways, possibly resulting in ///. It is suggested, but not documented as a requirement, that there should be no trailing slash in the target or leading slash in the proxied path.

I had been using a target as a deep path, something like http://localhost:3000/api/, and my proxied paths were read from req.url so they were often something like /user/login. While path.join() handled this properly, your code would create http://localhost:3000/api///user/login.

Understandably there shouldn't be a trailing slash in the target, but it is very common for there to be a leading slash in the proxied path (from req.url), and this commit broke that case as well with a double slash.

@arnihermann
Copy link

Thanks for quickly responding to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants