MITM: serve the intercepted session with net/http #43
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
mikluko/multiproxy!43
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor/mitm-net-http"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Candidate 1 of the architecture review.
The MITM handler served HTTP/1.1 by hand, and got it wrong in three ways. Each now has a test that fails against the old code:
TestMITMHandler_streams)bufio.Reader, dropping read-ahead, so pipelined requests after the first were lost (TestMITMHandler_pipelining)CONNECTresponse stalled (TestMITMHandler_handshakeBeforeConnectResponse)After the handshake, an
http.Serverserves the connection through a one-connection listener. The session ends when the connection closes, whether the server or a hijacking inner handler closes it. Inner requests keep theCONNECTrequest's context, so logging and tracing are unchanged. The response writer, the no-op-close conn and the request loop are deleted.One trap, noted in a symbol doc: reads after the hijack-time buffer must go to the raw conn. Read through the outer server's reader, the inner server's deadline aborts cancel the
CONNECTrequest's context.The suite passes three times in a row under
-race.