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

requests prepare_request Valid on MacOS but not on Linux #6392

Closed
ssrsec opened this issue Mar 24, 2023 · 2 comments
Closed

requests prepare_request Valid on MacOS but not on Linux #6392

ssrsec opened this issue Mar 24, 2023 · 2 comments

Comments

@ssrsec
Copy link

ssrsec commented Mar 24, 2023

I referred to #6385 , using PrepareRequest workflow to implement the method of retaining original characters in urls

The following code, which I run on my local MacOS, actually sends a URL of ' http://example.com/?unix:abc | http://127.0.0.1/ ', but when I ran it on Linux, the actual URL changed to' http://example.com/?unix:abc%7Chttp://127.0.0.1/ ', I checked that the versions of the requests library are the same, they are all 2.28.2. Why

import requests
s = requests.Session()
prepped = s.prepare_request(requests.Request('POST', 'http://example.com/', data={"a":"1"}, headers={'User-Agent':'test'}))
prepped.url = 'http://example.com/?unix:abc|http://127.0.0.1/'
res = s.send(prepped,proxies={'http': '127.0.0.1:8080', 'https': '127.0.0.1:8080'})

image

@ssrsec
Copy link
Author

ssrsec commented Mar 25, 2023

I have found the reason. Requests rely on urllib3 to process urls. urllib3=1.22 can meet my requirements, but the new version won't work. Therefore, when using the new version of urllib3, it is still necessary for me to #6385 Suggestions

@sigmavirus24
Copy link
Contributor

If it's necessary for you to use a pipe like that unencoded something you're interacting with isn't a well implemented server that respects how it should behave. Requests can only give you so much ability to do the wrong thing. At this point requests has no way to prevent urllib3 from also doing the right thing (nor do we really want to prevent it from doing the right thing).

@sigmavirus24 sigmavirus24 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 28, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants