-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[core-http] support username and password in proxy url string #7211
Conversation
This is an alternative to PR #7168 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. Thanks for the tests.
by extracting then removing them from the url and parse the updated url as URLBuilder doesn't support them.
308fb0a
to
fb31f32
Compare
return { urlWithoutAuth: url}; | ||
} | ||
|
||
const schemeIndex = url.indexOf("://") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if you could get away with using a regex to simplify the parsing here:
const urlMatch = url.match(/((\w+):\/\/)?((.*):(.*)@)?.*$/);
const username = urlMatch[4];
const password = urlMatch[5];
Not sure if it's more likely to cause trouble than the current approach though, so take it or leave it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it! It is more JavaScript-y. Although I also need to remove the auth part from the original url. I'd need another regex to do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging this.
by extracting then removing them from the url and parse the updated
url as URLBuilder doesn't support them.
For #5011