diff options
author | Ryan Bloom <rbb@apache.org> | 2000-11-15 23:08:44 +0100 |
---|---|---|
committer | Ryan Bloom <rbb@apache.org> | 2000-11-15 23:08:44 +0100 |
commit | 95e93f299d411a80a71a9589ae126af0d6036973 (patch) | |
tree | c15697793d2d49981637b3d0f919a68a5cde5d0b /modules | |
parent | First stab at a STATUS file for httpd-docs-2.0. (diff) | |
download | apache2-95e93f299d411a80a71a9589ae126af0d6036973.tar.xz apache2-95e93f299d411a80a71a9589ae126af0d6036973.zip |
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.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86976 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules')
-rw-r--r-- | modules/http/http_protocol.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 82e97709f4..9b359b6e3a 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -2503,6 +2503,23 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, ap_bu apr_table_addn(r->headers_out, "Expires", date); } + /* 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 && + !strcmp(apr_table_get(r->headers_out, "Content-Length"), "0")) { + apr_table_unset(r->headers_out, "Content-Length"); + } + apr_table_do((int (*) (void *, const char *, const char *)) compute_header_len, (void *) &len, r->headers_out, NULL); |