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
TLS connection fails through HTTPS proxy after CONNECT tunnel is established #2491
Comments
What version of scrapy are you using? (output of Does scrapy work for you with non-localhost HTTPS proxies? |
I was able to connect with Polipo running locally on port 8123, using CONNECT:
You can find the Wireshark capture file and scrapy logs at https://github.com/redapple/scrapy-issues/tree/master/2491 |
scrapy -V current platform is windows 10, I have not test it on Ubuntu.
Lantern 3.6.1 (20170110.001954)
No, I have not do it.
Yes, it is work ok on free http/https proxy that I found from web.
Thanks very much, I will do it later. |
Thanks @bfbd888 , See below a failed attempt, followed by a successful one:
Wireshark tells me that when the |
@bfbd888 ,
|
More info:
and it can be fixed by upgrading Scrapy to at least Scrapy 1.1.1 But once you upgrade, you run into the TLS issue I was mentioning earlier (#2491 (comment)) |
Alright, I think I figured this one out. Step 0: send CONNECT
Step 1: receive first chunk:
Step 2: Scrapy says: "Cool! the proxy is ready, let's initiate the TLS connection." Step 3: there are more bytes from the proxy where the HTTP 200 came from...
Step 4: OpenSSL is not happy with these bytes (there are not a Simple fix: add a small buffer when reading the initial response from the proxy and detect Advanced fix: use some HTTP parsing state machine (Twisted's?) to do this properly. |
Thanks very much, waiting for new version to fixed. |
@bfbd888 , you can try #2495 |
Thanks very much. |
I set proxy by this code:
It's error is:
Then I test the proxy by requests:
resp = requests.get('https://......', proxies={'https': 'https://127.0.0.1:8787'})
It' work!
So, what is it happen?
The text was updated successfully, but these errors were encountered: