You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2005/12/20 16:50:44 UTC
svn commit: r358022 - in /httpd/httpd/trunk/modules: http/http_core.c
http/http_filters.c http/mod_core.h proxy/mod_proxy_http.c
Author: jim
Date: Tue Dec 20 07:50:37 2005
New Revision: 358022
URL: http://svn.apache.org/viewcvs?rev=358022&view=rev
Log:
Morph the ap_http_broken_backend_filter() proxy "specific"
filter to a generic http error handling output filter.
Modified:
httpd/httpd/trunk/modules/http/http_core.c
httpd/httpd/trunk/modules/http/http_filters.c
httpd/httpd/trunk/modules/http/mod_core.h
httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
Modified: httpd/httpd/trunk/modules/http/http_core.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/http/http_core.c?rev=358022&r1=358021&r2=358022&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/http_core.c (original)
+++ httpd/httpd/trunk/modules/http/http_core.c Tue Dec 20 07:50:37 2005
@@ -39,7 +39,7 @@
AP_DECLARE_DATA ap_filter_rec_t *ap_http_input_filter_handle;
AP_DECLARE_DATA ap_filter_rec_t *ap_http_header_filter_handle;
AP_DECLARE_DATA ap_filter_rec_t *ap_chunk_filter_handle;
-AP_DECLARE_DATA ap_filter_rec_t *ap_broken_backend_filter_handle;
+AP_DECLARE_DATA ap_filter_rec_t *ap_http_outerror_filter_handle;
AP_DECLARE_DATA ap_filter_rec_t *ap_byterange_filter_handle;
static const char *set_keep_alive_timeout(cmd_parms *cmd, void *dummy,
@@ -208,6 +208,8 @@
NULL, r, r->connection);
ap_add_output_filter_handle(ap_http_header_filter_handle,
NULL, r, r->connection);
+ ap_add_output_filter_handle(ap_http_outerror_filter_handle,
+ NULL, r, r->connection);
}
return OK;
@@ -243,9 +245,8 @@
ap_chunk_filter_handle =
ap_register_output_filter("CHUNK", ap_http_chunk_filter,
NULL, AP_FTYPE_TRANSCODE);
- ap_broken_backend_filter_handle =
- ap_register_output_filter("BROKEN_BACKEND",
- ap_http_broken_backend_filter,
+ ap_http_outerror_filter_handle =
+ ap_register_output_filter("HTTP_OUTERROR", ap_http_outerror_filter,
NULL, AP_FTYPE_PROTOCOL);
ap_byterange_filter_handle =
ap_register_output_filter("BYTERANGE", ap_byterange_filter,
Modified: httpd/httpd/trunk/modules/http/http_filters.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/http/http_filters.c?rev=358022&r1=358021&r2=358022&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/http_filters.c (original)
+++ httpd/httpd/trunk/modules/http/http_filters.c Tue Dec 20 07:50:37 2005
@@ -1055,9 +1055,6 @@
*/
ap_add_output_filter("CHUNK", NULL, r, r->connection);
}
- /* If we have a Proxy request, add the BROKEN_BACKEND filter now */
- if (r->proxyreq != PROXYREQ_NONE)
- ap_add_output_filter("BROKEN_BACKEND", NULL, r, r->connection);
/* Don't remove this filter until after we have added the CHUNK filter.
* Otherwise, f->next won't be the CHUNK filter and thus the first
@@ -1333,8 +1330,9 @@
return bufsiz;
}
-apr_status_t ap_http_broken_backend_filter(ap_filter_t *f,
- apr_bucket_brigade *b)
+/* Filter to handle any error buckets on output */
+apr_status_t ap_http_outerror_filter(ap_filter_t *f,
+ apr_bucket_brigade *b)
{
request_rec *r = f->r;
apr_bucket *e;
@@ -1343,10 +1341,15 @@
e != APR_BRIGADE_SENTINEL(b);
e = APR_BUCKET_NEXT(e))
{
- if (AP_BUCKET_IS_ERROR(e)
- && (((ap_bucket_error *)(e->data))->status == HTTP_BAD_GATEWAY)) {
- /* stream aborted and we have not ended it yet */
- r->connection->keepalive = AP_CONN_CLOSE;
+ if (AP_BUCKET_IS_ERROR(e)) {
+ /*
+ * Start of error handling state tree. Just one condition
+ * right now :)
+ */
+ if (((ap_bucket_error *)(e->data))->status == HTTP_BAD_GATEWAY) {
+ /* stream aborted and we have not ended it yet */
+ r->connection->keepalive = AP_CONN_CLOSE;
+ }
}
}
Modified: httpd/httpd/trunk/modules/http/mod_core.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/http/mod_core.h?rev=358022&r1=358021&r2=358022&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/mod_core.h (original)
+++ httpd/httpd/trunk/modules/http/mod_core.h Tue Dec 20 07:50:37 2005
@@ -42,7 +42,7 @@
extern AP_DECLARE_DATA ap_filter_rec_t *ap_http_input_filter_handle;
extern AP_DECLARE_DATA ap_filter_rec_t *ap_http_header_filter_handle;
extern AP_DECLARE_DATA ap_filter_rec_t *ap_chunk_filter_handle;
-extern AP_DECLARE_DATA ap_filter_rec_t *ap_broken_backend_filter_handle;
+extern AP_DECLARE_DATA ap_filter_rec_t *ap_http_outerror_filter_handle;
extern AP_DECLARE_DATA ap_filter_rec_t *ap_byterange_filter_handle;
/*
@@ -55,9 +55,9 @@
/* HTTP/1.1 chunked transfer encoding filter. */
apr_status_t ap_http_chunk_filter(ap_filter_t *f, apr_bucket_brigade *b);
-/* Filter to close the connection to the client if backend broke */
-apr_status_t ap_http_broken_backend_filter(ap_filter_t *f,
- apr_bucket_brigade *b);
+/* Filter to handle any error buckets on output */
+apr_status_t ap_http_outerror_filter(ap_filter_t *f,
+ apr_bucket_brigade *b);
char *ap_response_code_string(request_rec *r, int error_index);
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=358022&r1=358021&r2=358022&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Tue Dec 20 07:50:37 2005
@@ -1481,7 +1481,8 @@
}
else if (rv != APR_SUCCESS) {
/* In this case, we are in real trouble because
- * our backend bailed on us.
+ * our backend bailed on us. Pass along a 502 error
+ * error bucket
*/
ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c,
"proxy: error reading response");
Re: svn commit: r358022 - in /httpd/httpd/trunk/modules: http/http_core.c
http/http_filters.c http/mod_core.h proxy/mod_proxy_http.c
Posted by Ruediger Pluem <rp...@apache.org>.
On 12/20/2005 04:50 PM, jim@apache.org wrote:
[..cut..]
> @@ -208,6 +208,8 @@
> NULL, r, r->connection);
> ap_add_output_filter_handle(ap_http_header_filter_handle,
> NULL, r, r->connection);
> + ap_add_output_filter_handle(ap_http_outerror_filter_handle,
> + NULL, r, r->connection);
> }
Does this ensure that the HTTP_OUTERROR filter is run after the HTTP_HEADER filter?
Otherwise I fear that they get in each others way, because the HTTP_OUTERROR filter
should only handle things after the headers had been sent. Error buckets that occur
before the headers have been sent are already handled by the HTTP_HEADER filter via ap_die.
Regards
RĂ¼diger