On Fri, Dec 27, 2013 at 10:53 AM, Ask Bjørn Hansen <[email protected]>wrote:
> > On Dec 27, 2013, at 14:57, Justin Erenkrantz <[email protected]> > wrote: > > > The use case here is that someone could store a zero-byte file inside of > radosgw. Amazon's S3 clients expect to see a Content-Length on HEAD > requests - IOW, they don't infer the lack of a Content-Length as being '0'. > If we weren't comfortable allowing this as a default, I'm guessing that we > could expose this as a directive override. > > Why would that not be a reasonable default? > As we approach 2014, I'd be fine with allowing '0' as a legitimate C-L value. Ryan has a comment in line 1237 that says: --- /* This is a hack, but I can't find anyway around it. The idea is that * we don't want to send out 0 Content-Lengths if it is a head request. * This happens when modules try to outsmart the server, and return * if they see a HEAD request. Apache 1.3 handlers were supposed to * just return in that situation, and the core handled the HEAD. In * 2.0, if a handler returns, then the core sends an EOS bucket down * the filter stack, and the content-length filter computes a C-L of * zero and that gets put in the headers, and we end up sending a * zero C-L to the client. We can't just remove the C-L filter, * because well behaved 2.0 handlers will send their data down the stack, * and we will compute a real C-L for the head request. RBB */ if (r->header_only && (clheader = apr_table_get(r->headers_out, "Content-Length")) && !strcmp(clheader, "0")) { apr_table_unset(r->headers_out, "Content-Length"); } --- The commit log is: ------------------------------------------------------------------------ r86976 | rbb | 2000-11-15 17:08:44 -0500 (Wed, 15 Nov 2000) | 6 lines Do not send a content-length if and only if this is a HEAD request and the content-length is 0. The problem is that the C-L on a HEAD response has to be the correct C-L, but if a handler returns saying the handled the request without sending data, the core sends an EOS down the filter stack, and we compute a 0 C-L. ------------------------------------------------------------------------ +1 for just removing this whole block; but, I guess that there could *still* be some broken filters/generators that set C-L to 0 when they shouldn't. -- justin
