mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
hostname: Test and log useragent_host per-request across various modules,
including the scoreboard, expression and rewrite engines, setenvif, authz_host, access_compat, custom logging, ssl and REMOTE_HOST variables. PR55348 [William Rowe] This is the complete change set which applies cleanly to 2.4.x as well, the server/scoreboard.c will follow, which does not apply due to drift. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1729930 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
5
CHANGES
5
CHANGES
@@ -1,6 +1,11 @@
|
|||||||
-*- coding: utf-8 -*-
|
-*- coding: utf-8 -*-
|
||||||
Changes with Apache 2.5.0
|
Changes with Apache 2.5.0
|
||||||
|
|
||||||
|
*) hostname: Test and log useragent_host per-request across various modules,
|
||||||
|
including the scoreboard, expression and rewrite engines, setenvif,
|
||||||
|
authz_host, access_compat, custom logging, ssl and REMOTE_HOST variables.
|
||||||
|
PR55348 [William Rowe]
|
||||||
|
|
||||||
*) core: Track the useragent_host per-request when mod_remoteip or similar
|
*) core: Track the useragent_host per-request when mod_remoteip or similar
|
||||||
modules track a per-request useragent_ip. Modules should be updated
|
modules track a per-request useragent_ip. Modules should be updated
|
||||||
to inquire for ap_get_useragent_host() in place of ap_get_remote_host().
|
to inquire for ap_get_useragent_host() in place of ap_get_remote_host().
|
||||||
|
@@ -279,9 +279,7 @@ static int find_allowdeny(request_rec *r, apr_array_header_t *a, int method)
|
|||||||
if (!gothost) {
|
if (!gothost) {
|
||||||
int remotehost_is_ip;
|
int remotehost_is_ip;
|
||||||
|
|
||||||
remotehost = ap_get_remote_host(r->connection,
|
remotehost = ap_get_useragent_host(r, REMOTE_DOUBLE_REV,
|
||||||
r->per_dir_config,
|
|
||||||
REMOTE_DOUBLE_REV,
|
|
||||||
&remotehost_is_ip);
|
&remotehost_is_ip);
|
||||||
|
|
||||||
if ((remotehost == NULL) || remotehost_is_ip) {
|
if ((remotehost == NULL) || remotehost_is_ip) {
|
||||||
|
@@ -169,10 +169,7 @@ static authz_status host_check_authorization(request_rec *r,
|
|||||||
const char *remotehost = NULL;
|
const char *remotehost = NULL;
|
||||||
int remotehost_is_ip;
|
int remotehost_is_ip;
|
||||||
|
|
||||||
remotehost = ap_get_remote_host(r->connection,
|
remotehost = ap_get_useragent_host(r, REMOTE_DOUBLE_REV, &remotehost_is_ip);
|
||||||
r->per_dir_config,
|
|
||||||
REMOTE_DOUBLE_REV,
|
|
||||||
&remotehost_is_ip);
|
|
||||||
|
|
||||||
if ((remotehost == NULL) || remotehost_is_ip) {
|
if ((remotehost == NULL) || remotehost_is_ip) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01753)
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01753)
|
||||||
|
@@ -1020,8 +1020,7 @@ char *ssl_var_lookup(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r,
|
|||||||
else if (strcEQ(var, "REMOTE_ADDR"))
|
else if (strcEQ(var, "REMOTE_ADDR"))
|
||||||
result = r->useragent_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_useragent_host(r, REMOTE_NAME, NULL);
|
||||||
REMOTE_NAME, NULL);
|
|
||||||
else if (strcEQ(var, "REMOTE_IDENT"))
|
else if (strcEQ(var, "REMOTE_IDENT"))
|
||||||
result = ap_get_remote_logname(r);
|
result = ap_get_remote_logname(r);
|
||||||
else if (strcEQ(var, "REMOTE_USER"))
|
else if (strcEQ(var, "REMOTE_USER"))
|
||||||
|
@@ -451,8 +451,7 @@ static void do_rewritelog(request_rec *r, int level, char *perdir,
|
|||||||
if (!APLOG_R_IS_LEVEL(r, APLOG_DEBUG + level))
|
if (!APLOG_R_IS_LEVEL(r, APLOG_DEBUG + level))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rhost = ap_get_remote_host(r->connection, r->per_dir_config,
|
rhost = ap_get_useragent_host(r, REMOTE_NOLOOKUP, NULL);
|
||||||
REMOTE_NOLOOKUP, NULL);
|
|
||||||
rname = ap_get_remote_logname(r);
|
rname = ap_get_remote_logname(r);
|
||||||
|
|
||||||
for (redir=0, req=r; req->prev; req = req->prev) {
|
for (redir=0, req=r; req->prev; req = req->prev) {
|
||||||
|
@@ -531,8 +531,7 @@ static int match_headers(request_rec *r)
|
|||||||
val = r->connection->local_ip;
|
val = r->connection->local_ip;
|
||||||
break;
|
break;
|
||||||
case SPECIAL_REMOTE_HOST:
|
case SPECIAL_REMOTE_HOST:
|
||||||
val = ap_get_remote_host(r->connection, r->per_dir_config,
|
val = ap_get_useragent_host(r, REMOTE_NAME, NULL);
|
||||||
REMOTE_NAME, NULL);
|
|
||||||
break;
|
break;
|
||||||
case SPECIAL_REQUEST_URI:
|
case SPECIAL_REQUEST_URI:
|
||||||
val = r->uri;
|
val = r->uri;
|
||||||
|
@@ -239,7 +239,7 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
|
|||||||
num_headers = t->nelts;
|
num_headers = t->nelts;
|
||||||
}
|
}
|
||||||
|
|
||||||
remote_host = (char *)ap_get_remote_host(r->connection, r->per_dir_config, REMOTE_HOST, NULL);
|
remote_host = (char *)ap_get_useragent_host(r, REMOTE_HOST, NULL);
|
||||||
|
|
||||||
ajp_msg_reset(msg);
|
ajp_msg_reset(msg);
|
||||||
|
|
||||||
|
@@ -295,8 +295,7 @@ char *ssl_var_lookup(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r,
|
|||||||
else if (strcEQ(var, "REMOTE_ADDR"))
|
else if (strcEQ(var, "REMOTE_ADDR"))
|
||||||
result = r->useragent_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_useragent_host(r, REMOTE_NAME, NULL);
|
||||||
REMOTE_NAME, NULL);
|
|
||||||
else if (strcEQ(var, "REMOTE_IDENT"))
|
else if (strcEQ(var, "REMOTE_IDENT"))
|
||||||
result = ap_get_remote_logname(r);
|
result = ap_get_remote_logname(r);
|
||||||
else if (strcEQ(var, "REMOTE_USER"))
|
else if (strcEQ(var, "REMOTE_USER"))
|
||||||
|
@@ -1476,8 +1476,7 @@ static const char *request_var_fn(ap_expr_eval_ctx_t *ctx, const void *data)
|
|||||||
case 3:
|
case 3:
|
||||||
return r->filename;
|
return r->filename;
|
||||||
case 4:
|
case 4:
|
||||||
return ap_get_remote_host(r->connection, r->per_dir_config,
|
return ap_get_useragent_host(r, REMOTE_NAME, NULL);
|
||||||
REMOTE_NAME, NULL);
|
|
||||||
case 5:
|
case 5:
|
||||||
return ap_get_remote_logname(r);
|
return ap_get_remote_logname(r);
|
||||||
case 6:
|
case 6:
|
||||||
|
@@ -244,7 +244,7 @@ AP_DECLARE(void) ap_add_common_vars(request_rec *r)
|
|||||||
apr_table_addn(e, "SERVER_PORT",
|
apr_table_addn(e, "SERVER_PORT",
|
||||||
apr_psprintf(r->pool, "%u", ap_get_server_port(r)));
|
apr_psprintf(r->pool, "%u", ap_get_server_port(r)));
|
||||||
add_unless_null(e, "REMOTE_HOST",
|
add_unless_null(e, "REMOTE_HOST",
|
||||||
ap_get_remote_host(c, r->per_dir_config, REMOTE_HOST, NULL));
|
ap_get_useragent_host(r, REMOTE_HOST, NULL));
|
||||||
apr_table_addn(e, "REMOTE_ADDR", r->useragent_ip);
|
apr_table_addn(e, "REMOTE_ADDR", r->useragent_ip);
|
||||||
apr_table_addn(e, "DOCUMENT_ROOT", ap_document_root(r)); /* Apache */
|
apr_table_addn(e, "DOCUMENT_ROOT", ap_document_root(r)); /* Apache */
|
||||||
apr_table_setn(e, "REQUEST_SCHEME", ap_http_scheme(r));
|
apr_table_setn(e, "REQUEST_SCHEME", ap_http_scheme(r));
|
||||||
|
Reference in New Issue
Block a user