diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2016-02-12 01:04:58 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2016-02-12 01:04:58 +0000 |
commit | 9d9b20f5a9b2c5c2c180a622d3d2461efb975fea (patch) | |
tree | e17eb76bb0ce4d886a7bd41a649ad1bca7e0451a /include/http_core.h | |
parent | db5f097737f7307f4a9d0dc83120cf431a1486c3 (diff) | |
download | httpd-9d9b20f5a9b2c5c2c180a622d3d2461efb975fea.tar.gz |
Introduce an ap_get_useragent_host() accessor to replace the old
ap_get_remote_host() in most applications, but preserve the original
behavior for all ap_get_remote_host() consumers (mostly, because we
don't have the request_rec in the first place, and also to avoid any
unintended consequences).
This accessor continues to store the remote_host of connection based
uesr agents within the conn_rec for optimization. Only where some
other module modifies the useragent_addr will we perform a per-request
query of the remote_host.
(Fixed compilation issues noted by Ranier, applies to 2.4.x trunk,
modulo CHANGES and ap_mmn.h)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1729929 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include/http_core.h')
-rw-r--r-- | include/http_core.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/include/http_core.h b/include/http_core.h index 684fba49cf..a6f1d28b8b 100644 --- a/include/http_core.h +++ b/include/http_core.h @@ -159,6 +159,32 @@ AP_DECLARE(int) ap_allow_overrides(request_rec *r); AP_DECLARE(const char *) ap_document_root(request_rec *r); /** + * Lookup the remote user agent's DNS name or IP address + * @ingroup get_remote_hostname + * @param req The current request + * @param type The type of lookup to perform. One of: + * <pre> + * REMOTE_HOST returns the hostname, or NULL if the hostname + * lookup fails. It will force a DNS lookup according to the + * HostnameLookups setting. + * REMOTE_NAME returns the hostname, or the dotted quad if the + * hostname lookup fails. It will force a DNS lookup according + * to the HostnameLookups setting. + * REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is + * never forced. + * REMOTE_DOUBLE_REV will always force a DNS lookup, and also force + * a double reverse lookup, regardless of the HostnameLookups + * setting. The result is the (double reverse checked) + * hostname, or NULL if any of the lookups fail. + * </pre> + * @param str_is_ip unless NULL is passed, this will be set to non-zero on + * output when an IP address string is returned + * @return The remote hostname (based on the request useragent_ip) + */ +AP_DECLARE(const char *) ap_get_useragent_host(request_rec *req, int type, + int *str_is_ip); + +/** * Lookup the remote client's DNS name or IP address * @ingroup get_remote_host * @param conn The current connection @@ -180,7 +206,7 @@ AP_DECLARE(const char *) ap_document_root(request_rec *r); * </pre> * @param str_is_ip unless NULL is passed, this will be set to non-zero on output when an IP address * string is returned - * @return The remote hostname + * @return The remote hostname (based on the connection client_ip) */ AP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip); |