Name

ap_ get_remote_host — get client hostname or IP address

Synopsis

const char *ap_ get_remote_host(conn_rec *conn, void *dir_config, int type)

Returns the hostname or IP address (as a string) of the client. dir_config is the per_dir_config member of the current request or NULL. type is one of the following:

REMOTE_HOST

Returns the hostname or NULL (if it either couldn’t be found or hostname lookups are disabled with the HostnameLookups directive).

REMOTE_NAME

Returns the hostname or, if it can’t be found, returns the IP address.

REMOTE_NOLOOKUP

Similar to REMOTE_NAME, except that a DNS lookup is not performed. (Note that the name can still be returned if a previous call did do a DNS lookup.)

REMOTE_DOUBLE_REV

Does a double-reverse lookup (that is, look up the hostname from the IP address, then look up the IP address from the name). If the double reverse works and the IP addresses match, return the name; otherwise, return a NULL.