httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rasmus Lerdorf <ras...@apache.org>
Subject Re: ErrorDocument redirect always a GET
Date Fri, 04 Aug 2000 00:16:35 GMT
Ok, I have worked around it in PHP.  I had to shuffle some things around
as PHP was relying on a direct relationship between the request method and
r->header_only.  In the case of a HEAD request to an ErrorDocument what we
currently pass to a module is r->header_only=1 and
r->request_method="GET" which seems to me to be a bit odd.  But, PHP
handles this fine now.

I will go ahead and fix Apache to not change a HEAD to a GET in this case
and we will see if anybody screams.

-Rasmus

On Thu, 3 Aug 2000, Roy T. Fielding wrote:

> I say fix it.  It should be using HEAD if the request was HEAD.
> 
> ....Roy
> 
> In message <Pine.LNX.4.21.0008021433350.881-100000@thinkpad.php.net>, Rasmus Le
> rdorf writes:
> >In http_request.c around line 1030 we have:
> >
> >        /*
> >         * This redirect needs to be a GET no matter what the original
> >         * method was.
> >         */
> >        ap_table_setn(r->subprocess_env, "REQUEST_METHOD", r->method);
> > 
> >        /*
> >         * Provide a special method for modules to communicate
> >         * more informative (than the plain canned) messages to us.
> >         * Propagate them to ErrorDocuments via the ERROR_NOTES variable:
> >         */
> >        if ((error_notes = ap_table_get(r->notes, "error-notes")) != NULL) {
> >            ap_table_setn(r->subprocess_env, "ERROR_NOTES", error_notes);
> >        }
> >        r->method = ap_pstrdup(r->pool, "GET");
> >        r->method_number = M_GET;
> >        ap_internal_redirect(custom_response, r);
> >
> >This forces the request method to be a GET when we have something like:
> >
> >  ErrorDocument 404 /error.php
> >
> >The problem I have is that when someone does a HEAD /bogus_url then
> >error.php receives a GET request and happily sends back a full response
> >which is of course illegal for a HEAD request.
> >
> >Looking through CVS logs, I see a submitted a patch to fix this for the
> >general case way back in March of 1996! and it was applied by Alexie, but
> >for some reason the ErrorDocument case explicitly doesn't inherit the
> >request method.  Can someone think of a good reason for this behaviour?  I
> >can see perhaps changing a POST to a GET in this case, but a HEAD to a
> >GET?
> >
> >-Rasmus
> >
> 
> 


Mime
View raw message