• Catalin Patulea's avatar
    net/http/fcgi: fix handling of request ID reuse · a387f915
    Catalin Patulea authored
    Request ID reuse is allowed by the FastCGI spec [1]. In particular nginx uses
    the same request ID, 1, for all requests on a given connection. Because
    serveRequest does not remove the request from conn.requests, this causes it to
    treat the second request as a duplicate and drops the connection immediately
    after beginRequest. This manifests with nginx option 'fastcgi_keep_conn on' as
    the following message in nginx error log:
    
    2014/03/17 01:39:13 [error] 730#0: *109 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: x.x.x.x, server: example.org, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "example.org"
    
    Because handleRecord and serveRequest run in different goroutines, access to
    conn.requests must now be synchronized.
    
    [1] http://www.fastcgi.com/drupal/node/6?q=node/22#S3.3
    
    LGTM=bradfitz
    R=bradfitz
    CC=golang-codereviews
    https://golang.org/cl/76800043
    a387f915
Name
Last commit
Last update
..
cmd Loading commit data...
lib9 Loading commit data...
libbio Loading commit data...
liblink Loading commit data...
libmach Loading commit data...
pkg Loading commit data...
Make.dist Loading commit data...
all.bash Loading commit data...
all.bat Loading commit data...
all.rc Loading commit data...
clean.bash Loading commit data...
clean.bat Loading commit data...
clean.rc Loading commit data...
make.bash Loading commit data...
make.bat Loading commit data...
make.rc Loading commit data...
race.bash Loading commit data...
race.bat Loading commit data...
run.bash Loading commit data...
run.bat Loading commit data...
run.rc Loading commit data...
sudo.bash Loading commit data...