Skip to content

Run target TLS over a TLS proxy connection - #956

Merged
benoitc merged 2 commits into
masterfrom
fix/https-proxy-https-target
Sep 26, 2026
Merged

benoitc merged 2 commits into
masterfrom
fix/https-proxy-https-target

Conversation

@benoitc

@benoitc benoitc commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

An HTTPS request through a CONNECT proxy reached over TLS ({proxy_transport, ssl}) failed. ssl:connect/3 ran the target handshake over the proxy sslsocket with gen_tcp calls. hackney_http_connect now passes {cb_info, {ssl, ssl, ssl_closed, ssl_error, ssl_passive}} in that case.

New hackney_https_proxy_tests runs a local TLS CONNECT proxy and TLS target. It covers a plain request and a set_owner handover, which checks that both TLS layers survive the opener exiting. Both tests fail on master.

With {proxy_transport, ssl} and an HTTPS target, ssl:connect/3 ran the
target handshake over the proxy sslsocket with gen_tcp calls and failed.
Pass cb_info so it uses the ssl API of the proxy socket.
CI showed the target socket handing back lists through cb_info, which
the HTTP parser rejects. Set {mode, binary} explicitly. The test servers
now accept and handle each connection in one process.
@benoitc
benoitc force-pushed the fix/https-proxy-https-target branch from fea55b5 to ec99836 Compare September 26, 2026 20:13
@benoitc
benoitc merged commit c2accf1 into master Sep 26, 2026
6 checks passed
@benoitc benoitc mentioned this pull request Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant