Uh oh!
There was an error while loading. Please reload this page.
Fix httpx is not encoding with symbol '%s' (#3140) - #3141
Conversation
| i = 0 | ||
| while i < len(string): | ||
| char = string[i] | ||
| if char in NON_ESCAPED_CHARS: | ||
| i += 1 | ||
| continue | ||
| # Check if the character is a start of a valid percent-encoded sequence | ||
| elif ( | ||
| char == "%" | ||
| and i + 2 < len(string) | ||
| and string[i + 1 : i + 3].isalnum() | ||
| and len(string[i + 1 : i + 3]) == 2 | ||
| ): | ||
| i += 3 | ||
| else: | ||
| return False | ||
| return True |
There was a problem hiding this comment.
| i=0 | |
| whilei<len(string): | |
| char=string[i] | |
| ifcharinNON_ESCAPED_CHARS: | |
| i+=1 | |
| continue | |
| # Check if the character is a start of a valid percent-encoded sequence | |
| elif ( | |
| char=="%" | |
| andi+2<len(string) | |
| andstring[i+1 : i+3].isalnum() | |
| andlen(string[i+1 : i+3]) ==2 | |
| ): | |
| i+=3 | |
| else: | |
| returnFalse | |
| returnTrue | |
| # All characters must already be non-escaping or valid percent-encoded | |
| forindex, charinenumerate(string): | |
| ifcharnotinNON_ESCAPED_CHARSandnotPERCENT_ENCODED_REGEX.match( | |
| string[index : index+3] | |
| ): | |
| returnFalse | |
| returnTrue |
There was a problem hiding this comment.
Thanks for review! I have applied the suggestion.
Add parsing symbol '%s' test rewrite fn::_urlparse::is_safe
T-256
left a comment
There was a problem hiding this comment.
Thanks, I think it deserves a note in changelog.
heysarthak
commented
Mar 19, 2024
Hi @T-256, |
T-256
commented
Mar 19, 2024
Yes, if it is invalid percent-encoded. |
heysarthak
commented
Mar 26, 2024
when can we merge this changes? @tomchristie |
Hello, could you look at if this PR fixes the cases of bad I think the change in this PR (to only encode |
lovelydinosaur
commented
May 2, 2024
Thanks. I think this is superseeded by #3187. |
heysarthak
commented
Aug 26, 2024
I tried the same on http 0.27.0, still having the same issue. |
Fix httpx is not encoding with symbol '%s' (#3140)
Add url parsing test
Summary
Checklist