-
-
Notifications
You must be signed in to change notification settings - Fork 616
Closed
Description
Unable to send HTTPS requests using ProxyPoolPlugin.
Steps to reproduce:
- Run proxy on ports 9000, 9001.
proxy --port 9001 & proxy --port 9000
- Run proxy with proxy ProxyPoolPlugin on default port.
proxy --plugins proxy.plugin.ProxyPoolPlugin
- Send the HTTPS request via curl to trigger an error.
curl -vx http://localhost:8899 https://google.com/
Request hangs on the CONNECT stage.
I expect the request to complete correctly.
Environment:
- proxy.py from develop branch.
- Python 3.7.5
- macOS Catalina 10.15.4
Details:
HTTPS request curl log:
~ curl -vx http://localhost:8899 https://google.com/
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8899 (#0)
* allocate connect buffer!
* Establish HTTP proxy tunnel to google.com:443
> CONNECT google.com:443 HTTP/1.1
> Host: google.com:443
> User-Agent: curl/7.64.1
> Proxy-Connection: Keep-Alive
>
* Proxy CONNECT aborted
* CONNECT phase completed!
* Closing connection 0
curl: (56) Proxy CONNECT aborted
HTTPS request proxy.py log:
2020-06-05 10:10:16,145 - pid:43789 [E] run:415 - Exception while handling connection <socket.socket fd=76, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=0, laddr=('::1', 8899, 0, 0), raddr=('::1', 53503, 0, 0)>
Traceback (most recent call last):
File "/Users/macbook/test-proxy/venv/lib/python3.7/site-packages/proxy/http/handler.py", line 405, in run
teardown = self.run_once()
File "/Users/macbook/test-proxy/venv/lib/python3.7/site-packages/proxy/http/handler.py", line 390, in run_once
teardown = self.handle_events(readables, writables)
File "/Users/macbook/test-proxy/venv/lib/python3.7/site-packages/proxy/http/handler.py", line 193, in handle_events
teardown = self.handle_readables(readables)
File "/Users/macbook/test-proxy/venv/lib/python3.7/site-packages/proxy/http/handler.py", line 349, in handle_readables
upgraded_sock = plugin.on_request_complete()
File "/Users/macbook/test-proxy/venv/lib/python3.7/site-packages/proxy/http/proxy/server.py", line 259, in on_request_complete
r = plugin.handle_client_request(self.request)
File "/Users/macbook/test-proxy/venv/lib/python3.7/site-packages/proxy/plugin/proxy_pool.py", line 49, in handle_client_request
self.tunnel(request)
File "/Users/macbook/test-proxy/venv/lib/python3.7/site-packages/proxy/plugin/proxy_pool.py", line 66, in tunnel
response = self.conn.recv(DEFAULT_BUFFER_SIZE)
socket.timeout: timed out
2020-06-05 10:10:16,153 - pid:43789 [I] access_log:332 - ::1:53503 - CONNECT None:None - 0 bytes - 10025.00 ms
How can I modify proxy.plugin.ProxyPoolPlugin
to work properly with HTTPS?
Metadata
Metadata
Assignees
Labels
No labels