From: Yui NARUSE Date: 2011-12-14T11:41:37+09:00 Subject: [ruby-core:41636] [ruby-trunk - Bug #5737] WEBrick doesn't support keep alive connections for 204 and 304 responses Issue #5737 has been updated by Yui NARUSE. Hiroshi Nakamura wrote: > As a maintainer, I'll review the patch later. > I don't understand now, the 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 needed instead? Why don't you use keep-alive though the best scenario of keep-alive benefit such as 304 and 204? And as RFC says, it is not "empty body", it doesn't have body. Anyway as Aaron said in [ruby-core:41624], RFC 2616 (Section 4.4 Message Length) insists that servers should treat specially on the case of 1xx, 204, and 304. http://tools.ietf.org/html/rfc2616#section-4.4 HTTPbis is the work trying to revise the HTTP spec. http://tools.ietf.org/wg/httpbis/ It describes the more detailed Message-Body logic. Moreover for the case of 304 (Not Modified), it should return content-length: > In the > case of a 304 (Not Modified) response to a GET request, Content- > Length indicates the size of the payload body (not including any > potential transfer-coding) that would have been sent in a 200 (OK) > response. http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-17#section-8.2 ---------------------------------------- Bug #5737: WEBrick doesn't support keep alive connections for 204 and 304 responses http://redmine.ruby-lang.org/issues/5737 Author: Aaron Patterson Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.0.0dev (2011-12-07 trunk 33966) [x86_64-darwin11.2.0] WEBrick doesn't support keep alive connections for 204 and 304 responses. If a 204 or 304 response is made along with a keepalive, a warning is issued and webrick closes the connection. I've attached a patch that fixes the problem, and I will apply it if it's OK. :-) -- http://redmine.ruby-lang.org