-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
Encoding already encoded strings #181
Comments
The idea is that query parameters passed to Another question is how to enforce percent-encoding (I see your needs)? Guys, what do you think? |
Looks like this is the same problem as the one I mentioned in #210 (comment). |
I have run into this, as well. yarl is a great lib on almost all fronts, but IMO, the original decision to have the explicit encoding process also try to make guesses about pre-encoded bits of the string is unreliable to the point of being unusable. In my case, in a tool that has worked fine for a long time, one of my users needed to input a query parameter containing This behavior seems unfixable in yarl in a backward compatible way. Another method is needed to provide reliable encoding. IMO, |
The right interface is to have two separate methods so the user can be explicit about whether the strings they're passing are pre-encoded (in which case no encoding is done) or the common case of not pre-encoded (in which case it is fully encoded with no guessing). I understand that the ship has sailed on Picking a name is hard since the "right" name is already taken by the unfixable method. |
Moreover there is different behaviour between
|
Emm, that's just plain wrong, isn't it, even considering it guessing that this is a pre-encoded string? At any rate, I really think yarl's encoding facilities need some love. |
@mikenerone it's not encoding but decoding issue I think. If you assume that |
@webknjaz I'd agree if we were looking at decoded output, but the |
#472 fixes this |
Hi,
While debugging my aiohttp client app I encountered unexpected behaviour while sending URL params containing parts which already look like they are escaped (
%aa
for example).Repro:
(see
%25xx
vs%AA
)It looks like yarl assumes that what I pass as a query param is already encoded and tries to 'correct' it by uppercasing the characters. This happens when I pass values between
%aa
and%ff
which matches valid URL encoded values%AA
to%FF
.Not sure if this behaviour is intended or documented. It certainly caught me off guard, because I as a library user expected to pass unecoded string.
The text was updated successfully, but these errors were encountered: