-
Notifications
You must be signed in to change notification settings - Fork 42
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
what if my password has a reserved delimiter in it? #11
Comments
Agreed, |
Self-authenticating URLs are a valuable construct. There are good reasons to deprecate authentication-bearing URLs in a variety of contexts (like: don't let users click on them, maybe), but this deprecation has no teeth, specifically because there's no other way to address this use case. My personal use-case for userinfo has to do with embedding database passwords into |
Having just implemented #23, I'm increasingly leaning toward a helper function that takes a couple non-percent-encoded arguments and gives back a percent-encoded userinfo string suitable to passing to URL methods. I do slightly wonder whether the arguments should be bytestrings to enable binary passwords, etc., to which I think the answer is yes. |
I have mixed feelings. On the "text" side: passwords (and usernames) are by their nature necessarily text; a user enters them with a keyboard, needs to read them with their eyes etc. On the "bytes" side: other systems might have arbitrarily weird or inconsistent rules about normalization, and that might need to be reflected as bytes. |
I still disagree with this pretty strongly, because you have this problem over and over again - in the userinfo, in the path, in the query, in the fragment - and in every place you need slightly different versions of the helper function. I also disagree because it's not obvious to users of the URL object that usernames can't contain colons, and making the user do escaping themselves is abdicating responsibility for the whole point of the library. So I think we need to:
|
I just ran into this again in the query string. Currently blocked upgrading Twisted on one project because of Hyperlink's change to keep We definitely need some kind of fully-decoded view of every element of the URL structure. |
"Fully-decoded" is kind of a loaded term here. |
Yes, I'll try to be more precise.
Yes… which is why it has to be escaped. But I want the un-escaped version!
As you know, there is only one scheme for URLs, really:
Only one example is necessary, really; >>> URL.fromText('https://example.com/?argument=3&argument=4&operator=%3D').asIRI().get('operator')
['%3D'] Clearly the value the application wants here is "=", and has correctly percent-encoded it to be To be clear: I think that the current behavior is subtle, but correct: putting a "=" at that point in the URL would de-normalize it at best and corrupt it at worst. And, for maximum information-preservation, However, I do still want this - application puts data into the URL, application gets data out of the URL - to be as convenient and idiomatic as possible. Something like this: >>> URL.fromText('https://example.com/?argument=3&argument=4&operator=%3D').asIRI().decoded.get('operator')
['='] the What do you think? |
just another idea: perhaps all api taking a |
This will be fixed by #54 I believe. |
That's right! #54 was merged, and now DecodedURL is in hyperlink==18.0.0, which was just released! Give it a whirl! 🎉 |
This release is amazing. There are a few minor issues:
I feel like |
@glyph docs are on the docket! tbh I kind of wanted a soft rollout because I had a feeling that there would be changes as we get around to using the new APIs. Until documented for a reasonable amount of time, I don't yet consider things truly released. Agreed that it should be easier to programmatically construct. How about making the I might be misremembering, but I think |
Right now if I do this:
I get this:
The API for setting a secret is sort of silly already (manually sticking a colon into the userinfo string), so "fixing" this might not involve any behavior change, but rather add a new argument (
.replace(secret=...?)
) but there should be some way to take a string that a user typed into a password box and embed it into the URL somehow without forcing the caller to do any wacky percent encoding of their own.The text was updated successfully, but these errors were encountered: