diff --git a/http.go b/http.go index 6bbb580..ba1d245 100644 --- a/http.go +++ b/http.go @@ -116,6 +116,10 @@ func (r *Request) responseNotSent() bool { return r.state <= rsSent } +func (r *Request) hasSent() bool { + return r.state >= rsSent +} + func (r *Request) releaseBuf() { if r.raw != nil { httpBuf.Put(r.rawByte) diff --git a/proxy.go b/proxy.go index da70de9..ecf14c1 100644 --- a/proxy.go +++ b/proxy.go @@ -367,7 +367,7 @@ func (c *clientConn) serve() { sv.Close() if c.shouldRetry(&r, sv, err) { goto retry - } else if err == errPageSent && (!r.hasBody() || r.state >= rsSent) { + } else if err == errPageSent && (!r.hasBody() || r.hasSent()) { // Can only continue if request has no body, or request body // has been read. continue