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,
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;
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,
*/
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
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;
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;
+ }
}
}
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;
/*
/* 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);
}
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");