From: Aaron Patterson Date: 2011-12-13T12:11:22+09:00 Subject: [ruby-core:41624] Re: [ruby-trunk - Bug #5737][Open] WEBrick doesn't support keep alive connections for 204 and 304 responses --jI8keyz6grp/JLjh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 13, 2011 at 10:35:16AM +0900, Hiroshi Nakamura wrote: >=20 > Issue #5737 has been updated by Hiroshi Nakamura. >=20 > Status changed from Closed to Open >=20 > Sorry for not responding. >=20 > As a maintainer, I'll review the patch later. I don't understand now, th= e rationale why we should do keep-alive for 304/204 even if the response is= neither chunked nor having content-length. Handling empty body would be n= eeded instead? The problem is that even if you specify a content length, webrick will remove it: https://github.com/ruby/ruby/blob/trunk/lib/webrick/httpresponse.rb#L186-= 189 So if you want to do keep-alive, even if you add a content length, you will always get a warning. RFC2616 Section 4.4 says: 1.Any response message which "MUST NOT" include a message-body (such as the 1xx, 204, and 304 responses and any response to a HEAD request) is always terminated by the first empty line after the header fields, regardless of the entity-header fields present in the message I think this means that clients will know the length of the body, and clients can support keep-alive connections with no content-length for these types of responses. --=20 Aaron Patterson http://tenderlovemaking.com/ --jI8keyz6grp/JLjh Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) iQEcBAEBAgAGBQJO5sJRAAoJEJUxcLy0/6/G21QH/3qH8nVLfdaWo+4rTi2Qc/VF eYlUUi170XGB0gp3E1ESXFfYlAuS+aTFCFqlSv+LiWFU0go9RB+Q5b2yBdOPNzOb wv/htAjBVFAbhyv+tfrkTrSCrQj35AW3U9x5gtr1bg6OXCYXHGEesC5qWHWxh8ya ujJ5S4QxNbc8ImJiFIs2qYDe4YyZz8DZ5RfVZziRnuzBvFj7NfjSs1hzIT9j8pE+ qAP1M5oFjREhjayUgyBciUuqA1uP3BC99dal3iqdqvdv5QTXxsTXBsQXOkHYuMdf mAYd8UJFl8dsdrsY3M+OR6Km3FPMiOutOmJEm2TWaHrOJawfsBNatvqvIKjoHJk= =Fs10 -----END PGP SIGNATURE----- --jI8keyz6grp/JLjh--