proxy_balancer.c revision 781bc612474201c1dd7f43ce1e1ff88f61ce2c1b
/* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Load balancer module for Apache proxy */
#define CORE_PRIVATE
#include "mod_proxy.h"
#include "ap_mpm.h"
#include "apr_version.h"
#if APR_HAS_THREADS1
#else
#define PROXY_BALANCER_LOCK(b) APR_SUCCESS
#define PROXY_BALANCER_UNLOCK(b) APR_SUCCESS
#endif
/* Retrieve the parameter with the given name */
const char *name)
{
if (*path == '=') {
/*
* Session path was found, get it's value
*/
++path;
char *q;
*q = '\0';
return path;
}
}
}
return NULL;
}
{
const char *cookies;
const char *start_cookie;
if (start_cookie == cookies ||
++start_cookie;
/*
* Session cookie was found, get it's value
*/
char *end_cookie, *cookie;
++start_cookie;
*end_cookie = '\0';
*end_cookie = '\0';
return cookie;
}
}
}
}
return NULL;
}
const char *route)
{
int i;
return worker;
}
worker++;
}
return NULL;
}
request_rec *r,
char **route,
char **url)
{
return NULL;
/* Try to find the sticky route inside url */
if (!*route)
if (*route) {
/* TODO: make worker status codes */
/* See if we have a redirection route */
else
return worker;
}
else
return NULL;
}
request_rec *r,
{
int access_status = OK;
char *route;
/* Spet 1: check if the url is for us */
return DECLINED;
/* Step 2: find the session route */
if (!runtime) {
"balancer: (%s). All workers in error state for route (%s)",
return HTTP_SERVICE_UNAVAILABLE;
}
}
/* Lock the LoadBalancer
* XXX: perhaps we need the process lock here
*/
"proxy_balancer_pre_request: lock");
return DECLINED;
}
return access_status;
}
request_rec *r,
{
int access_status;
if (!balancer)
else {
access_status = OK;
}
return access_status;
}
static void ap_proxy_balancer_register_hook(apr_pool_t *p)
{
}
NULL, /* create per-directory config structure */
NULL, /* merge per-directory config structures */
NULL, /* create per-server config structure */
NULL, /* merge per-server config structures */
NULL, /* command apr_table_t */
ap_proxy_balancer_register_hook /* register hooks */
};