You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ni...@apache.org on 2010/02/20 02:54:15 UTC
svn commit: r912063 - in /httpd/httpd/trunk: CHANGES
modules/proxy/mod_proxy_http.c
Author: niq
Date: Sat Feb 20 01:54:15 2010
New Revision: 912063
URL: http://svn.apache.org/viewvc?rev=912063&view=rev
Log:
mod_proxy_http: get the headers right in a HEAD request with ProxyErrorOverride.PR 41646
Analysis by Stuart Children; patch by niq
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=912063&r1=912062&r2=912063&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Feb 20 01:54:15 2010
@@ -2,6 +2,12 @@
Changes with Apache 2.3.7
+ *) Proxy: get the headers right in a HEAD request with
+ ProxyErrorOverride, by checking for an overridden error
+ before not after going into a catch-all code path.
+ PR 41646.
+ Patch by Nick Kew, based on detailed analysis by Stuart Children.
+
*) support/rotatelogs: Support the simplest log rotation case, log
truncation. Useful when the log is being processed in real time
using a command like tail. [Graham Leggett]
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=912063&r1=912062&r2=912063&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Sat Feb 20 01:54:15 2010
@@ -1704,6 +1704,21 @@
e = apr_bucket_heap_create(buffer, cntr, NULL, c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, e);
}
+ /* PR 41646: get HEAD right with ProxyErrorOverride */
+ if (ap_is_HTTP_ERROR(r->status) && conf->error_override) {
+ /* clear r->status for override error, otherwise ErrorDocument
+ * thinks that this is a recursive error, and doesn't find the
+ * custom error page
+ */
+ r->status = HTTP_OK;
+ /* Discard body, if one is expected */
+ if (!r->header_only && /* not HEAD request */
+ (proxy_status != HTTP_NO_CONTENT) && /* not 204 */
+ (proxy_status != HTTP_NOT_MODIFIED)) { /* not 304 */
+ ap_discard_request_body(rp);
+ }
+ return proxy_status;
+ }
/* send body - but only if a body is expected */
if ((!r->header_only) && /* not HEAD request */
@@ -1865,29 +1880,7 @@
return DONE;
}
- if (conf->error_override) {
- /* the code above this checks for 'OK' which is what the hook expects */
- if (!ap_is_HTTP_ERROR(proxy_status)) {
- return OK;
- }
- else {
- /* clear r->status for override error, otherwise ErrorDocument
- * thinks that this is a recursive error, and doesn't find the
- * custom error page
- */
- r->status = HTTP_OK;
- /* Discard body, if one is expected */
- if (!r->header_only && /* not HEAD request */
- (proxy_status != HTTP_NO_CONTENT) && /* not 204 */
- (proxy_status != HTTP_NOT_MODIFIED)) { /* not 304 */
- ap_discard_request_body(rp);
- }
- return proxy_status;
- }
- }
- else {
- return OK;
- }
+ return OK;
}
static
Re: svn commit: r912063 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy_http.c
Posted by Ruediger Pluem <rp...@apache.org>.
On 20.02.2010 02:54, niq@apache.org wrote:
> Author: niq
> Date: Sat Feb 20 01:54:15 2010
> New Revision: 912063
>
> URL: http://svn.apache.org/viewvc?rev=912063&view=rev
> Log:
> mod_proxy_http: get the headers right in a HEAD request with ProxyErrorOverride.PR 41646
> Analysis by Stuart Children; patch by niq
>
> Modified:
> httpd/httpd/trunk/CHANGES
> httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
>
> Modified: httpd/httpd/trunk/CHANGES
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=912063&r1=912062&r2=912063&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/CHANGES [utf-8] (original)
> +++ httpd/httpd/trunk/CHANGES [utf-8] Sat Feb 20 01:54:15 2010
> @@ -2,6 +2,12 @@
>
> Changes with Apache 2.3.7
>
> + *) Proxy: get the headers right in a HEAD request with
> + ProxyErrorOverride, by checking for an overridden error
> + before not after going into a catch-all code path.
> + PR 41646.
> + Patch by Nick Kew, based on detailed analysis by Stuart Children.
> +
> *) support/rotatelogs: Support the simplest log rotation case, log
> truncation. Useful when the log is being processed in real time
> using a command like tail. [Graham Leggett]
We are handling a lot more conf->error_override in the code that is now not used
any longer. So I am a litte worried that we now miss some cases.
Isn't below the better patch?
Index: mod_proxy_http.c
===================================================================
--- mod_proxy_http.c (Revision 911511)
+++ mod_proxy_http.c (Arbeitskopie)
@@ -1839,13 +1839,15 @@
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: header only");
- /* Pass EOS bucket down the filter chain. */
- e = apr_bucket_eos_create(c->bucket_alloc);
- APR_BRIGADE_INSERT_TAIL(bb, e);
- if (ap_pass_brigade(r->output_filters, bb) != APR_SUCCESS
- || c->aborted) {
- /* Ack! Phbtt! Die! User aborted! */
- backend->close = 1; /* this causes socket close below */
+ if (!conf->error_override) {
+ /* Pass EOS bucket down the filter chain. */
+ e = apr_bucket_eos_create(c->bucket_alloc);
+ APR_BRIGADE_INSERT_TAIL(bb, e);
+ if (ap_pass_brigade(r->output_filters, bb) != APR_SUCCESS
+ || c->aborted) {
+ /* Ack! Phbtt! Die! User aborted! */
+ backend->close = 1; /* this causes socket close below */
+ }
}
apr_brigade_cleanup(bb);
Regards
RĂ¼diger