You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Micha Lenk <mi...@lenk.info> on 2018/04/10 16:14:03 UTC
Re: [PATCH 62186] POST request getting logged as GET request
This is a kind reminder that I still didn't get any response yet.
Is there any additional information needed from my side?
On 03/29/2018 09:09 PM, Micha Lenk wrote:
> Hi Apache httpd committers,
>
> I think I've found a bug which triggers under following conditions:
>
> * Apache is configured to serve a local customized error page, e.g.
> using something like "ErrorDocument 404 /var/www/errors/404.html"
>
> * Apache is configured to log the original request's method, e.g.
> using something like (please note, the "%<m" is the part that
> matters):
> CustomLog logs/mylog "%h %l %u %t \"%r\" %>s %b method=\"%<m\""
>
> * HTTP request is a POST request (request body content doesn't matter)
>
> * the request destination path results in a 404 Not Found error
>
> If all these conditions are met, the request will get logged to
> logs/mylog with a line ending with 'method="GET"', even though this was
> a POST request.
>
> For easier reproduction of this case, I've created a patch that extends
> the Apache httpd test suite to cover this case. Please see the attached
> file bz62186_httpd-test.patch.
>
> An explanation of this behavior can be found in the code of ap_die_r(),
> which explicitly sets r->method to "GET" and r->method_number to M_GET
> before it is calling ap_internal_redirect(custom_response, r) to serve
> the configured error document.
>
> I've tried to fix this issue by taking a backup of the original
> request's method and restoring it as soon as ap_internal_redirect()
> returns (see attached patch bz62186_httpd_bugfix.patch). So far the
> tests I've done are successful, i.e. the request is now correctly logged
> as POST request.
>
> I've filed this issue some days ago as
> https://bz.apache.org/bugzilla/show_bug.cgi?id=62186 , but so far it
> didn't get any comments yet. Could anybody please take a look?
>
>
> Kind regards,
> Micha
>