-*- coding: utf-8 -*-
Changes with Apache 2.2.17
+ *) Proxy balancer: support setting error status according to HTTP response
+ code from a backend. PR 48939. [Daniel Ruggeri <DRuggeri primary.net>]
+
*) mod_authnz_ldap: If AuthLDAPCharsetConfig is set, also convert the
password to UTF-8. PR 45318.
[Johannes Müller <joh_m gmx.de>, Stefan Fritsch]
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * mod_proxy_balancer: Force workers into PROXY_WORKER_IN_ERROR when configured
- statuses are found
- PR: 48939
- Trunk patches: http://svn.apache.org/viewvc?rev=930125&view=rev
- http://svn.apache.org/viewvc?rev=930254&view=rev
- http://svn.apache.org/viewvc?rev=962972&view=rev
- http://svn.apache.org/viewvc?rev=987359&view=rev
- 2.2.x patch: https://issues.apache.org/bugzilla/attachment.cgi?id=25923
- plus this CHANGES entry:
- *) Proxy balancer: support setting error status according to HTTP response
- code from a backend. PR 48939. [Daniel Ruggeri <DRuggeri primary.net>]
- Submitted by: Daniel Ruggeri <DRuggeri primary.net>
- +1: trawick, wrowe
- niq: +1 to the 2.2.x patch, but why r951900 and r987379 in trunk patches?
-
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
[ New proposals should be added at the end of the list ]
<td>Balancer timeout in seconds. If set this will be the maximum time
to wait for a free worker. Default is not to wait.
</td></tr>
+ <tr><td>failonstatus</td>
+ <td>-</td>
+ <td>A single or comma-separated list of HTTP status codes. If set this will
+ force the worker into error state when the backend returns any status code
+ in the list. Worker recovery behaves the same as other worker errors.
+ </td></tr>
</table>
<p>A sample balancer setup</p>
* 20051115.23 (2.2.12) Add ap_open_piped_log_ex API, with cmdtype option,
* and conditional cmdtype member of piped_log struct
* 20051115.24 (2.2.15) Add forward member to proxy_conn_rec
+ * 20051115.25 (2.2.17) Add errstatuses member to proxy_balancer
*/
#define MODULE_MAGIC_COOKIE 0x41503232UL /* "AP22" */
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20051115
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 24 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 25 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
else
return "scolonpathdelim must be On|Off";
}
+ else if (!strcasecmp(key, "failonstatus")) {
+ char *val_split;
+ char *status;
+ char *tok_state;
+
+ val_split = apr_pstrdup(p, val);
+
+ balancer->errstatuses = apr_array_make(p, 1, sizeof(int));
+
+ status = apr_strtok(val_split, ", ", &tok_state);
+ while (status != NULL) {
+ ival = atoi(status);
+ if (ap_is_HTTP_VALID_RESPONSE(ival)) {
+ *(int *)apr_array_push(balancer->errstatuses) = ival;
+ }
+ else {
+ return "failonstatus must be one or more HTTP response codes";
+ }
+ status = apr_strtok(NULL, ", ", &tok_state);
+ }
+
+ }
else {
return "unknown Balancer parameter";
}
#endif
void *context; /* general purpose storage */
int scolonsep; /* true if ';' seps sticky session paths */
+
+ apr_array_header_t *errstatuses; /* statuses to force members into error */
};
struct proxy_balancer_method {
proxy_server_conf *conf)
{
-#if 0
apr_status_t rv;
if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) {
balancer->name);
return HTTP_INTERNAL_SERVER_ERROR;
}
- /* TODO: placeholder for post_request actions
- */
+ if (!apr_is_empty_array(balancer->errstatuses)) {
+ int i;
+ for (i = 0; i < balancer->errstatuses->nelts; i++) {
+ int val = ((int *)balancer->errstatuses->elts)[i];
+ if (r->status == val) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
+ "proxy: BALANCER: (%s). Forcing recovery for worker (%s), failonstatus %d",
+ balancer->name, worker->name, val);
+ worker->s->status |= PROXY_WORKER_IN_ERROR;
+ worker->s->error_time = apr_time_now();
+ break;
+ }
+ }
+ }
if ((rv = PROXY_THREAD_UNLOCK(balancer)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy_balancer_post_request for (%s)", balancer->name);
-#endif
-
if (worker && worker->s->busy)
worker->s->busy--;