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

Further clarify the naming of the entity that originates the request by

calling that entity a useragent instead of a client.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1214003 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Graham Leggett
2011-12-14 00:31:51 +00:00
parent a4e7bcc4d4
commit 2af2fa44ad
15 changed files with 35 additions and 35 deletions

View File

@@ -466,11 +466,11 @@
variables, they need to be replaced with one of the following two variables, they need to be replaced with one of the following two
options as appropriate for the module: options as appropriate for the module:
<ul> <ul>
<li>When you require the IP address of the client, which might <li>When you require the IP address of the user agent, which
be connected directly to the server, or might optionally be might be connected directly to the server, or might optionally be
separated from the server by a transparent load balancer or separated from the server by a transparent load balancer or
proxy, use request_rec->client_ip and proxy, use request_rec->useragent_ip and
request_rec->client_addr.</li> request_rec->useragent_addr.</li>
<li>When you require the IP address of the peer that is <li>When you require the IP address of the peer that is
connected directly to the server, which might be the client or connected directly to the server, which might be the client or
might be the load balancer or proxy itself, use might be the load balancer or proxy itself, use

View File

@@ -1008,8 +1008,8 @@ struct request_rec {
/** remote address information from conn_rec, can be overridden if /** remote address information from conn_rec, can be overridden if
* necessary by a module. * necessary by a module.
*/ */
apr_sockaddr_t *client_addr; apr_sockaddr_t *useragent_addr;
char *client_ip; char *useragent_ip;
}; };
/** /**

View File

@@ -271,7 +271,7 @@ static int find_allowdeny(request_rec *r, apr_array_header_t *a, int method)
return 1; return 1;
case T_IP: case T_IP:
if (apr_ipsubnet_test(ap[i].x.ip, r->client_addr)) { if (apr_ipsubnet_test(ap[i].x.ip, r->useragent_addr)) {
return 1; return 1;
} }
break; break;

View File

@@ -153,7 +153,7 @@ static authz_status ip_check_authorization(request_rec *r,
apr_ipsubnet_t **ip = (apr_ipsubnet_t **)parsed_require_line; apr_ipsubnet_t **ip = (apr_ipsubnet_t **)parsed_require_line;
while (*ip) { while (*ip) {
if (apr_ipsubnet_test(*ip, r->client_addr)) if (apr_ipsubnet_test(*ip, r->useragent_addr))
return AUTHZ_GRANTED; return AUTHZ_GRANTED;
ip++; ip++;
} }
@@ -201,10 +201,10 @@ static authz_status local_check_authorization(request_rec *r,
const void *parsed_require_line) const void *parsed_require_line)
{ {
if ( apr_sockaddr_equal(r->connection->local_addr, if ( apr_sockaddr_equal(r->connection->local_addr,
r->client_addr) r->useragent_addr)
|| apr_ipsubnet_test(localhost_v4, r->client_addr) || apr_ipsubnet_test(localhost_v4, r->useragent_addr)
#if APR_HAVE_IPV6 #if APR_HAVE_IPV6
|| apr_ipsubnet_test(localhost_v6, r->client_addr) || apr_ipsubnet_test(localhost_v6, r->useragent_addr)
#endif #endif
) )
{ {

View File

@@ -1001,7 +1001,7 @@ char *ssl_var_lookup(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r,
else if (strcEQ(var, "REQUEST_FILENAME")) else if (strcEQ(var, "REQUEST_FILENAME"))
result = r->filename; result = r->filename;
else if (strcEQ(var, "REMOTE_ADDR")) else if (strcEQ(var, "REMOTE_ADDR"))
result = r->client_ip; result = r->useragent_ip;
else if (strcEQ(var, "REMOTE_HOST")) else if (strcEQ(var, "REMOTE_HOST"))
result = ap_get_remote_host(r->connection, r->per_dir_config, result = ap_get_remote_host(r->connection, r->per_dir_config,
REMOTE_NAME, NULL); REMOTE_NAME, NULL);

View File

@@ -406,7 +406,7 @@ static void child_errfn(apr_pool_t *pool, apr_status_t err, const char *descript
apr_file_printf(stderr_log, apr_file_printf(stderr_log,
"[%s] [client %s] mod_ext_filter (%d)%s: %s\n", "[%s] [client %s] mod_ext_filter (%d)%s: %s\n",
time_str, time_str,
r->client_ip, r->useragent_ip,
err, err,
apr_strerror(err, errbuf, sizeof(errbuf)), apr_strerror(err, errbuf, sizeof(errbuf)),
description); description);

View File

@@ -439,8 +439,8 @@ static request_rec *internal_internal_redirect(const char *new_uri,
new->prev = r; new->prev = r;
r->next = new; r->next = new;
new->client_addr = r->client_addr; new->useragent_addr = r->useragent_addr;
new->client_ip = r->client_ip; new->useragent_ip = r->useragent_ip;
/* Must have prev and next pointers set before calling create_request /* Must have prev and next pointers set before calling create_request
* hook. * hook.

View File

@@ -314,7 +314,7 @@ static const char *log_remote_address(request_rec *r, char *a)
return r->connection->peer_ip; return r->connection->peer_ip;
} }
else { else {
return r->client_ip; return r->useragent_ip;
} }
} }
@@ -763,7 +763,7 @@ static const char *log_server_port(request_rec *r, char *a)
port = r->server->port ? r->server->port : ap_default_port(r); port = r->server->port ? r->server->port : ap_default_port(r);
} }
else if (!strcasecmp(a, "remote")) { else if (!strcasecmp(a, "remote")) {
port = r->client_addr->port; port = r->useragent_addr->port;
} }
else if (!strcasecmp(a, "local")) { else if (!strcasecmp(a, "local")) {
port = r->connection->local_addr->port; port = r->connection->local_addr->port;

View File

@@ -1861,7 +1861,7 @@ static char *lookup_variable(char *var, rewrite_ctx *ctx)
else if (!strcmp(var, "IPV6")) { else if (!strcmp(var, "IPV6")) {
int flag = FALSE; int flag = FALSE;
#if APR_HAVE_IPV6 #if APR_HAVE_IPV6
apr_sockaddr_t *addr = r->client_addr; apr_sockaddr_t *addr = r->useragent_addr;
flag = (addr->family == AF_INET6 && flag = (addr->family == AF_INET6 &&
!IN6_IS_ADDR_V4MAPPED((struct in6_addr *)addr->ipaddr_ptr)); !IN6_IS_ADDR_V4MAPPED((struct in6_addr *)addr->ipaddr_ptr));
rewritelog((r, 1, ctx->perdir, "IPV6='%s'", flag ? "on" : "off")); rewritelog((r, 1, ctx->perdir, "IPV6='%s'", flag ? "on" : "off"));
@@ -1967,7 +1967,7 @@ static char *lookup_variable(char *var, rewrite_ctx *ctx)
case 'D': case 'D':
if (*var == 'R' && !strcmp(var, "REMOTE_ADDR")) { if (*var == 'R' && !strcmp(var, "REMOTE_ADDR")) {
result = r->client_ip; result = r->useragent_ip;
} }
else if (!strcmp(var, "SERVER_ADDR")) { else if (!strcmp(var, "SERVER_ADDR")) {
result = r->connection->local_ip; result = r->connection->local_ip;
@@ -2006,7 +2006,7 @@ static char *lookup_variable(char *var, rewrite_ctx *ctx)
REMOTE_NAME, NULL); REMOTE_NAME, NULL);
} }
else if (!strcmp(var, "REMOTE_PORT")) { else if (!strcmp(var, "REMOTE_PORT")) {
return apr_itoa(r->pool, r->client_addr->port); return apr_itoa(r->pool, r->useragent_addr->port);
} }
break; break;

View File

@@ -51,8 +51,8 @@ typedef struct {
} remoteip_config_t; } remoteip_config_t;
typedef struct { typedef struct {
apr_sockaddr_t *client_addr; apr_sockaddr_t *useragent_addr;
char *client_ip; char *useragent_ip;
/** The list of proxy ip's ignored as remote ip's */ /** The list of proxy ip's ignored as remote ip's */
const char *proxy_ips; const char *proxy_ips;
/** The remaining list of untrusted proxied remote ip's */ /** The remaining list of untrusted proxied remote ip's */
@@ -367,8 +367,8 @@ static int remoteip_modify_request(request_rec *r)
} }
} }
req->client_addr = temp_sa; req->useragent_addr = temp_sa;
apr_sockaddr_ip_get(&req->client_ip, req->client_addr); apr_sockaddr_ip_get(&req->useragent_ip, req->useragent_addr);
} }
/* Nothing happened? */ /* Nothing happened? */
@@ -394,14 +394,14 @@ static int remoteip_modify_request(request_rec *r)
} }
} }
r->client_addr = req->client_addr; r->useragent_addr = req->useragent_addr;
r->client_ip = req->client_ip; r->useragent_ip = req->useragent_ip;
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
req->proxy_ips req->proxy_ips
? "Using %s as client's IP by proxies %s" ? "Using %s as client's IP by proxies %s"
: "Using %s as client's IP by internal proxies", : "Using %s as client's IP by internal proxies",
req->client_ip, req->proxy_ips); req->useragent_ip, req->proxy_ips);
return OK; return OK;
} }

