Skip to content

Keep HTTP/1.0 CONNECT tunnel sockets open - #503

Merged
ericmj merged 1 commit into
elixir-mint:mainfrom
nallwhy:fix/http10-connect-tunnel
Sep 6, 2026
Merged

Keep HTTP/1.0 CONNECT tunnel sockets open#503
ericmj merged 1 commit into
elixir-mint:mainfrom
nallwhy:fix/http10-connect-tunnel

Conversation

@nallwhy

@nallwhy nallwhy commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix HTTPS tunnel establishment through proxies that return a successful HTTP/1.0 response to CONNECT, such as Tinyproxy.

A successful CONNECT response switches the underlying connection into tunnel mode. However, after the CONNECT response framing changes in #493, Mint finalized the response using the normal HTTP/1.0 persistence rules.

Because HTTP/1.0 connections are non-persistent by default, this closed the underlying TCP socket before Mint attempted the TLS upgrade. On OTP 29, upgrading the closed socket resulted in:

%Mint.TransportError{reason: {:dtls_upgrade, :notsup}}

Changes

  • Keep the underlying socket open after any successful CONNECT response.

  • Do not apply the response HTTP version or Connection header persistence rules once a tunnel has been established.

  • Add a unit test verifying that an HTTP/1.0 200 response to CONNECT leaves the socket open.

  • Add an end-to-end regression test using a Tinyproxy-style response:

    HTTP/1.0 200 Connection established
    Proxy-agent: tinyproxy/1.11.1

@whatyouhide
whatyouhide requested a review from ericmj September 5, 2026 14:17
@ericmj
ericmj merged commit 2ed27ca into elixir-mint:main Sep 6, 2026
3 checks passed
@ericmj

ericmj commented Sep 6, 2026

Copy link
Copy Markdown
Member

Thank you! 馃挏

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.

2 participants