Skip to content

Commit d56df32

Browse files
committed
When the error is broken (like missing error file) make sure the
error displays the right method and the correct Additionally message.
1 parent 2361315 commit d56df32

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

modules/http/http_protocol.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,9 @@ static const char *get_canned_error_string(int status,
963963
{
964964
apr_pool_t *p = r->pool;
965965
const char *error_notes, *h1, *s1;
966+
const char *method = r->method;
967+
if (r->subprocess_env && apr_table_get(r->subprocess_env, "REQUEST_METHOD"))
968+
method = apr_table_get(r->subprocess_env, "REQUEST_METHOD");
966969

967970
switch (status) {
968971
case HTTP_MOVED_PERMANENTLY:
@@ -1007,7 +1010,7 @@ static const char *get_canned_error_string(int status,
10071010
case HTTP_METHOD_NOT_ALLOWED:
10081011
return(apr_pstrcat(p,
10091012
"<p>The requested method ",
1010-
ap_escape_html(r->pool, r->method),
1013+
ap_escape_html(r->pool, method),
10111014
" is not allowed for this URL.</p>\n",
10121015
NULL));
10131016
case HTTP_NOT_ACCEPTABLE:
@@ -1020,7 +1023,7 @@ static const char *get_canned_error_string(int status,
10201023
case HTTP_LENGTH_REQUIRED:
10211024
s1 = apr_pstrcat(p,
10221025
"<p>A request of the requested method ",
1023-
ap_escape_html(r->pool, r->method),
1026+
ap_escape_html(r->pool, method),
10241027
" requires a valid Content-length.<br />\n",
10251028
NULL);
10261029
return(add_optional_notes(r, s1, "error-notes", "</p>\n"));
@@ -1030,7 +1033,7 @@ static const char *get_canned_error_string(int status,
10301033
case HTTP_NOT_IMPLEMENTED:
10311034
s1 = apr_pstrcat(p,
10321035
"<p>",
1033-
ap_escape_html(r->pool, r->method),
1036+
ap_escape_html(r->pool, method),
10341037
" not supported for current URL.<br />\n",
10351038
NULL);
10361039
return(add_optional_notes(r, s1, "error-notes", "</p>\n"));
@@ -1052,7 +1055,7 @@ static const char *get_canned_error_string(int status,
10521055
case HTTP_REQUEST_ENTITY_TOO_LARGE:
10531056
return(apr_pstrcat(p,
10541057
"The requested resource does not allow request data with ",
1055-
ap_escape_html(r->pool, r->method),
1058+
ap_escape_html(r->pool, method),
10561059
" requests, or the amount of data provided in\n"
10571060
"the request exceeds the capacity limit.\n",
10581061
NULL));

modules/http/http_request.c

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ static void ap_die_r(int type, request_rec *r, int recursive_error)
127127
*/
128128
update_r_in_filters(r_1st_err->proto_output_filters, r, r_1st_err);
129129
update_r_in_filters(r_1st_err->input_filters, r, r_1st_err);
130+
recursive_error = type;
130131
}
131132

132133
custom_response = NULL; /* Do NOT retry the custom thing! */

0 commit comments

Comments
 (0)