[patch] do not advertise chunked-encoding for HEAD requests
Anil Madhavapeddy <[email protected]> Thu, 5 Feb 2009 15:50:51 +0000
| Newsgroups | gmane.comp.lang.ocaml.lib.net.devel |
|---|---|
| Message-ID | <[email protected]> |
Currently the HTTP kernel suppresses the body of a response correctly for HEAD requests, but still sticks in a 'Transfer-encoding: chunked' header. This causes some clients (e.g. Python's httplib2) to hang around trying to read a chunk size which never shows up. It could be fixed either by writing a 0-length chunk size or (preferably since it's a HEAD request) by not advertising chunked encoding for requests with no body. Patch attached which does this and fixes it when using httplib2 for me. ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ Ocamlnet-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel
patch-nethttpd_kernel.ml.diff
(application/octet-stream, 746 B)
--- src/nethttpd-for-netcgi1/nethttpd_kernel.ml.orig 2007-11-01 22:12:31.000000000 +0000 +++ src/nethttpd-for-netcgi1/nethttpd_kernel.ml 2009-02-04 21:39:19.000000000 +0000 @@ -249,9 +249,9 @@ transfer_encoding <- `Identity; ); (* Update the header: *) - ( match transfer_encoding with - | `Identity -> resp_header # delete_field "Transfer-Encoding" - | `Chunked -> set_transfer_encoding resp_header ["chunked", []] + ( match transfer_encoding, suppress_body with + | `Identity,false | _,true -> resp_header # delete_field "Transfer-Encoding" + | `Chunked,false -> set_transfer_encoding resp_header ["chunked", []] ); resp_header # delete_field "Trailer"; set_date resp_header (Unix.time());