processing is completed, avoiding orphaned callback pointers.
[Brett Gervasoni <brettg senseofsecurity.com>, Jeff Trawick]
+ *) Proxy balancer: support setting error status according to
+ HTTP response code from a backend.
+ PR 48939 [Daniel Ruggeri <DRuggeri primary.net>]
+
*) htcacheclean: Introduce the ability to clean specific URLs from the
cache, if provided as an optional parameter on the command line.
[Graham Leggett]
else
return "scolonpathdelim must be On|Off";
}
+ else if (!strcasecmp(key, "erroronstatus")) {
+ char valSplit[strlen(val)+1];
+ char *status;
+ char *tok_state;
+
+ strcpy(valSplit, val);
+ balancer->errstatuses = apr_array_make(p, 1, sizeof(int));
+
+ status = apr_strtok(valSplit, ", ", &tok_state);
+ while (status != NULL) {
+ ival = atoi(status);
+ if (ap_is_HTTP_VALID_RESPONSE(ival)) {
+ *(int*)apr_array_push(balancer->errstatuses) = ival;
+ }
+ else {
+ return "erroronstatus must be one or more HTTP response code";
+ }
+ status = apr_strtok(NULL, ", ", &tok_state);
+ }
+
+ }
else {
return "unknown Balancer parameter";
}
void *context; /* general purpose storage */
const char *sticky_path; /* URL sticky session identifier */
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_NOTICE, rv, r->server,
+ "Detected ErrorOnState (%d) for member (%s). Forcing worker into error state.", val, worker->name);
+ 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--;