Fix chunked encoding with SSL via proxy#4179
Conversation
|
Why aren't we taking the approach I suggested in #3844? |
|
@Lukasa I don't know the codebase that well, so I couldn't figure out exactly how the approach you'd proposed would fit in with the existing code - I tried getting rid of the chunked branch and just adding a |
|
What test failed? Can you provide the test output? |
|
Sure thing Weirdly it only failed in Python 3. The same test passed in Python 2. |
|
That failure should be unrelated: it seems to be changing from a connection timeout to an authoritative statement that no route exists to that host. Mind pushing the branch up so I can take a look at your change? |
|
Ok, so I think this test was accidentally relying on an environment behaviour. Mind pushing it to a branch that gets CI'd to see if our CI reproduces it? If it does I'll dive in myself. |
|
Yep, absolutely. |
|
I merge your code and test the code, but it's still hanging. import requests
resp = requests.get('https://baidu.com', proxies={'https': 'localhost:8899'})I tried curl with this proxy server, it worked. |
|
We are running in this to as well, and the patch resolved our problem/ Is there a plan to get this merged in to master? |
|
Any update on this? I got the same problem with chunked requests (which I think I can avoid, I accidentally used chunked by providing a None value in the data dict). Here is my analysis (done before I found #3844 and this PR): Python 3.7.0 (Mac OS) Install tinyproxy ( Python code: Result: The key here is the This means relying on https://github.com/urllib3/urllib3/blame/master/src/urllib3/connectionpool.py#L592 By adding the following code just after adapters.py:453 ( |
|
Commenting to bump. Am running into this when using chunked uploads viathe POST method using a proxy. Can confirm the above 3 liner is functional. Any chance this PR can get approved and pushed into the full module? |
|
I was experiencing the same issue (chunked encoding through an HTTPS proxy tunnel resulting in an SSL unknown protocol error) on a test case very similar to the one described by @stromnet above with requests 2.22.0. I upgraded to a9ee0ee and the issue disappeared 👍 . After spending some time analyzing the issue I'm confident that the fix came from #5128 as suggested by @jayvdb . Since as of Jan 10, 2020 the fix is not released I used this command to upgrade requests to head of master branch: |
This is a patch applying @bpitman's proposed fix for #3844.
Assuming a proxy is running on port 8875 (
docker run --rm --name='tinyproxy' -p 8875:8888 dannydirect/tinyproxy:latest ANYworks for me), the issue can be reproduced with