View File

@@ -527,7 +527,7 @@ static int match_headers(request_rec *r)
last_name = b->name; last_name = b->name;
switch (b->special_type) { switch (b->special_type) {
case SPECIAL_REMOTE_ADDR: case SPECIAL_REMOTE_ADDR:
val = r->client_ip; val = r->useragent_ip;
break; break;
case SPECIAL_SERVER_ADDR: case SPECIAL_SERVER_ADDR:
val = r->connection->local_ip; val = r->connection->local_ip;

View File

@@ -247,7 +247,7 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
ajp_msg_append_uint8(msg, (apr_byte_t) method) || ajp_msg_append_uint8(msg, (apr_byte_t) method) ||
ajp_msg_append_string(msg, r->protocol) || ajp_msg_append_string(msg, r->protocol) ||
ajp_msg_append_string(msg, uri->path) || ajp_msg_append_string(msg, uri->path) ||
ajp_msg_append_string(msg, r->client_ip) || ajp_msg_append_string(msg, r->useragent_ip) ||
ajp_msg_append_string(msg, remote_host) || ajp_msg_append_string(msg, remote_host) ||
ajp_msg_append_string(msg, ap_get_server_name(r)) || ajp_msg_append_string(msg, ap_get_server_name(r)) ||
ajp_msg_append_uint16(msg, (apr_uint16_t)r->connection->local_addr->port) || ajp_msg_append_uint16(msg, (apr_uint16_t)r->connection->local_addr->port) ||
@@ -413,7 +413,7 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
*/ */
{ {
const char *key = SC_A_REQ_REMOTE_PORT; const char *key = SC_A_REQ_REMOTE_PORT;
char *val = apr_itoa(r->pool, r->client_addr->port); char *val = apr_itoa(r->pool, r->useragent_addr->port);
if (ajp_msg_append_uint8(msg, SC_A_REQ_ATTRIBUTE) || if (ajp_msg_append_uint8(msg, SC_A_REQ_ATTRIBUTE) ||
ajp_msg_append_string(msg, key) || ajp_msg_append_string(msg, key) ||
ajp_msg_append_string(msg, val)) { ajp_msg_append_string(msg, val)) {

View File

@@ -908,7 +908,7 @@ int ap_proxy_http_request(apr_pool_t *p, request_rec *r,
* determine, where the original request came from. * determine, where the original request came from.
*/ */
apr_table_mergen(r->headers_in, "X-Forwarded-For", apr_table_mergen(r->headers_in, "X-Forwarded-For",
r->client_ip); r->useragent_ip);
/* Add X-Forwarded-Host: so that upstream knows what the /* Add X-Forwarded-Host: so that upstream knows what the
* original request hostname was. * original request hostname was.
@@ -1295,8 +1295,8 @@ static request_rec *make_fake_req(conn_rec *c, request_rec *r)
rp->input_filters = c->input_filters; rp->input_filters = c->input_filters;
rp->proto_output_filters = c->output_filters; rp->proto_output_filters = c->output_filters;
rp->proto_input_filters = c->input_filters; rp->proto_input_filters = c->input_filters;
rp->client_ip = c->peer_ip; rp->useragent_ip = c->peer_ip;
rp->client_addr = c->peer_addr; rp->useragent_addr = c->peer_addr;
rp->request_config = ap_create_request_config(pool); rp->request_config = ap_create_request_config(pool);
proxy_run_create_req(r, rp); proxy_run_create_req(r, rp);

View File

@@ -918,7 +918,7 @@ int ssl_hook_Access(request_rec *r)
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(02266) ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(02266)
"Access to %s denied for %s " "Access to %s denied for %s "
"(requirement expression not fulfilled)", "(requirement expression not fulfilled)",
r->filename, r->client_ip); r->filename, r->useragent_ip);
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(02228) ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(02228)
"Failed expression: %s", req->cpExpr); "Failed expression: %s", req->cpExpr);

View File

@@ -188,7 +188,7 @@ char *ssl_var_lookup(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r,
else if (strcEQ(var, "REQUEST_FILENAME")) else if (strcEQ(var, "REQUEST_FILENAME"))
result = r->filename; result = r->filename;
else if (strcEQ(var, "REMOTE_ADDR")) else if (strcEQ(var, "REMOTE_ADDR"))
result = r->client_ip; result = r->useragent_ip;
else if (strcEQ(var, "REMOTE_HOST")) else if (strcEQ(var, "REMOTE_HOST"))
result = ap_get_remote_host(r->connection, r->per_dir_config, result = ap_get_remote_host(r->connection, r->per_dir_config,
REMOTE_NAME, NULL); REMOTE_NAME, NULL);