Skip to content
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

basic auth does not work if URL has a path. #814

Closed
andrew-edgar opened this issue May 25, 2020 · 2 comments
Closed

basic auth does not work if URL has a path. #814

andrew-edgar opened this issue May 25, 2020 · 2 comments

Comments

@andrew-edgar
Copy link

We have been using fasthttp in CloudFoundry

closed issue #614 indicated that username/password should work.

We found that if the URL has a path the username/password are not correct in the header.

We write a very simple client app and used the following URL:

https://user1:pass1@sub.domain.com/test/path

Putting some debug prints around this line https://github.com/valyala/fasthttp/blob/master/http.go#L1185

We see that before that req.Header.SetRequestURIBytes() the uri.username and uri.password are

user1 and pass1

After that line (and before we setup the auth header) the uri.username and uri.password are

this/ and ests1

I'm not sure why the Header.SetRequestURIBytes() is changing the URI to be just the request path. And why setting the header value will cause the username and password to parse again incorrectly.

Right now basic auth is completely broken if the URI has any path elements.

This is related to cloudfoundry/loggregator-agent-release#29 in CloudFoundry.

@erikdubbelboer
Copy link
Collaborator

erikdubbelboer commented May 25, 2020

Thanks for the report. I have just pushed a fix and a test to make sure it doesn't break in the future. I'll release this today in v1.13.1 so you can update the dependency.

@andrew-edgar
Copy link
Author

Wow amazing! Thanks for the really fast fix!

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

No branches or pull requests

2 participants