1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

Out foul tabs. No function change.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93375 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bill Stoddard
2002-02-12 17:41:35 +00:00
parent 40eb3b9322
commit 8cb5dbee43

View File

@@ -87,29 +87,29 @@ static int alias_match(const char *uri, const char *alias_fakename)
const char *aliasp = alias_fakename, *urip = uri; const char *aliasp = alias_fakename, *urip = uri;
while (aliasp < end_fakename) { while (aliasp < end_fakename) {
if (*aliasp == '/') { if (*aliasp == '/') {
/* any number of '/' in the alias matches any number in /* any number of '/' in the alias matches any number in
* the supplied URI, but there must be at least one... * the supplied URI, but there must be at least one...
*/ */
if (*urip != '/') if (*urip != '/')
return 0; return 0;
while (*aliasp == '/') while (*aliasp == '/')
++aliasp; ++aliasp;
while (*urip == '/') while (*urip == '/')
++urip; ++urip;
} }
else { else {
/* Other characters are compared literally */ /* Other characters are compared literally */
if (*urip++ != *aliasp++) if (*urip++ != *aliasp++)
return 0; return 0;
} }
} }
/* Check last alias path component matched all the way */ /* Check last alias path component matched all the way */
if (aliasp[-1] != '/' && *urip != '\0' && *urip != '/') if (aliasp[-1] != '/' && *urip != '\0' && *urip != '/')
return 0; return 0;
/* Return number of characters from URI which matched (may be /* Return number of characters from URI which matched (may be
* greater than length of alias, since we may have matched * greater than length of alias, since we may have matched
@@ -140,26 +140,26 @@ static int proxy_detect(request_rec *r)
/* Ick... msvc (perhaps others) promotes ternary short results to int */ /* Ick... msvc (perhaps others) promotes ternary short results to int */
if (conf->req && r->parsed_uri.scheme) { if (conf->req && r->parsed_uri.scheme) {
/* but it might be something vhosted */ /* but it might be something vhosted */
if (!(r->parsed_uri.hostname if (!(r->parsed_uri.hostname
&& !strcasecmp(r->parsed_uri.scheme, ap_http_method(r)) && !strcasecmp(r->parsed_uri.scheme, ap_http_method(r))
&& ap_matches_request_vhost(r, r->parsed_uri.hostname, && ap_matches_request_vhost(r, r->parsed_uri.hostname,
(apr_port_t)(r->parsed_uri.port_str ? r->parsed_uri.port (apr_port_t)(r->parsed_uri.port_str ? r->parsed_uri.port
: ap_default_port(r))))) { : ap_default_port(r))))) {
r->proxyreq = PROXYREQ_PROXY; r->proxyreq = PROXYREQ_PROXY;
r->uri = r->unparsed_uri; r->uri = r->unparsed_uri;
r->filename = apr_pstrcat(r->pool, "proxy:", r->uri, NULL); r->filename = apr_pstrcat(r->pool, "proxy:", r->uri, NULL);
r->handler = "proxy-server"; r->handler = "proxy-server";
} }
} }
/* We need special treatment for CONNECT proxying: it has no scheme part */ /* We need special treatment for CONNECT proxying: it has no scheme part */
else if (conf->req && r->method_number == M_CONNECT else if (conf->req && r->method_number == M_CONNECT
&& r->parsed_uri.hostname && r->parsed_uri.hostname
&& r->parsed_uri.port_str) { && r->parsed_uri.port_str) {
r->proxyreq = PROXYREQ_PROXY; r->proxyreq = PROXYREQ_PROXY;
r->uri = r->unparsed_uri; r->uri = r->unparsed_uri;
r->filename = apr_pstrcat(r->pool, "proxy:", r->uri, NULL); r->filename = apr_pstrcat(r->pool, "proxy:", r->uri, NULL);
r->handler = "proxy-server"; r->handler = "proxy-server";
} }
return DECLINED; return DECLINED;
} }
@@ -173,10 +173,10 @@ static int proxy_trans(request_rec *r)
struct proxy_alias *ent = (struct proxy_alias *) conf->aliases->elts; struct proxy_alias *ent = (struct proxy_alias *) conf->aliases->elts;
if (r->proxyreq) { if (r->proxyreq) {
/* someone has already set up the proxy, it was possibly ourselves /* someone has already set up the proxy, it was possibly ourselves
* in proxy_detect * in proxy_detect
*/ */
return OK; return OK;
} }
/* XXX: since r->uri has been manipulated already we're not really /* XXX: since r->uri has been manipulated already we're not really
@@ -197,7 +197,7 @@ static int proxy_trans(request_rec *r)
r->handler = "proxy-server"; r->handler = "proxy-server";
r->proxyreq = PROXYREQ_REVERSE; r->proxyreq = PROXYREQ_REVERSE;
return OK; return OK;
} }
} }
return DECLINED; return DECLINED;
} }
@@ -211,9 +211,9 @@ static int proxy_walk(request_rec *r)
ap_conf_vector_t *entry_config; ap_conf_vector_t *entry_config;
proxy_dir_conf *entry_proxy; proxy_dir_conf *entry_proxy;
int num_sec = sconf->sec_proxy->nelts; int num_sec = sconf->sec_proxy->nelts;
/* XXX: shouldn't we use URI here? Canonicalize it first? /* XXX: shouldn't we use URI here? Canonicalize it first?
* Pass over "proxy:" prefix * Pass over "proxy:" prefix
*/ */
const char *proxyname = r->filename + 6; const char *proxyname = r->filename + 6;
int j; int j;
@@ -273,19 +273,19 @@ static int proxy_fixup(request_rec *r)
int access_status; int access_status;
if (!r->proxyreq || strncmp(r->filename, "proxy:", 6) != 0) if (!r->proxyreq || strncmp(r->filename, "proxy:", 6) != 0)
return DECLINED; return DECLINED;
/* XXX: Shouldn't we try this before we run the proxy_walk? */ /* XXX: Shouldn't we try this before we run the proxy_walk? */
url = &r->filename[6]; url = &r->filename[6];
/* canonicalise each specific scheme */ /* canonicalise each specific scheme */
if ((access_status = proxy_run_canon_handler(r, url))) { if ((access_status = proxy_run_canon_handler(r, url))) {
return access_status; return access_status;
} }
p = strchr(url, ':'); p = strchr(url, ':');
if (p == NULL || p == url) if (p == NULL || p == url)
return HTTP_BAD_REQUEST; return HTTP_BAD_REQUEST;
return OK; /* otherwise; we've done the best we can */ return OK; /* otherwise; we've done the best we can */
} }
@@ -303,29 +303,29 @@ static int proxy_needsdomain(request_rec *r, const char *url, const char *domain
/* We only want to worry about GETs */ /* We only want to worry about GETs */
if (!r->proxyreq || r->method_number != M_GET || !r->parsed_uri.hostname) if (!r->proxyreq || r->method_number != M_GET || !r->parsed_uri.hostname)
return DECLINED; return DECLINED;
/* If host does contain a dot already, or it is "localhost", decline */ /* If host does contain a dot already, or it is "localhost", decline */
if (strchr(r->parsed_uri.hostname, '.') != NULL if (strchr(r->parsed_uri.hostname, '.') != NULL
|| strcasecmp(r->parsed_uri.hostname, "localhost") == 0) || strcasecmp(r->parsed_uri.hostname, "localhost") == 0)
return DECLINED; /* host name has a dot already */ return DECLINED; /* host name has a dot already */
ref = apr_table_get(r->headers_in, "Referer"); ref = apr_table_get(r->headers_in, "Referer");
/* Reassemble the request, but insert the domain after the host name */ /* Reassemble the request, but insert the domain after the host name */
/* Note that the domain name always starts with a dot */ /* Note that the domain name always starts with a dot */
r->parsed_uri.hostname = apr_pstrcat(r->pool, r->parsed_uri.hostname, r->parsed_uri.hostname = apr_pstrcat(r->pool, r->parsed_uri.hostname,
domain, NULL); domain, NULL);
nuri = apr_uri_unparse(r->pool, nuri = apr_uri_unparse(r->pool,
&r->parsed_uri, &r->parsed_uri,
APR_URI_UNP_REVEALPASSWORD); APR_URI_UNP_REVEALPASSWORD);
apr_table_set(r->headers_out, "Location", nuri); apr_table_set(r->headers_out, "Location", nuri);
ap_log_rerror(APLOG_MARK, APLOG_INFO|APLOG_NOERRNO, 0, r, ap_log_rerror(APLOG_MARK, APLOG_INFO|APLOG_NOERRNO, 0, r,
"Domain missing: %s sent to %s%s%s", r->uri, "Domain missing: %s sent to %s%s%s", r->uri,
apr_uri_unparse(r->pool, &r->parsed_uri, apr_uri_unparse(r->pool, &r->parsed_uri,
APR_URI_UNP_OMITUSERINFO), APR_URI_UNP_OMITUSERINFO),
ref ? " from " : "", ref ? ref : ""); ref ? " from " : "", ref ? ref : "");
return HTTP_MOVED_PERMANENTLY; return HTTP_MOVED_PERMANENTLY;
} }
@@ -349,59 +349,59 @@ static int proxy_handler(request_rec *r)
/* is this for us? */ /* is this for us? */
if (!r->proxyreq || strncmp(r->filename, "proxy:", 6) != 0) if (!r->proxyreq || strncmp(r->filename, "proxy:", 6) != 0)
return DECLINED; return DECLINED;
/* handle max-forwards / OPTIONS / TRACE */ /* handle max-forwards / OPTIONS / TRACE */
if ((str = apr_table_get(r->headers_in, "Max-Forwards"))) { if ((str = apr_table_get(r->headers_in, "Max-Forwards"))) {
maxfwd = strtol(str, NULL, 10); maxfwd = strtol(str, NULL, 10);
if (maxfwd < 1) { if (maxfwd < 1) {
switch (r->method_number) { switch (r->method_number) {
case M_TRACE: { case M_TRACE: {
int access_status; int access_status;
r->proxyreq = PROXYREQ_NONE; r->proxyreq = PROXYREQ_NONE;
if ((access_status = ap_send_http_trace(r))) if ((access_status = ap_send_http_trace(r)))
ap_die(access_status, r); ap_die(access_status, r);
else else
ap_finalize_request_protocol(r); ap_finalize_request_protocol(r);
return OK; return OK;
} }
case M_OPTIONS: { case M_OPTIONS: {
int access_status; int access_status;
r->proxyreq = PROXYREQ_NONE; r->proxyreq = PROXYREQ_NONE;
if ((access_status = ap_send_http_options(r))) if ((access_status = ap_send_http_options(r)))
ap_die(access_status, r); ap_die(access_status, r);
else else
ap_finalize_request_protocol(r); ap_finalize_request_protocol(r);
return OK; return OK;
} }
default: { default: {
return ap_proxyerror(r, HTTP_BAD_GATEWAY, return ap_proxyerror(r, HTTP_BAD_GATEWAY,
"Max-Forwards has reached zero - proxy loop?"); "Max-Forwards has reached zero - proxy loop?");
}
} }
} }
maxfwd = (maxfwd > 0) ? maxfwd - 1 : 0; }
maxfwd = (maxfwd > 0) ? maxfwd - 1 : 0;
} }
else { else {
/* set configured max-forwards */ /* set configured max-forwards */
maxfwd = conf->maxfwd; maxfwd = conf->maxfwd;
} }
apr_table_set(r->headers_in, "Max-Forwards", apr_table_set(r->headers_in, "Max-Forwards",
apr_psprintf(r->pool, "%ld", (maxfwd > 0) ? maxfwd : 0)); apr_psprintf(r->pool, "%ld", (maxfwd > 0) ? maxfwd : 0));
if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR))) if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)))
return rc; return rc;
url = r->filename + 6; url = r->filename + 6;
p = strchr(url, ':'); p = strchr(url, ':');
if (p == NULL) if (p == NULL)
return HTTP_BAD_REQUEST; return HTTP_BAD_REQUEST;
/* If the host doesn't have a domain name, add one and redirect. */ /* If the host doesn't have a domain name, add one and redirect. */
if (conf->domain != NULL) { if (conf->domain != NULL) {
rc = proxy_needsdomain(r, url, conf->domain); rc = proxy_needsdomain(r, url, conf->domain);
if (ap_is_HTTP_REDIRECT(rc)) if (ap_is_HTTP_REDIRECT(rc))
return HTTP_MOVED_PERMANENTLY; return HTTP_MOVED_PERMANENTLY;
} }
*p = '\0'; *p = '\0';
@@ -413,40 +413,40 @@ static int proxy_handler(request_rec *r)
/* we only know how to handle communication to a proxy via http */ /* we only know how to handle communication to a proxy via http */
/*if (strcasecmp(scheme, "http") == 0) */ /*if (strcasecmp(scheme, "http") == 0) */
{ {
int ii; int ii;
struct dirconn_entry *list = (struct dirconn_entry *) conf->dirconn->elts; struct dirconn_entry *list = (struct dirconn_entry *) conf->dirconn->elts;
for (direct_connect = ii = 0; ii < conf->dirconn->nelts && !direct_connect; ii++) { for (direct_connect = ii = 0; ii < conf->dirconn->nelts && !direct_connect; ii++) {
direct_connect = list[ii].matcher(&list[ii], r); direct_connect = list[ii].matcher(&list[ii], r);
} }
#if DEBUGGING #if DEBUGGING
ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r,
(direct_connect) ? "NoProxy for %s" : "UseProxy for %s", (direct_connect) ? "NoProxy for %s" : "UseProxy for %s",
r->uri); r->uri);
#endif #endif
} }
/* firstly, try a proxy, unless a NoProxy directive is active */ /* firstly, try a proxy, unless a NoProxy directive is active */
if (!direct_connect) { if (!direct_connect) {
for (i = 0; i < proxies->nelts; i++) { for (i = 0; i < proxies->nelts; i++) {
p2 = ap_strchr_c(ents[i].scheme, ':'); /* is it a partial URL? */ p2 = ap_strchr_c(ents[i].scheme, ':'); /* is it a partial URL? */
if (strcmp(ents[i].scheme, "*") == 0 || if (strcmp(ents[i].scheme, "*") == 0 ||
(p2 == NULL && strcasecmp(scheme, ents[i].scheme) == 0) || (p2 == NULL && strcasecmp(scheme, ents[i].scheme) == 0) ||
(p2 != NULL && (p2 != NULL &&
strncasecmp(url, ents[i].scheme, strlen(ents[i].scheme)) == 0)) { strncasecmp(url, ents[i].scheme, strlen(ents[i].scheme)) == 0)) {
/* handle the scheme */ /* handle the scheme */
ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server, ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server,
"Trying to run scheme_handler against proxy"); "Trying to run scheme_handler against proxy");
access_status = proxy_run_scheme_handler(r, conf, url, ents[i].hostname, ents[i].port); access_status = proxy_run_scheme_handler(r, conf, url, ents[i].hostname, ents[i].port);
/* an error or success */ /* an error or success */
if (access_status != DECLINED && access_status != HTTP_BAD_GATEWAY) { if (access_status != DECLINED && access_status != HTTP_BAD_GATEWAY) {
return access_status; return access_status;
} }
/* we failed to talk to the upstream proxy */ /* we failed to talk to the upstream proxy */
} }
} }
} }
/* otherwise, try it direct */ /* otherwise, try it direct */
@@ -456,13 +456,13 @@ static int proxy_handler(request_rec *r)
/* handle the scheme */ /* handle the scheme */
ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server, ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server,
"Trying to run scheme_handler"); "Trying to run scheme_handler");
access_status = proxy_run_scheme_handler(r, conf, url, NULL, 0); access_status = proxy_run_scheme_handler(r, conf, url, NULL, 0);
if (DECLINED == access_status) { if (DECLINED == access_status) {
ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server, ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server,
"Neither CONNECT, HTTP or FTP for %s", "Neither CONNECT, HTTP or FTP for %s",
r->uri); r->uri);
return HTTP_FORBIDDEN; return HTTP_FORBIDDEN;
} }
return access_status; return access_status;
} }
@@ -563,26 +563,26 @@ static const char *
f = apr_pstrdup(cmd->pool, f1); f = apr_pstrdup(cmd->pool, f1);
p = strchr(r, ':'); p = strchr(r, ':');
if (p == NULL || p[1] != '/' || p[2] != '/' || p[3] == '\0') { if (p == NULL || p[1] != '/' || p[2] != '/' || p[3] == '\0') {
return "ProxyRemote: Bad syntax for a remote proxy server"; return "ProxyRemote: Bad syntax for a remote proxy server";
} }
else { else {
scheme[p-r] = 0; scheme[p-r] = 0;
} }
q = strchr(p + 3, ':'); q = strchr(p + 3, ':');
if (q != NULL) { if (q != NULL) {
if (sscanf(q + 1, "%u", &port) != 1 || port > 65535) if (sscanf(q + 1, "%u", &port) != 1 || port > 65535)
return "ProxyRemote: Bad syntax for a remote proxy server (bad port number)"; return "ProxyRemote: Bad syntax for a remote proxy server (bad port number)";
*q = '\0'; *q = '\0';
} }
else else
port = -1; port = -1;
*p = '\0'; *p = '\0';
if (strchr(f, ':') == NULL) if (strchr(f, ':') == NULL)
ap_str_tolower(f); /* lowercase scheme */ ap_str_tolower(f); /* lowercase scheme */
ap_str_tolower(p + 3); /* lowercase hostname */ ap_str_tolower(p + 3); /* lowercase hostname */
if (port == -1) { if (port == -1) {
port = apr_uri_default_port_for_scheme(scheme); port = apr_uri_default_port_for_scheme(scheme);
} }
new = apr_array_push(conf->proxies); new = apr_array_push(conf->proxies);
@@ -601,19 +601,19 @@ static const char *
(proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module); (proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module);
struct proxy_alias *new; struct proxy_alias *new;
if (r!=NULL && cmd->path == NULL ) { if (r!=NULL && cmd->path == NULL ) {
new = apr_array_push(conf->aliases); new = apr_array_push(conf->aliases);
new->fake = f; new->fake = f;
new->real = r; new->real = r;
} else if (r==NULL && cmd->path != NULL) { } else if (r==NULL && cmd->path != NULL) {
new = apr_array_push(conf->aliases); new = apr_array_push(conf->aliases);
new->fake = cmd->path; new->fake = cmd->path;
new->real = f; new->real = f;
} else { } else {
if ( r== NULL) if ( r== NULL)
return "ProxyPass needs a path when not defined in a location"; return "ProxyPass needs a path when not defined in a location";
else else
return "ProxyPass can not have a path when defined in a location"; return "ProxyPass can not have a path when defined in a location";
} }
return NULL; return NULL;
} }
@@ -626,20 +626,20 @@ static const char *
struct proxy_alias *new; struct proxy_alias *new;
conf = (proxy_server_conf *)ap_get_module_config(s->module_config, conf = (proxy_server_conf *)ap_get_module_config(s->module_config,
&proxy_module); &proxy_module);
if (r!=NULL && cmd->path == NULL ) { if (r!=NULL && cmd->path == NULL ) {
new = apr_array_push(conf->raliases); new = apr_array_push(conf->raliases);
new->fake = f; new->fake = f;
new->real = r; new->real = r;
} else if (r==NULL && cmd->path != NULL) { } else if (r==NULL && cmd->path != NULL) {
new = apr_array_push(conf->raliases); new = apr_array_push(conf->raliases);
new->fake = cmd->path; new->fake = cmd->path;
new->real = f; new->real = f;
} else { } else {
if ( r == NULL) if ( r == NULL)
return "ProxyPassReverse needs a path when not defined in a location"; return "ProxyPassReverse needs a path when not defined in a location";
else else
return "ProxyPassReverse can not have a path when defined in a location"; return "ProxyPassReverse can not have a path when defined in a location";
} }
return NULL; return NULL;
@@ -659,20 +659,20 @@ static const char *
/* Don't duplicate entries */ /* Don't duplicate entries */
for (i = 0; i < conf->noproxies->nelts; i++) { for (i = 0; i < conf->noproxies->nelts; i++) {
if (apr_strnatcasecmp(arg, list[i].name) == 0) { /* ignore case for host names */ if (apr_strnatcasecmp(arg, list[i].name) == 0) { /* ignore case for host names */
found = 1; found = 1;
} }
} }
if (!found) { if (!found) {
new = apr_array_push(conf->noproxies); new = apr_array_push(conf->noproxies);
new->name = arg; new->name = arg;
if (APR_SUCCESS == apr_sockaddr_info_get(&addr, new->name, APR_UNSPEC, 0, 0, parms->pool)) { if (APR_SUCCESS == apr_sockaddr_info_get(&addr, new->name, APR_UNSPEC, 0, 0, parms->pool)) {
new->addr = addr; new->addr = addr;
} }
else { else {
new->addr = NULL; new->addr = NULL;
} }
} }
return NULL; return NULL;
} }
@@ -685,11 +685,11 @@ static const char *
{ {
server_rec *s = parms->server; server_rec *s = parms->server;
proxy_server_conf *conf = proxy_server_conf *conf =
ap_get_module_config(s->module_config, &proxy_module); ap_get_module_config(s->module_config, &proxy_module);
int *New; int *New;
if (!apr_isdigit(arg[0])) if (!apr_isdigit(arg[0]))
return "AllowCONNECT: port number must be numeric"; return "AllowCONNECT: port number must be numeric";
New = apr_array_push(conf->allowed_connect_ports); New = apr_array_push(conf->allowed_connect_ports);
*New = atoi(arg); *New = atoi(arg);
@@ -712,43 +712,43 @@ static const char *
/* Don't duplicate entries */ /* Don't duplicate entries */
for (i = 0; i < conf->dirconn->nelts; i++) { for (i = 0; i < conf->dirconn->nelts; i++) {
if (strcasecmp(arg, list[i].name) == 0) if (strcasecmp(arg, list[i].name) == 0)
found = 1; found = 1;
} }
if (!found) { if (!found) {
New = apr_array_push(conf->dirconn); New = apr_array_push(conf->dirconn);
New->name = apr_pstrdup(parms->pool, arg); New->name = apr_pstrdup(parms->pool, arg);
New->hostaddr = NULL; New->hostaddr = NULL;
if (ap_proxy_is_ipaddr(New, parms->pool)) { if (ap_proxy_is_ipaddr(New, parms->pool)) {
#if DEBUGGING #if DEBUGGING
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
"Parsed addr %s", inet_ntoa(New->addr)); "Parsed addr %s", inet_ntoa(New->addr));
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
"Parsed mask %s", inet_ntoa(New->mask)); "Parsed mask %s", inet_ntoa(New->mask));
#endif #endif
} }
else if (ap_proxy_is_domainname(New, parms->pool)) { else if (ap_proxy_is_domainname(New, parms->pool)) {
ap_str_tolower(New->name); ap_str_tolower(New->name);
#if DEBUGGING #if DEBUGGING
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
"Parsed domain %s", New->name); "Parsed domain %s", New->name);
#endif #endif
} }
else if (ap_proxy_is_hostname(New, parms->pool)) { else if (ap_proxy_is_hostname(New, parms->pool)) {
ap_str_tolower(New->name); ap_str_tolower(New->name);
#if DEBUGGING #if DEBUGGING
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
"Parsed host %s", New->name); "Parsed host %s", New->name);
#endif #endif
} }
else { else {
ap_proxy_is_word(New, parms->pool); ap_proxy_is_word(New, parms->pool);
#if DEBUGGING #if DEBUGGING
fprintf(stderr, "Parsed word %s\n", New->name); fprintf(stderr, "Parsed word %s\n", New->name);
#endif #endif
} }
} }
return NULL; return NULL;
} }
@@ -760,7 +760,7 @@ static const char *
ap_get_module_config(parms->server->module_config, &proxy_module); ap_get_module_config(parms->server->module_config, &proxy_module);
if (arg[0] != '.') if (arg[0] != '.')
return "ProxyDomain: domain name must start with a dot."; return "ProxyDomain: domain name must start with a dot.";
psf->domain = arg; psf->domain = arg;
return NULL; return NULL;
@@ -804,7 +804,7 @@ static const char *
ap_get_module_config(parms->server->module_config, &proxy_module); ap_get_module_config(parms->server->module_config, &proxy_module);
int s = atoi(arg); int s = atoi(arg);
if (s < 512 && s != 0) { if (s < 512 && s != 0) {
return "ProxyReceiveBufferSize must be >= 512 bytes, or 0 for system default."; return "ProxyReceiveBufferSize must be >= 512 bytes, or 0 for system default.";
} }
psf->recv_buffer_size = s; psf->recv_buffer_size = s;
@@ -819,7 +819,7 @@ static const char *
ap_get_module_config(parms->server->module_config, &proxy_module); ap_get_module_config(parms->server->module_config, &proxy_module);
long s = atol(arg); long s = atol(arg);
if (s < 0) { if (s < 0) {
return "ProxyMaxForwards must be greater or equal to zero.."; return "ProxyMaxForwards must be greater or equal to zero..";
} }
psf->maxfwd = s; psf->maxfwd = s;
@@ -858,8 +858,8 @@ static const char*
else if (strcasecmp(arg, "Full") == 0) else if (strcasecmp(arg, "Full") == 0)
psf->viaopt = via_full; psf->viaopt = via_full;
else { else {
return "ProxyVia must be one of: " return "ProxyVia must be one of: "
"off | on | full | block"; "off | on | full | block";
} }
psf->viaopt_set = 1; psf->viaopt_set = 1;
@@ -887,14 +887,14 @@ static const char *proxysection(cmd_parms *cmd, void *mconfig, const char *arg)
const command_rec *thiscmd = cmd->cmd; const command_rec *thiscmd = cmd->cmd;
const char *err = ap_check_cmd_context(cmd, const char *err = ap_check_cmd_context(cmd,
NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
if (err != NULL) { if (err != NULL) {
return err; return err;
} }
if (endp == NULL) { if (endp == NULL) {
return apr_pstrcat(cmd->pool, cmd->cmd->name, return apr_pstrcat(cmd->pool, cmd->cmd->name,
"> directive missing closing '>'", NULL); "> directive missing closing '>'", NULL);
} }
arg=apr_pstrndup(cmd->pool, arg, endp-arg); arg=apr_pstrndup(cmd->pool, arg, endp-arg);
@@ -917,15 +917,15 @@ static const char *proxysection(cmd_parms *cmd, void *mconfig, const char *arg)
* scheme? See proxy_fixup() * scheme? See proxy_fixup()
*/ */
if (thiscmd->cmd_data) { /* <ProxyMatch> */ if (thiscmd->cmd_data) { /* <ProxyMatch> */
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED); r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
} }
else if (!strcmp(cmd->path, "~")) { else if (!strcmp(cmd->path, "~")) {
cmd->path = ap_getword_conf(cmd->pool, &arg); cmd->path = ap_getword_conf(cmd->pool, &arg);
if (!cmd->path) if (!cmd->path)
return "<Proxy ~ > block must specify a path"; return "<Proxy ~ > block must specify a path";
if (strncasecmp(cmd->path, "proxy:", 6)) if (strncasecmp(cmd->path, "proxy:", 6))
cmd->path += 6; cmd->path += 6;
r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED); r = ap_pregcomp(cmd->pool, cmd->path, REG_EXTENDED);
} }
/* initialize our config and fetch it */ /* initialize our config and fetch it */
@@ -934,7 +934,7 @@ static const char *proxysection(cmd_parms *cmd, void *mconfig, const char *arg)
errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_dir_conf); errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_dir_conf);
if (errmsg != NULL) if (errmsg != NULL)
return errmsg; return errmsg;
conf->r = r; conf->r = r;
conf->p = cmd->path; conf->p = cmd->path;
@@ -943,8 +943,8 @@ static const char *proxysection(cmd_parms *cmd, void *mconfig, const char *arg)
ap_add_per_proxy_conf(cmd->server, new_dir_conf); ap_add_per_proxy_conf(cmd->server, new_dir_conf);
if (*arg != '\0') { if (*arg != '\0') {
return apr_pstrcat(cmd->pool, "Multiple ", thiscmd->name, return apr_pstrcat(cmd->pool, "Multiple ", thiscmd->name,
"> arguments not (yet) supported.", NULL); "> arguments not (yet) supported.", NULL);
} }
cmd->path = old_path; cmd->path = old_path;