* 20131230.2 (2.5.0-dev) Prefix REWRITE_REDIRECT_HANDLER_NAME in mod_rewrite.h
* 20140207.0 (2.5.0-dev) Support for slaved connections in core.c
* 20140207.1 (2.5.0-dev) Add SSL reusable SNI to mod_proxy.h's proxy_conn_rec
+ * 20140207.2 (2.5.0-dev) Add proxy detach_backend hook
*/
#define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20140207
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, create_req, (request_rec *r, request_rec *pr))
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, fixups, (request_rec *r))
+/**
+ * Let modules perform processing when the connection to the origin is being
+ * detached from the request.
+ * @param r The client request
+ * @param backend The proxy representation of the backend connection
+ */
+APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, detach_backend, (request_rec *r,
+ proxy_conn_rec *backend))
+
/**
* pre request hook.
* It will return the most suitable worker at the moment
apr_table_setn(r->notes, "proxy_timedout", "1");
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01103) "read timeout");
if (do_100_continue) {
+ proxy_run_detach_backend(r, backend);
return ap_proxyerror(r, HTTP_SERVICE_UNAVAILABLE, "Timeout on 100-Continue");
}
}
/* Mark the backend connection for closing */
backend->close = 1;
/* Need to return OK to avoid sending an error message */
+ proxy_run_detach_backend(r, backend);
return OK;
}
else if (!c->keepalives) {
" failed.",
backend->hostname, backend->port);
}
+ proxy_run_detach_backend(r, backend);
return ap_proxyerror(r, HTTP_GATEWAY_TIME_OUT,
"Error reading from remote server");
}
* if the status line was > 8192 bytes
*/
if ((major != 1) || (len >= sizeof(buffer)-1)) {
+ proxy_run_detach_backend(r, backend);
return ap_proxyerror(r, HTTP_BAD_GATEWAY,
apr_pstrcat(p, "Corrupt status line returned by remote "
"server: ", buffer, NULL));
r->headers_out = apr_table_make(r->pool,1);
r->status = HTTP_BAD_GATEWAY;
r->status_line = "bad gateway";
+ proxy_run_detach_backend(r, backend);
return r->status;
}
(proxy_status != HTTP_NOT_MODIFIED)) { /* not 304 */
ap_discard_request_body(backend->r);
}
+ proxy_run_detach_backend(r, backend);
return proxy_status;
}
* left waiting for a slow client to eventually
* acknowledge the data.
*/
+ proxy_run_detach_backend(r, backend);
ap_proxy_release_connection(backend->worker->s->scheme,
backend, r->server);
/* Ensure that the backend is not reused */
* left waiting for a slow client to eventually
* acknowledge the data.
*/
+ proxy_run_detach_backend(r, backend);
ap_proxy_release_connection(backend->worker->s->scheme,
backend, r->server);
*backend_ptr = NULL;
* created from scpool and this pool can be freed before this brigade. */
apr_brigade_cleanup(bb);
+ if (*backend_ptr) {
+ proxy_run_detach_backend(r, backend);
+ }
+
/* See define of AP_MAX_INTERIM_RESPONSES for why */
if (interim_response >= AP_MAX_INTERIM_RESPONSES) {
return ap_proxyerror(r, HTTP_BAD_GATEWAY,
*/
if ((status = ap_proxy_http_request(p, r, backend, worker,
conf, uri, locurl, server_portstr)) != OK) {
+ proxy_run_detach_backend(r, backend);
if ((status == HTTP_SERVICE_UNAVAILABLE) &&
worker->s->ping_timeout_set &&
worker->s->ping_timeout >= 0) {