|
@@ -1593,7 +1593,7 @@ func (rl *clientConnReadLoop) endStreamError(cs *clientStream, err error) {
|
|
|
}
|
|
}
|
|
|
cs.bufPipe.closeWithErrorAndCode(err, code)
|
|
cs.bufPipe.closeWithErrorAndCode(err, code)
|
|
|
delete(rl.activeRes, cs.ID)
|
|
delete(rl.activeRes, cs.ID)
|
|
|
- if cs.req.Close || cs.req.Header.Get("Connection") == "close" {
|
|
|
|
|
|
|
+ if isConnectionCloseRequest(cs.req) {
|
|
|
rl.closeWhenIdle = true
|
|
rl.closeWhenIdle = true
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1866,3 +1866,9 @@ func (s bodyWriterState) scheduleBodyWrite() {
|
|
|
s.timer.Reset(s.delay)
|
|
s.timer.Reset(s.delay)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// isConnectionCloseRequest reports whether req should use its own
|
|
|
|
|
+// connection for a single request and then close the connection.
|
|
|
|
|
+func isConnectionCloseRequest(req *http.Request) bool {
|
|
|
|
|
+ return req.Close || httplex.HeaderValuesContainsToken(req.Header["Connection"], "close")
|
|
|
|
|
+}
|