Skip to content

Conversation

pquentin
Copy link
Member

@pquentin pquentin commented Jan 5, 2024

Closes #141

Tested succesfully with Elasticsearch("https://test@:@test@@host").

@pquentin pquentin requested review from technige and ezimuel January 5, 2024 14:48
# percent-encoded but does not percent-decode userinfo, so we have to
# do it ourselves to build the basic auth header correctly.
auth = urllib.parse.unquote(parsed_url.auth)
username, _, password = auth.partition(":")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not be (slightly) better to partition first, and then unquote? In the (extreme) case that the username contains an encoded colon (I can't imagine why, but it could) then this would partition in the wrong place. The actual separator we're looking for should never be encoded by definition, though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed in 23f9946. (I meant "colon in userinfo username, not is.)

@pquentin pquentin requested a review from technige January 15, 2024 15:01
@pquentin pquentin merged commit d263c0d into elastic:main Jan 15, 2024
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.

Elastic client doesn't parse basic auth from url correctly.
2 participants