diff options
Diffstat (limited to 'internal/proxy/capture.go')
| -rw-r--r-- | internal/proxy/capture.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/internal/proxy/capture.go b/internal/proxy/capture.go index ccc95e9..ec4dc8d 100644 --- a/internal/proxy/capture.go +++ b/internal/proxy/capture.go @@ -59,14 +59,12 @@ func captureRequest(r *http.Request, tee *teeConn, bodyCap *cappedTee) (raw []by return buf.Bytes(), false } -// captureResponse mirrors captureRequest for the upstream leg: exact -// wire bytes when tee is non-nil (upstream negotiated HTTP/1.1), -// otherwise a reconstruction. -func captureResponse(resp *http.Response, tee *teeConn, bodyCap *cappedTee) (raw []byte, exact bool) { - if tee != nil { - return tee.Take(), true - } - +// captureResponse reconstructs raw response bytes from the parsed +// response for the HTTP/2 upstream case - the exact-capture path +// (HTTP/1.1 upstream) is handled directly in forward() via the +// teeConn's own Take(), which is the only reason this one doesn't also +// need a *teeConn parameter. +func captureResponse(resp *http.Response, bodyCap *cappedTee) (raw []byte, exact bool) { dump := *resp if bodyCap != nil { dump.Body = io.NopCloser(bytes.NewReader(bodyCap.buf.Bytes())) |