Skip to content

martian: fix connection hangs in mitm mode#718

Merged
mmatczuk merged 1 commit intomainfrom
mmt/fix_hang
Feb 23, 2024
Merged

martian: fix connection hangs in mitm mode#718
mmatczuk merged 1 commit intomainfrom
mmt/fix_hang

Conversation

@mmatczuk
Copy link
Contributor

A regression was introduced in 9cc9854 that allowed use of HTTP/2 inside MITM.

This patch adds the following to all http.Transport instances

t.TLSNextProto = make(map[string]func(string, *tls.Conn) http.RoundTripper)

Interestingly with that t = t.Clone() we get an error

forwarder encountered an unexpected error
net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x00\x00\x12\x04\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x80\x00\x04\x00\x01\x00\x00\x00\x05\x00\xff\xff\xff\x00\x00\x04\b\x00\x00\x00\x00\x00\x7f\xff\x00\x00\x00\x00\b\a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"

@mmatczuk mmatczuk requested a review from Choraden as a code owner February 23, 2024 13:12
A regression was introduced in 9cc9854 that allowed use of HTTP/2 inside MITM.

This patch adds the following to all http.Transport instances

t.TLSNextProto = make(map[string]func(string, *tls.Conn) http.RoundTripper)

Interestingly with that t = t.Clone() we get an error

forwarder encountered an unexpected error
net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x00\x00\x12\x04\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x80\x00\x04\x00\x01\x00\x00\x00\x05\x00\xff\xff\xff\x00\x00\x04\b\x00\x00\x00\x00\x00\x7f\xff\x00\x00\x00\x00\b\a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"
Copy link
Contributor

@Choraden Choraden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I wouldn't expect Clone to do such a nasty thing.

@mmatczuk mmatczuk merged commit c570e1f into main Feb 23, 2024
@mmatczuk mmatczuk deleted the mmt/fix_hang branch February 23, 2024 13:51
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