You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rasmus Lerdorf <ra...@linuxcare.com> on 2000/08/02 23:43:29 UTC
ErrorDocument redirect always a GET
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