Project

General

Profile

[OT] Connection: Close with big FastCGI payload

Added by Tony almost 9 years ago

Hi,

I'm trying to hack a little bit the source code of lighttpd to design a web server that fits some requirements (for personal use) and I discovered a "feature' that is a little bit annoying for me : when I make a request which involves FastCGI (php) the response automatically includes a "Connection: Close" header if the payload of my response is too big (apparently the limit is around 8kb).
Does anybody know where this limit is set and where I can disable it ?

Thanks a lot !

Antoine


Replies (7)

RE: Connection: Close with big FastCGI payload - Added by Olaf-van-der-Spek almost 9 years ago

Can't reproduce...

GET /ladders/ra2/ HTTP/1.0
Connection: keep-alive

HTTP/1.0 200 OK
Connection: keep-alive
Content-Type: text/html; charset=utf-8
Content-Length: 79700
Date: Wed, 04 Feb 2009 18:37:14 GMT
Server: lighttpd/1.4.19

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Although this is C++ via FastCGI, not PHP...

RE: Connection: Close with big FastCGI payload - Added by manik almost 9 years ago

i have noticed that lighty doesn't strip hop-by-hop headers. i know little about fastcgi and related functionality, but if the set of response headers are being generated by an upstream server (or application) then response.c wont strip the connection header. i recently fixed this in the codebase that i have, version 1.4.19, perhaps this little note is not applicable to 1.5x+

RE: Connection: Close with big FastCGI payload - Added by icy almost 9 years ago

Why should it strip the header? If the backend wants the client to close the connection then so be it. There is nothing to fix.

RE: Connection: Close with big FastCGI payload - Added by manik almost 9 years ago

according the HTTP/1.0 and HTTP/1.1 spec, the "Connection" is a hop-by-hop header and not an end-to-end header. hop-by-hop headers by definition must not be forwarded by intermediaries such a proxy server. so if there is a proxy server between the client and the server, then that proxy can decide if it wants to keep-alive or close connections and therefore generate its own "Connection" header instead of passing it along blindly. there are few more headers such "TE", "Proxy-Authorization", etc. that belong to the category of hop-by-hop headers, which the lighty code as of 1.4.19 doesn't strip. its not usually such a big deal, but it might create problems such as the one that has been been reported in this thread, also a compliance suite such co-adivsor is going to bitch about it.

RE: Connection: Close with big FastCGI payload - Added by icy almost 9 years ago

Could you please open a ticket regarding this so we can track it better? Thanks!

RE: Connection: Close with big FastCGI payload - Added by Olaf-van-der-Spek almost 9 years ago

manik wrote:

according the HTTP/1.0 and HTTP/1.1 spec, the "Connection" is a hop-by-hop header and not an end-to-end header. hop-by-hop headers by definition must not be forwarded by intermediaries such a proxy server.

I'm not sure this would also apply to FastCGI.

RE: [OT] Connection: Close with big FastCGI payload - Added by gstrauss 9 months ago

This is a problem in your PHP framework, not in lighttpd. lighttpd honors "Connection: close" if sent in response headers from CGI, FastCGI, or SCGI. These use gateway protocols ("CGI/1.1", "FastCGI", "SCGI"), not HTTP/1.0 proxy protocol (used by mod_proxy).

    (1-7/7)