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

Handle percent-encoded URLs in parsing code #586

Merged
merged 1 commit into from
Feb 10, 2015
Merged

Handle percent-encoded URLs in parsing code #586

merged 1 commit into from
Feb 10, 2015

Conversation

paulkeene
Copy link
Contributor

Hi,

Clients of redis-py that attempt to instantiate a ConnectionPool object by using the from_url class method can run into problems if components of the passed-in URL contain illegal characters (e.g. rediss://:my/password@localhost:6379). Understandably the forward slash in this example URL causes it to be parsed incorrectly, but even if a client attempts to percent-encode their URL (e.g. rediss://:my%2Fpassword@localhost:6379) this will not fix the problem since from_url will not know to decode the password after the URL is parsed.

This commit attempts to fix the problem by introducing a new argument, decode_components, to from_url that allows URL components to be decoded after the URL has been parsed. I used a flag here because existing clients might be relying on the current behavior.

I added some unit tests and verified that they pass with python2 and python3.

This fixes issue #579

Thanks,
Paul

@yozik04
Copy link

yozik04 commented Mar 13, 2015

Great. But sad it was not released to pypi yet.

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.

3 participants