Skip to content

Keep HTTP/1.0 CONNECT tunnel sockets open - #503

Open
nallwhy wants to merge 1 commit into
elixir-mint:mainfrom
nallwhy:fix/http10-connect-tunnel
Open

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

Conversation

@nallwhy

@nallwhy nallwhy commented Sep 5, 2026

Copy link
Copy Markdown

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
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