mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
No crutches, people!
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95854 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -477,15 +477,15 @@ static int proxy_handler(request_rec *r)
|
|||||||
|
|
||||||
static void * create_proxy_config(apr_pool_t *p, server_rec *s)
|
static void * create_proxy_config(apr_pool_t *p, server_rec *s)
|
||||||
{
|
{
|
||||||
proxy_server_conf *ps = ap_pcalloc(p, sizeof(proxy_server_conf));
|
proxy_server_conf *ps = apr_pcalloc(p, sizeof(proxy_server_conf));
|
||||||
|
|
||||||
ps->sec_proxy = ap_make_array(p, 10, sizeof(ap_conf_vector_t *));
|
ps->sec_proxy = apr_array_make(p, 10, sizeof(ap_conf_vector_t *));
|
||||||
ps->proxies = ap_make_array(p, 10, sizeof(struct proxy_remote));
|
ps->proxies = apr_array_make(p, 10, sizeof(struct proxy_remote));
|
||||||
ps->aliases = ap_make_array(p, 10, sizeof(struct proxy_alias));
|
ps->aliases = apr_array_make(p, 10, sizeof(struct proxy_alias));
|
||||||
ps->raliases = ap_make_array(p, 10, sizeof(struct proxy_alias));
|
ps->raliases = apr_array_make(p, 10, sizeof(struct proxy_alias));
|
||||||
ps->noproxies = ap_make_array(p, 10, sizeof(struct noproxy_entry));
|
ps->noproxies = apr_array_make(p, 10, sizeof(struct noproxy_entry));
|
||||||
ps->dirconn = ap_make_array(p, 10, sizeof(struct dirconn_entry));
|
ps->dirconn = apr_array_make(p, 10, sizeof(struct dirconn_entry));
|
||||||
ps->allowed_connect_ports = ap_make_array(p, 10, sizeof(int));
|
ps->allowed_connect_ports = apr_array_make(p, 10, sizeof(int));
|
||||||
ps->domain = NULL;
|
ps->domain = NULL;
|
||||||
ps->viaopt = via_off; /* initially backward compatible with 1.3.1 */
|
ps->viaopt = via_off; /* initially backward compatible with 1.3.1 */
|
||||||
ps->viaopt_set = 0; /* 0 means default */
|
ps->viaopt_set = 0; /* 0 means default */
|
||||||
@@ -508,7 +508,7 @@ static void * create_proxy_config(apr_pool_t *p, server_rec *s)
|
|||||||
|
|
||||||
static void * merge_proxy_config(apr_pool_t *p, void *basev, void *overridesv)
|
static void * merge_proxy_config(apr_pool_t *p, void *basev, void *overridesv)
|
||||||
{
|
{
|
||||||
proxy_server_conf *ps = ap_pcalloc(p, sizeof(proxy_server_conf));
|
proxy_server_conf *ps = apr_pcalloc(p, sizeof(proxy_server_conf));
|
||||||
proxy_server_conf *base = (proxy_server_conf *) basev;
|
proxy_server_conf *base = (proxy_server_conf *) basev;
|
||||||
proxy_server_conf *overrides = (proxy_server_conf *) overridesv;
|
proxy_server_conf *overrides = (proxy_server_conf *) overridesv;
|
||||||
|
|
||||||
|
@@ -83,7 +83,6 @@
|
|||||||
|
|
||||||
#include "apr_hooks.h"
|
#include "apr_hooks.h"
|
||||||
#include "apr.h"
|
#include "apr.h"
|
||||||
#include "apr_compat.h"
|
|
||||||
#include "apr_lib.h"
|
#include "apr_lib.h"
|
||||||
#include "apr_strings.h"
|
#include "apr_strings.h"
|
||||||
#include "apr_buckets.h"
|
#include "apr_buckets.h"
|
||||||
|
@@ -93,7 +93,7 @@ static int decodeenc(char *x)
|
|||||||
for (i = 0, j = 0; x[i] != '\0'; i++, j++) {
|
for (i = 0, j = 0; x[i] != '\0'; i++, j++) {
|
||||||
/* decode it if not already done */
|
/* decode it if not already done */
|
||||||
ch = x[i];
|
ch = x[i];
|
||||||
if (ch == '%' && ap_isxdigit(x[i + 1]) && ap_isxdigit(x[i + 2])) {
|
if (ch == '%' && apr_isxdigit(x[i + 1]) && apr_isxdigit(x[i + 2])) {
|
||||||
ch = ap_proxy_hex2c(&x[i + 1]);
|
ch = ap_proxy_hex2c(&x[i + 1]);
|
||||||
i += 2;
|
i += 2;
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ static int ftp_check_string(const char *x)
|
|||||||
|
|
||||||
for (i = 0; x[i] != '\0'; i++) {
|
for (i = 0; x[i] != '\0'; i++) {
|
||||||
ch = x[i];
|
ch = x[i];
|
||||||
if (ch == '%' && ap_isxdigit(x[i + 1]) && ap_isxdigit(x[i + 2])) {
|
if (ch == '%' && apr_isxdigit(x[i + 1]) && apr_isxdigit(x[i + 2])) {
|
||||||
ch = ap_proxy_hex2c(&x[i + 1]);
|
ch = ap_proxy_hex2c(&x[i + 1]);
|
||||||
i += 2;
|
i += 2;
|
||||||
}
|
}
|
||||||
@@ -643,7 +643,7 @@ proxy_ftp_command(const char *cmd, request_rec *r, conn_rec *ftp_ctrl,
|
|||||||
ap_pass_brigade(ftp_ctrl->output_filters, bb);
|
ap_pass_brigade(ftp_ctrl->output_filters, bb);
|
||||||
|
|
||||||
/* strip off the CRLF for logging */
|
/* strip off the CRLF for logging */
|
||||||
ap_cpystrn(message, cmd, sizeof message);
|
apr_cpystrn(message, cmd, sizeof(message));
|
||||||
if ((crlf = strchr(message, '\r')) != NULL ||
|
if ((crlf = strchr(message, '\r')) != NULL ||
|
||||||
(crlf = strchr(message, '\n')) != NULL)
|
(crlf = strchr(message, '\n')) != NULL)
|
||||||
*crlf = '\0';
|
*crlf = '\0';
|
||||||
@@ -663,7 +663,7 @@ proxy_ftp_command(const char *cmd, request_rec *r, conn_rec *ftp_ctrl,
|
|||||||
"proxy:<FTP: %3.3u %s", rc, message);
|
"proxy:<FTP: %3.3u %s", rc, message);
|
||||||
|
|
||||||
if (pmessage != NULL)
|
if (pmessage != NULL)
|
||||||
*pmessage = ap_pstrdup(r->pool, message);
|
*pmessage = apr_pstrdup(r->pool, message);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -807,7 +807,7 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf,
|
|||||||
|
|
||||||
/* stuff for PASV mode */
|
/* stuff for PASV mode */
|
||||||
int connect = 0, use_port = 0;
|
int connect = 0, use_port = 0;
|
||||||
char dates[AP_RFC822_DATE_LEN];
|
char dates[APR_RFC822_DATE_LEN];
|
||||||
|
|
||||||
/* is this for us? */
|
/* is this for us? */
|
||||||
if (proxyhost) {
|
if (proxyhost) {
|
||||||
@@ -826,7 +826,7 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf,
|
|||||||
/* create space for state information */
|
/* create space for state information */
|
||||||
backend = (proxy_conn_rec *) ap_get_module_config(c->conn_config, &proxy_ftp_module);
|
backend = (proxy_conn_rec *) ap_get_module_config(c->conn_config, &proxy_ftp_module);
|
||||||
if (!backend) {
|
if (!backend) {
|
||||||
backend = ap_pcalloc(c->pool, sizeof(proxy_conn_rec));
|
backend = apr_pcalloc(c->pool, sizeof(proxy_conn_rec));
|
||||||
backend->connection = NULL;
|
backend->connection = NULL;
|
||||||
backend->hostname = NULL;
|
backend->hostname = NULL;
|
||||||
backend->port = 0;
|
backend->port = 0;
|
||||||
@@ -860,12 +860,12 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf,
|
|||||||
*(type_suffix++) = '\0';
|
*(type_suffix++) = '\0';
|
||||||
|
|
||||||
if (type_suffix != NULL && strncmp(type_suffix, "type=", 5) == 0
|
if (type_suffix != NULL && strncmp(type_suffix, "type=", 5) == 0
|
||||||
&& ap_isalpha(type_suffix[5])) {
|
&& apr_isalpha(type_suffix[5])) {
|
||||||
/* "type=d" forces a dir listing.
|
/* "type=d" forces a dir listing.
|
||||||
* The other types (i|a|e) are directly used for the ftp TYPE command
|
* The other types (i|a|e) are directly used for the ftp TYPE command
|
||||||
*/
|
*/
|
||||||
if ( ! (dirlisting = (ap_tolower(type_suffix[5]) == 'd')))
|
if ( ! (dirlisting = (apr_tolower(type_suffix[5]) == 'd')))
|
||||||
xfer_type = ap_toupper(type_suffix[5]);
|
xfer_type = apr_toupper(type_suffix[5]);
|
||||||
|
|
||||||
/* Check valid types, rather than ignoring invalid types silently: */
|
/* Check valid types, rather than ignoring invalid types silently: */
|
||||||
if (strchr("AEI", xfer_type) == NULL)
|
if (strchr("AEI", xfer_type) == NULL)
|
||||||
@@ -1091,8 +1091,8 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf,
|
|||||||
break;
|
break;
|
||||||
if (*secs_str != '\0') {
|
if (*secs_str != '\0') {
|
||||||
secs = atol(secs_str);
|
secs = atol(secs_str);
|
||||||
ap_table_add(r->headers_out, "Retry-After",
|
apr_table_add(r->headers_out, "Retry-After",
|
||||||
apr_psprintf(p, "%lu", (unsigned long)(60 * secs)));
|
apr_psprintf(p, "%lu", (unsigned long)(60 * secs)));
|
||||||
}
|
}
|
||||||
return ap_proxyerror(r, HTTP_SERVICE_UNAVAILABLE, ftpmessage);
|
return ap_proxyerror(r, HTTP_SERVICE_UNAVAILABLE, ftpmessage);
|
||||||
}
|
}
|
||||||
|
@@ -779,19 +779,19 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
/* handle Via header in response */
|
/* handle Via header in response */
|
||||||
if (conf->viaopt != via_off && conf->viaopt != via_block) {
|
if (conf->viaopt != via_off && conf->viaopt != via_block) {
|
||||||
/* create a "Via:" response header entry and merge it */
|
/* create a "Via:" response header entry and merge it */
|
||||||
ap_table_mergen(r->headers_out, "Via",
|
apr_table_mergen(r->headers_out, "Via",
|
||||||
(conf->viaopt == via_full)
|
(conf->viaopt == via_full)
|
||||||
? apr_psprintf(p, "%d.%d %s%s (%s)",
|
? apr_psprintf(p, "%d.%d %s%s (%s)",
|
||||||
HTTP_VERSION_MAJOR(r->proto_num),
|
HTTP_VERSION_MAJOR(r->proto_num),
|
||||||
HTTP_VERSION_MINOR(r->proto_num),
|
HTTP_VERSION_MINOR(r->proto_num),
|
||||||
ap_get_server_name(r),
|
ap_get_server_name(r),
|
||||||
server_portstr,
|
server_portstr,
|
||||||
AP_SERVER_BASEVERSION)
|
AP_SERVER_BASEVERSION)
|
||||||
: apr_psprintf(p, "%d.%d %s%s",
|
: apr_psprintf(p, "%d.%d %s%s",
|
||||||
HTTP_VERSION_MAJOR(r->proto_num),
|
HTTP_VERSION_MAJOR(r->proto_num),
|
||||||
HTTP_VERSION_MINOR(r->proto_num),
|
HTTP_VERSION_MINOR(r->proto_num),
|
||||||
ap_get_server_name(r),
|
ap_get_server_name(r),
|
||||||
server_portstr)
|
server_portstr)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1050,7 +1050,7 @@ int ap_proxy_http_handler(request_rec *r, proxy_server_conf *conf,
|
|||||||
}
|
}
|
||||||
/* create space for state information */
|
/* create space for state information */
|
||||||
if (!backend) {
|
if (!backend) {
|
||||||
backend = ap_pcalloc(c->pool, sizeof(proxy_conn_rec));
|
backend = apr_pcalloc(c->pool, sizeof(proxy_conn_rec));
|
||||||
backend->connection = NULL;
|
backend->connection = NULL;
|
||||||
backend->hostname = NULL;
|
backend->hostname = NULL;
|
||||||
backend->port = 0;
|
backend->port = 0;
|
||||||
|
@@ -204,7 +204,7 @@ PROXY_DECLARE(char *)ap_proxy_canonenc(apr_pool_t *p, const char *x, int len, en
|
|||||||
}
|
}
|
||||||
/* decode it if not already done */
|
/* decode it if not already done */
|
||||||
if (isenc && ch == '%') {
|
if (isenc && ch == '%') {
|
||||||
if (!ap_isxdigit(x[i + 1]) || !ap_isxdigit(x[i + 2]))
|
if (!apr_isxdigit(x[i + 1]) || !apr_isxdigit(x[i + 2]))
|
||||||
return NULL;
|
return NULL;
|
||||||
ch = ap_proxy_hex2c(&x[i + 1]);
|
ch = ap_proxy_hex2c(&x[i + 1]);
|
||||||
i += 2;
|
i += 2;
|
||||||
@@ -370,7 +370,7 @@ PROXY_DECLARE(const char *)
|
|||||||
&min, &sec, &year) != 7)
|
&min, &sec, &year) != 7)
|
||||||
return x;
|
return x;
|
||||||
for (wk = 0; wk < 7; wk++)
|
for (wk = 0; wk < 7; wk++)
|
||||||
if (strcmp(week, ap_day_snames[wk]) == 0)
|
if (strcmp(week, apr_day_snames[wk]) == 0)
|
||||||
break;
|
break;
|
||||||
if (wk == 7)
|
if (wk == 7)
|
||||||
return x;
|
return x;
|
||||||
@@ -378,14 +378,14 @@ PROXY_DECLARE(const char *)
|
|||||||
|
|
||||||
/* check date */
|
/* check date */
|
||||||
for (mon = 0; mon < 12; mon++)
|
for (mon = 0; mon < 12; mon++)
|
||||||
if (strcmp(month, ap_month_snames[mon]) == 0)
|
if (strcmp(month, apr_month_snames[mon]) == 0)
|
||||||
break;
|
break;
|
||||||
if (mon == 12)
|
if (mon == 12)
|
||||||
return x;
|
return x;
|
||||||
|
|
||||||
q = apr_palloc(p, 30);
|
q = apr_palloc(p, 30);
|
||||||
apr_snprintf(q, 30, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", ap_day_snames[wk],
|
apr_snprintf(q, 30, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", apr_day_snames[wk],
|
||||||
mday, ap_month_snames[mon], year, hour, min, sec);
|
mday, apr_month_snames[mon], year, hour, min, sec);
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,7 +434,7 @@ PROXY_DECLARE(apr_table_t *)ap_proxy_read_headers(request_rec *r, request_rec *r
|
|||||||
char *value, *end;
|
char *value, *end;
|
||||||
char field[MAX_STRING_LEN];
|
char field[MAX_STRING_LEN];
|
||||||
|
|
||||||
headers_out = ap_make_table(r->pool, 20);
|
headers_out = apr_table_make(r->pool, 20);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read header lines until we get the empty separator line, a read error,
|
* Read header lines until we get the empty separator line, a read error,
|
||||||
|
Reference in New Issue
Block a user