mirror of
https://github.com/apache/httpd.git
synced 2026-01-06 09:01:14 +03:00
Reformat code to no tab and no CR-LF
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@105320 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -303,7 +303,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
||||
"ajp_read_header failed");
|
||||
break;
|
||||
}
|
||||
result = ajp_parse_type(r, conn->data);
|
||||
result = ajp_parse_type(r, conn->data);
|
||||
}
|
||||
apr_brigade_destroy(input_brigade);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ static int init_runtime_score(proxy_server_conf *conf, server_rec *s, proxy_bala
|
||||
|
||||
for (i = 0; i < balancer->workers->nelts; i++) {
|
||||
ap_proxy_initialize_worker_share(conf, workers);
|
||||
ap_proxy_initialize_worker(workers, s);
|
||||
ap_proxy_initialize_worker(workers, s);
|
||||
workers->s->status = PROXY_WORKER_INITIALIZED;
|
||||
++workers;
|
||||
}
|
||||
@@ -284,19 +284,19 @@ static proxy_worker *find_best_worker(proxy_balancer *balancer,
|
||||
* not in error state or not disabled.
|
||||
*/
|
||||
if (PROXY_WORKER_IS_USABLE(worker)) {
|
||||
worker->s->lbstatus += worker->s->lbfactor;
|
||||
total_factor += worker->s->lbfactor;
|
||||
if (!candidate || worker->s->lbstatus > candidate->s->lbstatus)
|
||||
candidate = worker;
|
||||
}
|
||||
worker->s->lbstatus += worker->s->lbfactor;
|
||||
total_factor += worker->s->lbfactor;
|
||||
if (!candidate || worker->s->lbstatus > candidate->s->lbstatus)
|
||||
candidate = worker;
|
||||
}
|
||||
worker++;
|
||||
}
|
||||
|
||||
if (candidate) {
|
||||
candidate->s->lbstatus -= total_factor;
|
||||
candidate->s->elected++;
|
||||
candidate->s->lbstatus -= total_factor;
|
||||
candidate->s->elected++;
|
||||
PROXY_BALANCER_UNLOCK(balancer);
|
||||
return candidate;
|
||||
return candidate;
|
||||
}
|
||||
else {
|
||||
PROXY_BALANCER_UNLOCK(balancer);
|
||||
@@ -399,13 +399,13 @@ static int proxy_balancer_pre_request(proxy_worker **worker,
|
||||
* not in error state or not disabled.
|
||||
*/
|
||||
if (PROXY_WORKER_IS_USABLE(workers)) {
|
||||
workers->s->lbstatus += workers->s->lbfactor;
|
||||
total_factor += workers->s->lbfactor;
|
||||
}
|
||||
workers->s->lbstatus += workers->s->lbfactor;
|
||||
total_factor += workers->s->lbfactor;
|
||||
}
|
||||
workers++;
|
||||
}
|
||||
runtime->s->lbstatus -= total_factor;
|
||||
runtime->s->elected++;
|
||||
runtime->s->lbstatus -= total_factor;
|
||||
runtime->s->elected++;
|
||||
|
||||
*worker = runtime;
|
||||
}
|
||||
@@ -787,7 +787,7 @@ static void child_init(apr_pool_t *p, server_rec *s)
|
||||
/* Initialize shared scoreboard data */
|
||||
balancer = (proxy_balancer *)conf->balancers->elts;
|
||||
for (i = 0; i < conf->balancers->nelts; i++) {
|
||||
init_runtime_score(conf, s, balancer);
|
||||
init_runtime_score(conf, s, balancer);
|
||||
balancer++;
|
||||
}
|
||||
s = s->next;
|
||||
|
||||
@@ -58,8 +58,8 @@ allowed_port(proxy_server_conf *conf, int port)
|
||||
int *list = (int *) conf->allowed_connect_ports->elts;
|
||||
|
||||
for(i = 0; i < conf->allowed_connect_ports->nelts; i++) {
|
||||
if(port == list[i])
|
||||
return 1;
|
||||
if(port == list[i])
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -69,10 +69,10 @@ int ap_proxy_connect_canon(request_rec *r, char *url)
|
||||
{
|
||||
|
||||
if (r->method_number != M_CONNECT) {
|
||||
return DECLINED;
|
||||
return DECLINED;
|
||||
}
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||
"proxy: CONNECT: canonicalising URL %s", url);
|
||||
"proxy: CONNECT: canonicalising URL %s", url);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -104,11 +104,11 @@ int ap_proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
||||
/* is this for us? */
|
||||
if (r->method_number != M_CONNECT) {
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||
"proxy: CONNECT: declining URL %s", url);
|
||||
return DECLINED;
|
||||
"proxy: CONNECT: declining URL %s", url);
|
||||
return DECLINED;
|
||||
}
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||
"proxy: CONNECT: serving URL %s", url);
|
||||
"proxy: CONNECT: serving URL %s", url);
|
||||
|
||||
|
||||
/*
|
||||
@@ -119,50 +119,50 @@ int ap_proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
||||
|
||||
/* we break the URL into host, port, uri */
|
||||
if (APR_SUCCESS != apr_uri_parse_hostinfo(p, url, &uri)) {
|
||||
return ap_proxyerror(r, HTTP_BAD_REQUEST,
|
||||
apr_pstrcat(p, "URI cannot be parsed: ", url, NULL));
|
||||
return ap_proxyerror(r, HTTP_BAD_REQUEST,
|
||||
apr_pstrcat(p, "URI cannot be parsed: ", url, NULL));
|
||||
}
|
||||
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||
"proxy: CONNECT: connecting %s to %s:%d", url, uri.hostname, uri.port);
|
||||
"proxy: CONNECT: connecting %s to %s:%d", url, uri.hostname, uri.port);
|
||||
|
||||
/* do a DNS lookup for the destination host */
|
||||
err = apr_sockaddr_info_get(&uri_addr, uri.hostname, APR_UNSPEC, uri.port, 0, p);
|
||||
|
||||
/* are we connecting directly, or via a proxy? */
|
||||
if (proxyname) {
|
||||
connectname = proxyname;
|
||||
connectport = proxyport;
|
||||
connectname = proxyname;
|
||||
connectport = proxyport;
|
||||
err = apr_sockaddr_info_get(&connect_addr, proxyname, APR_UNSPEC, proxyport, 0, p);
|
||||
}
|
||||
else {
|
||||
connectname = uri.hostname;
|
||||
connectport = uri.port;
|
||||
connect_addr = uri_addr;
|
||||
connectname = uri.hostname;
|
||||
connectport = uri.port;
|
||||
connect_addr = uri_addr;
|
||||
}
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||
"proxy: CONNECT: connecting to remote proxy %s on port %d", connectname, connectport);
|
||||
"proxy: CONNECT: connecting to remote proxy %s on port %d", connectname, connectport);
|
||||
|
||||
/* check if ProxyBlock directive on this host */
|
||||
if (OK != ap_proxy_checkproxyblock(r, conf, uri_addr)) {
|
||||
return ap_proxyerror(r, HTTP_FORBIDDEN,
|
||||
"Connect to remote machine blocked");
|
||||
return ap_proxyerror(r, HTTP_FORBIDDEN,
|
||||
"Connect to remote machine blocked");
|
||||
}
|
||||
|
||||
/* Check if it is an allowed port */
|
||||
if (conf->allowed_connect_ports->nelts == 0) {
|
||||
/* Default setting if not overridden by AllowCONNECT */
|
||||
switch (uri.port) {
|
||||
case APR_URI_HTTPS_DEFAULT_PORT:
|
||||
case APR_URI_SNEWS_DEFAULT_PORT:
|
||||
break;
|
||||
default:
|
||||
/* Default setting if not overridden by AllowCONNECT */
|
||||
switch (uri.port) {
|
||||
case APR_URI_HTTPS_DEFAULT_PORT:
|
||||
case APR_URI_SNEWS_DEFAULT_PORT:
|
||||
break;
|
||||
default:
|
||||
/* XXX can we call ap_proxyerror() here to get a nice log message? */
|
||||
return HTTP_FORBIDDEN;
|
||||
}
|
||||
return HTTP_FORBIDDEN;
|
||||
}
|
||||
} else if(!allowed_port(conf, uri.port)) {
|
||||
/* XXX can we call ap_proxyerror() here to get a nice log message? */
|
||||
return HTTP_FORBIDDEN;
|
||||
return HTTP_FORBIDDEN;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -175,7 +175,7 @@ int ap_proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
||||
* until we get a successful connection
|
||||
*/
|
||||
if (APR_SUCCESS != err) {
|
||||
return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_pstrcat(p,
|
||||
return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_pstrcat(p,
|
||||
"DNS lookup failure for: ",
|
||||
connectname, NULL));
|
||||
}
|
||||
@@ -222,26 +222,26 @@ int ap_proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
||||
* the CONNECT request on to it.
|
||||
*/
|
||||
if (proxyport) {
|
||||
/* FIXME: Error checking ignored.
|
||||
*/
|
||||
/* FIXME: Error checking ignored.
|
||||
*/
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||
"proxy: CONNECT: sending the CONNECT request to the remote proxy");
|
||||
"proxy: CONNECT: sending the CONNECT request to the remote proxy");
|
||||
nbytes = apr_snprintf(buffer, sizeof(buffer),
|
||||
"CONNECT %s HTTP/1.0" CRLF, r->uri);
|
||||
"CONNECT %s HTTP/1.0" CRLF, r->uri);
|
||||
apr_socket_send(sock, buffer, &nbytes);
|
||||
nbytes = apr_snprintf(buffer, sizeof(buffer),
|
||||
"Proxy-agent: %s" CRLF CRLF, ap_get_server_version());
|
||||
"Proxy-agent: %s" CRLF CRLF, ap_get_server_version());
|
||||
apr_socket_send(sock, buffer, &nbytes);
|
||||
}
|
||||
else {
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||
"proxy: CONNECT: Returning 200 OK Status");
|
||||
"proxy: CONNECT: Returning 200 OK Status");
|
||||
nbytes = apr_snprintf(buffer, sizeof(buffer),
|
||||
"HTTP/1.0 200 Connection Established" CRLF);
|
||||
"HTTP/1.0 200 Connection Established" CRLF);
|
||||
ap_xlate_proto_to_ascii(buffer, nbytes);
|
||||
apr_socket_send(client_socket, buffer, &nbytes);
|
||||
nbytes = apr_snprintf(buffer, sizeof(buffer),
|
||||
"Proxy-agent: %s" CRLF CRLF, ap_get_server_version());
|
||||
"Proxy-agent: %s" CRLF CRLF, ap_get_server_version());
|
||||
ap_xlate_proto_to_ascii(buffer, nbytes);
|
||||
apr_socket_send(client_socket, buffer, &nbytes);
|
||||
#if 0
|
||||
@@ -256,7 +256,7 @@ int ap_proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
||||
}
|
||||
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||
"proxy: CONNECT: setting up poll()");
|
||||
"proxy: CONNECT: setting up poll()");
|
||||
|
||||
/*
|
||||
* Step Four: Handle Data Transfer
|
||||
@@ -268,7 +268,7 @@ int ap_proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
||||
|
||||
if ((rv = apr_pollset_create(&pollset, 2, r->pool, 0)) != APR_SUCCESS)
|
||||
{
|
||||
apr_socket_close(sock);
|
||||
apr_socket_close(sock);
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||
"proxy: CONNECT: error apr_pollset_create()");
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
@@ -288,7 +288,7 @@ int ap_proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
||||
|
||||
while (1) { /* Infinite loop until error (one side closes the connection) */
|
||||
if ((rv = apr_pollset_poll(pollset, -1, &pollcnt, &signalled)) != APR_SUCCESS) {
|
||||
apr_socket_close(sock);
|
||||
apr_socket_close(sock);
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: CONNECT: error apr_poll()");
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
@@ -375,7 +375,7 @@ int ap_proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
||||
}
|
||||
|
||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||
"proxy: CONNECT: finished with poll() - cleaning up");
|
||||
"proxy: CONNECT: finished with poll() - cleaning up");
|
||||
|
||||
/*
|
||||
* Step Five: Clean Up
|
||||
@@ -396,10 +396,10 @@ static void ap_proxy_connect_register_hook(apr_pool_t *p)
|
||||
|
||||
module AP_MODULE_DECLARE_DATA proxy_connect_module = {
|
||||
STANDARD20_MODULE_STUFF,
|
||||
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_connect_register_hook /* register hooks */
|
||||
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_connect_register_hook /* register hooks */
|
||||
};
|
||||
|
||||
@@ -96,7 +96,7 @@ static int ftp_check_globbingchars(const char *path)
|
||||
{
|
||||
for ( ; *path; ++path) {
|
||||
if (*path == '\\')
|
||||
++path;
|
||||
++path;
|
||||
if (path != '\0' && strchr(FTP_GLOBBING_CHARS, *path) != NULL)
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1531,39 +1531,39 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_worker *worker, proxy_server_conf
|
||||
r, origin, bb, &ftpmessage);
|
||||
/* then extract the Last-Modified time from it (YYYYMMDDhhmmss or YYYYMMDDhhmmss.xxx GMT). */
|
||||
if (rc == 213) {
|
||||
struct {
|
||||
char YYYY[4+1];
|
||||
char MM[2+1];
|
||||
char DD[2+1];
|
||||
char hh[2+1];
|
||||
char mm[2+1];
|
||||
char ss[2+1];
|
||||
} time_val;
|
||||
if (6 == sscanf(ftpmessage, "%4[0-9]%2[0-9]%2[0-9]%2[0-9]%2[0-9]%2[0-9]",
|
||||
time_val.YYYY, time_val.MM, time_val.DD, time_val.hh, time_val.mm, time_val.ss)) {
|
||||
struct {
|
||||
char YYYY[4+1];
|
||||
char MM[2+1];
|
||||
char DD[2+1];
|
||||
char hh[2+1];
|
||||
char mm[2+1];
|
||||
char ss[2+1];
|
||||
} time_val;
|
||||
if (6 == sscanf(ftpmessage, "%4[0-9]%2[0-9]%2[0-9]%2[0-9]%2[0-9]%2[0-9]",
|
||||
time_val.YYYY, time_val.MM, time_val.DD, time_val.hh, time_val.mm, time_val.ss)) {
|
||||
struct tm tms;
|
||||
memset (&tms, '\0', sizeof tms);
|
||||
tms.tm_year = atoi(time_val.YYYY) - 1900;
|
||||
tms.tm_mon = atoi(time_val.MM) - 1;
|
||||
tms.tm_mday = atoi(time_val.DD);
|
||||
tms.tm_hour = atoi(time_val.hh);
|
||||
tms.tm_min = atoi(time_val.mm);
|
||||
tms.tm_sec = atoi(time_val.ss);
|
||||
memset (&tms, '\0', sizeof tms);
|
||||
tms.tm_year = atoi(time_val.YYYY) - 1900;
|
||||
tms.tm_mon = atoi(time_val.MM) - 1;
|
||||
tms.tm_mday = atoi(time_val.DD);
|
||||
tms.tm_hour = atoi(time_val.hh);
|
||||
tms.tm_min = atoi(time_val.mm);
|
||||
tms.tm_sec = atoi(time_val.ss);
|
||||
#ifdef HAVE_TIMEGM /* Does system have timegm()? */
|
||||
mtime = timegm(&tms);
|
||||
mtime *= APR_USEC_PER_SEC;
|
||||
mtime = timegm(&tms);
|
||||
mtime *= APR_USEC_PER_SEC;
|
||||
#elif HAVE_GMTOFF /* does struct tm have a member tm_gmtoff? */
|
||||
/* mktime will subtract the local timezone, which is not what we want.
|
||||
* Add it again because the MDTM string is GMT
|
||||
*/
|
||||
mtime = mktime(&tms);
|
||||
mtime += tms.tm_gmtoff;
|
||||
mtime *= APR_USEC_PER_SEC;
|
||||
* Add it again because the MDTM string is GMT
|
||||
*/
|
||||
mtime = mktime(&tms);
|
||||
mtime += tms.tm_gmtoff;
|
||||
mtime *= APR_USEC_PER_SEC;
|
||||
#else
|
||||
mtime = 0L;
|
||||
mtime = 0L;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* USE_MDTM */
|
||||
/* FIXME: Handle range requests - send REST */
|
||||
buf = apr_pstrcat(p, "RETR ", ftp_escape_globbingchars(p, path), CRLF, NULL);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user