Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFixed passwords getting percent_encoded #292
Conversation
|
On second though, this only works for my use-case, not the main use case of this crate probably. All of the SQL connector repos that I have encountered use the URL crate, so I'm kind of wondering what the workaround for this would be. Sorry for the close and open, I don't know my own strength. |
|
Using percent-encoding is the correct way. |
|
Ah, that makes sense. I'm aware why the tests fail, the question now is, would a better way around this problem be to have a |
Thomspoon commentedApr 18, 2017
•
edited by larsbergstrom
When testing mysql database connectors, I came across this squirrelly response:
thread 'main' panicked at 'calledResult::unwrap()on anErrvalue: InvalidPort', /Users/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-mac/build/src/libcore/result.rs:86My connection string was similar to:
mysql://root:pass#word@example.comWhich immediately prompted me to wonder what was happening. I cloned the repo for the connector I was using and started debugging, before I dug deeper and found it was due to the url::Url type panicking. So I delved even deeper and ended up here.
I found that
parse_userinfowas breaking at the#, which would then cause some errors downstream when parsing the rest of the url.After this fix, I found that the password, since it wasn't expecting these characters, was
percent_encodingthese characters, so the connection string would turn into:mysql://root:pass%23word@example.comMy proposed change would allow additional special characters in the password, accepting the
?and#characters that were previously disallowed. IBM and various others promote the usage of specifically#and?in passwords, which is why I think those restrictions should be taken out.This is my first pull request, so please let me know if this was too much.
This change is