Skip to content

Commit

Permalink
fix panic in ModifyResponse by setting request back after roundtrip (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zema1 authored and bramhaghosh committed Jan 9, 2020
1 parent 013cf25 commit 5f8cb63
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,10 @@ func (p *Proxy) handle(ctx *Context, conn net.Conn, brw *bufio.ReadWriter) error
}
defer res.Body.Close()

// set request to original request manually, res.Request may be changed in transport.
// see https://github.com/google/martian/issues/298
res.Request = req

if err := p.resmod.ModifyResponse(res); err != nil {
log.Errorf("martian: error modifying response: %v", err)
proxyutil.Warning(res.Header, err)
Expand Down

0 comments on commit 5f8cb63

Please sign in to comment.