Permalink
Browse files

Honor keep connection flag

  • Loading branch information...
1 parent f94f269 commit 9d2d853bc9b5a9b398cd6aa4c2a6f073dffc2539 @edsrzf committed Mar 24, 2011
Showing with 6 additions and 3 deletions.
  1. +6 −3 child.go
View
9 child.go
@@ -30,7 +30,7 @@ type request struct {
stdin []byte
rawParams []byte
data []byte
- close bool
+ keepConn bool
startTime int64
}
@@ -39,7 +39,7 @@ func newRequest(reqid uint16, flags uint8) *request {
return &request{
reqId: reqid,
params: map[string]string{},
- close: flags&flagKeepConn == 0,
+ keepConn: flags&flagKeepConn != 0,
startTime: time.Nanoseconds(),
}
}
@@ -56,7 +56,6 @@ func (r *request) getHttpRequest() *http.Request {
req := &http.Request{
Method: r.params["REQUEST_METHOD"],
RawURL: r.params["REQUEST_URI"],
- Close: r.close,
Body: ioutil.NopCloser(bytes.NewBuffer(r.stdin)),
Header: http.Header{},
Trailer: http.Header{},
@@ -297,6 +296,10 @@ func (c *conn) serve() {
case kindAbortRequest:
c.requests[reqId] = nil, false
sendEndRequest(c.recChan, reqId, 0, statusRequestComplete)
+ if !req.keepConn {
+ // connection will close upon return
+ return
+ }
default:
b := make([]byte, 8)
b[0] = byte(kind)

0 comments on commit 9d2d853

Please sign in to comment.