We are using libmicrohttpd (0.9.19) for a http video server. One of our customers reported that a video client they were testing failed because the client was setting "Connection: close" in the request headers and was expecting a "Connection: close" in the response headers.
If a client sends a "close" in the request libmicrohttpd does close the connection, but does not add a "close" to the response headers. Here is an example showing that the "close" is not added to the response: [van@acer ~]$ curl -v -H "Connection: close" http://10.11.1.29/index.html >/dev/null > GET /index.html HTTP/1.1 > User-Agent: curl/7.24.0 (x86_64-redhat-linux-gnu) libcurl/7.24.0 NSS/3.13.5.0 > zlib/1.2.5 libidn/1.24 libssh2/1.4.1 > Host: 10.11.1.29 > Accept: */* > Connection: close > < HTTP/1.1 200 OK < Content-Length: 426 < Cache-Control: max-age=21600 < Last-Modified: Fri, 16 Nov 2012 02:16:15 GMT < ETag: "8221:1353032175:426" < Content-Type: text/html < Accept-Ranges: bytes < Server: MediaBase/8047 < Date: Thu, 06 Dec 2012 01:22:20 GMT < { [data not shown] RFC2616 states the following: 8.1.2.1 Negotiation An HTTP/1.1 server MAY assume that a HTTP/1.1 client intends to maintain a persistent connection unless a Connection header including the connection-token "close" was sent in the request. If the server chooses to close the connection immediately after sending the response, it SHOULD send a Connection header including the connection-token close. I could easily check for a "close" in the request headers and then add a "close" to the response headers in my server code. But, is this something that should be handled by the library itself? What do you think? -eivind
