variables, they need to be replaced with one of the following two
options as appropriate for the module:
<ul>
- <li>When you require the IP address of the client, which might
- be connected directly to the server, or might optionally be
+ <li>When you require the IP address of the user agent, which
+ might be connected directly to the server, or might optionally be
separated from the server by a transparent load balancer or
- proxy, use request_rec->client_ip and
- request_rec->client_addr.</li>
+ proxy, use request_rec->useragent_ip and
+ request_rec->useragent_addr.</li>
<li>When you require the IP address of the peer that is
connected directly to the server, which might be the client or
might be the load balancer or proxy itself, use
/** remote address information from conn_rec, can be overridden if
* necessary by a module.
*/
- apr_sockaddr_t *client_addr;
- char *client_ip;
+ apr_sockaddr_t *useragent_addr;
+ char *useragent_ip;
};
/**
return 1;
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;
}
break;
apr_ipsubnet_t **ip = (apr_ipsubnet_t **)parsed_require_line;
while (*ip) {
- if (apr_ipsubnet_test(*ip, r->client_addr))
+ if (apr_ipsubnet_test(*ip, r->useragent_addr))
return AUTHZ_GRANTED;
ip++;
}
const void *parsed_require_line)
{
if ( apr_sockaddr_equal(r->connection->local_addr,
- r->client_addr)
- || apr_ipsubnet_test(localhost_v4, r->client_addr)
+ r->useragent_addr)
+ || apr_ipsubnet_test(localhost_v4, r->useragent_addr)
#if APR_HAVE_IPV6
- || apr_ipsubnet_test(localhost_v6, r->client_addr)
+ || apr_ipsubnet_test(localhost_v6, r->useragent_addr)
#endif
)
{
else if (strcEQ(var, "REQUEST_FILENAME"))
result = r->filename;
else if (strcEQ(var, "REMOTE_ADDR"))
- result = r->client_ip;
+ result = r->useragent_ip;
else if (strcEQ(var, "REMOTE_HOST"))
result = ap_get_remote_host(r->connection, r->per_dir_config,
REMOTE_NAME, NULL);
apr_file_printf(stderr_log,
"[%s] [client %s] mod_ext_filter (%d)%s: %s\n",
time_str,
- r->client_ip,
+ r->useragent_ip,
err,
apr_strerror(err, errbuf, sizeof(errbuf)),
description);
new->prev = r;
r->next = new;
- new->client_addr = r->client_addr;
- new->client_ip = r->client_ip;
+ new->useragent_addr = r->useragent_addr;
+ new->useragent_ip = r->useragent_ip;
/* Must have prev and next pointers set before calling create_request
* hook.
return r->connection->peer_ip;
}
else {
- return r->client_ip;
+ return r->useragent_ip;
}
}
port = r->server->port ? r->server->port : ap_default_port(r);
}
else if (!strcasecmp(a, "remote")) {
- port = r->client_addr->port;
+ port = r->useragent_addr->port;
}
else if (!strcasecmp(a, "local")) {
port = r->connection->local_addr->port;
else if (!strcmp(var, "IPV6")) {
int flag = FALSE;
#if APR_HAVE_IPV6
- apr_sockaddr_t *addr = r->client_addr;
+ apr_sockaddr_t *addr = r->useragent_addr;
flag = (addr->family == AF_INET6 &&
!IN6_IS_ADDR_V4MAPPED((struct in6_addr *)addr->ipaddr_ptr));
rewritelog((r, 1, ctx->perdir, "IPV6='%s'", flag ? "on" : "off"));
case 'D':
if (*var == 'R' && !strcmp(var, "REMOTE_ADDR")) {
- result = r->client_ip;
+ result = r->useragent_ip;
}
else if (!strcmp(var, "SERVER_ADDR")) {
result = r->connection->local_ip;
REMOTE_NAME, NULL);
}
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;
} remoteip_config_t;
typedef struct {
- apr_sockaddr_t *client_addr;
- char *client_ip;
+ apr_sockaddr_t *useragent_addr;
+ char *useragent_ip;
/** The list of proxy ip's ignored as remote ip's */
const char *proxy_ips;
/** The remaining list of untrusted proxied remote ip's */
}
}
- req->client_addr = temp_sa;
- apr_sockaddr_ip_get(&req->client_ip, req->client_addr);
+ req->useragent_addr = temp_sa;
+ apr_sockaddr_ip_get(&req->useragent_ip, req->useragent_addr);
}
/* Nothing happened? */
}
}
- r->client_addr = req->client_addr;
- r->client_ip = req->client_ip;
+ r->useragent_addr = req->useragent_addr;
+ r->useragent_ip = req->useragent_ip;
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
req->proxy_ips
? "Using %s as client's IP by proxies %s"
: "Using %s as client's IP by internal proxies",
- req->client_ip, req->proxy_ips);
+ req->useragent_ip, req->proxy_ips);
return OK;
}
last_name = b->name;
switch (b->special_type) {
case SPECIAL_REMOTE_ADDR:
- val = r->client_ip;
+ val = r->useragent_ip;
break;
case SPECIAL_SERVER_ADDR:
val = r->connection->local_ip;
ajp_msg_append_uint8(msg, (apr_byte_t) method) ||
ajp_msg_append_string(msg, r->protocol) ||
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, ap_get_server_name(r)) ||
ajp_msg_append_uint16(msg, (apr_uint16_t)r->connection->local_addr->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) ||
ajp_msg_append_string(msg, key) ||
ajp_msg_append_string(msg, val)) {
* determine, where the original request came from.
*/
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
* original request hostname was.
rp->input_filters = c->input_filters;
rp->proto_output_filters = c->output_filters;
rp->proto_input_filters = c->input_filters;
- rp->client_ip = c->peer_ip;
- rp->client_addr = c->peer_addr;
+ rp->useragent_ip = c->peer_ip;
+ rp->useragent_addr = c->peer_addr;
rp->request_config = ap_create_request_config(pool);
proxy_run_create_req(r, rp);
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(02266)
"Access to %s denied for %s "
"(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)
"Failed expression: %s", req->cpExpr);
else if (strcEQ(var, "REQUEST_FILENAME"))
result = r->filename;
else if (strcEQ(var, "REMOTE_ADDR"))
- result = r->client_ip;
+ result = r->useragent_ip;
else if (strcEQ(var, "REMOTE_HOST"))
result = ap_get_remote_host(r->connection, r->per_dir_config,
REMOTE_NAME, NULL);