Summary: | Content-Length is removed from replies to HEAD requests | ||
---|---|---|---|
Product: | Apache httpd-2 | Reporter: | Sami Tikka <sami.tikka> |
Component: | Core | Assignee: | Apache HTTPD Bugs Mailing List <bugs> |
Status: | RESOLVED FIXED | ||
Severity: | critical | CC: | bill+apache, bjoernv, cvig, guenther38425, rin, steve.gillette, tim.mcbride |
Priority: | P3 | Keywords: | PatchAvailable |
Version: | 2.0.45 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Bug Depends on: | |||
Bug Blocks: | 8677 | ||
Attachments: |
Patch file (unified diff) to fix #18757
log file excerpts and 'testcase' patch #3 |
Description
Sami Tikka
2003-04-07 11:41:23 UTC
I'm going through the bug db to make sure patches are findable. Please see http://httpd.apache.org/dev/patches.html Created attachment 9298 [details]
Patch file (unified diff) to fix #18757
*** Bug 8677 has been marked as a duplicate of this bug. *** *** Bug 21348 has been marked as a duplicate of this bug. *** Hmmm, votes 13, by five people! The patch is not necessarily correct: we should set the same content-length on a HEAD request as on the corresponding GET. So it's only a bug when the HEAD is already devoid of data at this point in the filter chain. I'm committing a slightly different fix in CVS. I'll add it here too. Created attachment 12893 [details]
log file excerpts and 'testcase'
Ran into this very problem. Patch code resolved half of the issue of getting Windows Update to work through Apache2 Proxy server. Other half of the problem was checking to be sure that Apache was listening on port 443 (SSL) and had the mod_proxy_connect loading. Relevant sections of httpd.conf: Listen 80 Listen 443 LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_connect_module modules/mod_proxy_connect.so #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so Otherwise, would get various 0x800..... errors, after clicking on "Check for Updates". Anthony Albert Reverted the patch that was committed for this bug. It appears that it doesn't actually fix this bug and it breaks at least the TLS upgrade functionality by removing the content-length header for all 0 length responses. Also, code for handling the "Content-Length: 0" header for HEAD requests is already being done in ap_http_header_filter(). *** Bug 35105 has been marked as a duplicate of this bug. *** I tested the Windows Update problem with newer versions of Apache2 (2.0.53+2.0.54). I can't find the "Content-Length: 0"-problem there. So it is probably already fixed. But Windows Update is still not working. I wrote about this in Bug #35105 which was deleted, because it should be a duplicate of this bug. Let's search for other reasons, why Windows Update is not working with Apache2 as a proxy. (In reply to comment #10) > I tested the Windows Update problem with newer versions of Apache2 > (2.0.53+2.0.54). I can't find the "Content-Length: 0"-problem there. I have never seen "Content-Length: 0" comming from a apache proxy. However, apache 2.0.53 as shipped with SuSE 9.3 still /removes/ the Content-Length header completly. See #6 for a test case. Since this is the only difference between the direct response and the response via the proxy server, I think this is the reason why windowsupdate is not working. > I have never seen "Content-Length: 0" comming from a apache proxy. However,
> apache 2.0.53 as shipped with SuSE 9.3 still /removes/ the Content-Length
> header completly.
The proxy should, legitimately, yank the Content-Length header on the HEAD
request -IF- it will respond with Transfer-Encoding: chunked and without
the Content-Length: when the GET is processed. So we need to perform this
same transformation (replace Content-Length: n with Transfer-Encoding: chunked)
on bodyless HEAD requests; the CL and TE headers then match what the GET will
do.
But the only way to proxy a HEAD request when the client does not accept TE
responses is to proxy it as a GET and run it through the C-L filter to determine
the size, if any content/body filters have been injected.
Created attachment 16741 [details]
patch #3
I've attached a new patch for this problem. it is more narrowly scoped than
the previous patches to avoid problems. it works fine for me.
note that you also have to enable the CONNECT method
( LoadModule proxy_connect_module modules/mod_proxy_connect.so )
to make Windows Update 100% happy. thanks to Eric Covener for discovering
that.
rather than just commit it, I will post the patch to dev at httpd since
previous patches encountered problems and explain how I think this one avoids
them.
Patch was committed as: http://svn.apache.org/viewcvs?rev=327008&view=rev (backports to 2.0.x/2.2.x not submitted) *** Bug 28571 has been marked as a duplicate of this bug. *** *** Bug 39837 has been marked as a duplicate of this bug. *** |