On Mon, Dec 12, 2016 at 11:26 AM, <[email protected]> wrote:
> Author: ylavic
> Date: Mon Dec 12 10:26:16 2016
> New Revision: 1773761
>
> URL: http://svn.apache.org/viewvc?rev=1773761&view=rev
> Log:
> Follow up to r1773293.
> When check_headers() fails, clear anything (headers and body) from
> original/errorneous
> response before returning 500.
This returns an error 500 with its associated headers and body (not
the ones of the original response).
Tested with "Header set 'X-Bad' '<something with CR>'" with no redirect loop.
> + if (ctx->headers_error) {
> + /* We'll come back here from ap_send_error_response(),
> + * so clear anything from this response.
> + */
> + apr_brigade_cleanup(b);
> + if (!eos) {
> + return APR_SUCCESS;
> + }
> + ctx->headers_error = 0;
> + apr_table_clear(r->headers_out);
> + apr_table_clear(r->err_headers_out);
> + r->status = HTTP_INTERNAL_SERVER_ERROR;
> + ap_send_error_response(r, 0);
We could also use ap_die() here for ErrorDocument to work, in my
"Header set ..." case (with "ErrorDocument /error.html") there is
indeed a second loop because the internal-redirect's request has the
X-Bad header too, but the looping stops here thanks to the
recursive_error caught by ap_die() the second time around (no custom
response in this case).
Maybe Eric's case is another beast so I committed the safer
ap_send_error_response() first, but if it works for everyone I'm happy
to change to ap_die() instead...
Any objection to add this to STATUS (it addresses Bill's nack AFAICT)?
Regards,
Yann.