Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In Proxy.handleRequest, check error before dereferencing request
Browse files Browse the repository at this point in the history
This fixes a segfault in the case where the caller does not trust the CA
stevevls committed Oct 20, 2023
1 parent 147e33e commit 65b016c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions proxy.go
Original file line number Diff line number Diff line change
@@ -228,13 +228,12 @@ func (p *Proxy) handleLoop(ctx *Context) {
// handleRequest reads an incoming request and processes it.
func (p *Proxy) handleRequest(ctx *Context) (err error) {
origReq, err := p.readRequest(ctx)

defer log.OnCloserError(origReq.Body, log.DEBUG)

if err != nil {
return err
}

defer log.OnCloserError(origReq.Body, log.DEBUG)

session := newSession(ctx, origReq)
p.prepareRequest(origReq, session)
log.Debug("id=%s: handle request %s %s", session.ID(), origReq.Method, origReq.URL.String())

0 comments on commit 65b016c

Please sign in to comment.