Skip to content

Instantly share code, notes, and snippets.

@georgyo
Created January 6, 2024 15:05
Show Gist options
  • Save georgyo/cec8b98dc7b536f804e2d530e2d9cb38 to your computer and use it in GitHub Desktop.
Save georgyo/cec8b98dc7b536f804e2d530e2d9cb38 to your computer and use it in GitHub Desktop.
cohttp-proxing-https-request
% http_proxy=http://127.0.0.1:30000 https_proxy=http://127.0.0.1:30000 all_proxy=http://127.0.0.1:30000 curl --http1.1 -vvv https://ifconfig.io/ua
Warning: Overrides previous HTTP version option
* Uses proxy env variable https_proxy == 'http://127.0.0.1:30000'
* Trying 127.0.0.1:30000...
* Connected to 127.0.0.1 (127.0.0.1) port 30000
* CONNECT tunnel: HTTP/1.1 negotiated
* allocate connect buffer
* Establish HTTP proxy tunnel to ifconfig.io:443
> CONNECT ifconfig.io:443 HTTP/1.1
> Host: ifconfig.io:443
> User-Agent: curl/8.4.0
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 500 Internal Server Error
< content-length: 28
<
* CONNECT tunnel failed, response 500
* Closing connection
curl: (56) CONNECT tunnel failed, response 500
% dune exec cohttp-lwt-unix/bin/cohttp_proxy_lwt.exe -- -s 127.0.0.1 -p 30000 --verbose
Listening for HTTP request on: 127.0.0.1 30000
--> CONNECT //ifconfig.io:443 ((headers
((Host ifconfig.io:443) (User-Agent curl/8.4.0)
(Proxy-Connection Keep-Alive)))
(meth CONNECT) (scheme ()) (resource ifconfig.io:443) (version HTTP_1_1)
(encoding Unknown))
[INFO][application]: CONNECT //ifconfig.io:443
[ERROR][cohttp.lwt.server]: Error handling ((headers
((Host ifconfig.io:443) (User-Agent curl/8.4.0)
(Proxy-Connection Keep-Alive)))
(meth CONNECT) (scheme ()) (resource ifconfig.io:443) (version HTTP_1_1)
(encoding Unknown)): Cohttp_lwt__Connection.Retry
Connection (TCP ((fd <opaque>) (ip 127.0.0.1) (port 55556))) closed
[WARNING][cohttp.lwt.server]: Client connection error Connection reset by peer: read("")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment