Re: PHP 4.0 Bug #5885: mod_php sends response body forHEAD Requests

From: Date: Wed, 02 Aug 2000 22:41:50 +0000
Subject: Re: PHP 4.0 Bug #5885: mod_php sends response body forHEAD Requests
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-27503@lists.php.net to get a copy of this message
On Wed, 2 Aug 2000, Rodent of Unusual Size wrote: > Rasmus Lerdorf wrote: > > > > Ok, I have tracked this down. If you look at line 1038 of > > http_request.c in the Apache 1.3.12 source code you will see > > that Apache explicitly sets the request method to GET on an > > ErrorDocument redirect. > > > > Still trying to figure out what to do about this. > > ISTR this is because the content-body may or may not have been > gobbled by processing to that point -- or else that it may need > to be discarded because the redirect is off-system. It's older > behaviour than rev 1.3 of the file, though. I think RFC2616 > might hold the answer.. Right, that's why I can see changing a POST to a GET. But that logic doesn't really hold for changing a HEAD to a GET. Seems to me that a HEAD should be preserved. r->header_only is actually preserved. So what we end up with is r->request_method="GET" and r->header_only=1 which is a bit weird if you ask me. I have worked around it in PHP now, but it did force me to move something we did at the SAPI (web server api abstraction) layer down into the individual server drivers. That is, we relied on the fact that IFF request_method==HEAD we should not send the content body. With Apache this is in fact not true. The check should be IFF header_only==1 should we not send the request body. This is fine, it just doesn't translate well to ISAPI and NSAPI and the other various server apis. -Rasmus

« previous php.dev (#27503) next »