Commit 7b2976df authored by Jeff Trawick's avatar Jeff Trawick
Browse files

Axe ap_get_virthost_addr(). This <address>[:port] parse routine

is not used anymore and it doesn't handle IPv6, so it is best to
drop it.  If/when mod_tls (Netware) is ported to 2.0 it can use
apr_parse_addr_port().


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87354 13f79535-47bb-0310-9956-ffa450edef68
parent 20dbc821
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -1559,16 +1559,6 @@ extern int os_init_job_environment(server_rec *s, const char *user_name, int one
 */
char *ap_get_local_host(apr_pool_t *p);

/**
 * Parses a host of the form <address>[:port] :port is permitted if 'port' 
 * is not NULL
 * @param hostname The hostname to parse
 * @param port The port found in the hostname
 * @return The address of the server
 * @deffunc unsigned long ap_get_virthost_addr(char *hostname, apr_port_t *port)
 */
unsigned long ap_get_virthost_addr(char *hostname, apr_port_t *port);

/*
 * Redefine assert() to something more useful for an Apache...
 *
+0 −53
Original line number Diff line number Diff line
@@ -1845,59 +1845,6 @@ AP_DECLARE(gid_t) ap_gname2id(const char *name)
}


/*
 * Parses a host of the form <address>[:port]
 * :port is permitted if 'port' is not NULL
 */
unsigned long ap_get_virthost_addr(char *w, apr_port_t *ports)
{
    struct hostent *hep;
    unsigned long my_addr;
    char *p;

    p = strchr(w, ':');
    if (ports != NULL) {
	*ports = 0;
	if (p != NULL && strcmp(p + 1, "*") != 0)
	    *ports = atoi(p + 1);
    }

    if (p != NULL)
	*p = '\0';
    if (strcmp(w, "*") == 0) {
	if (p != NULL)
	    *p = ':';
	return htonl(INADDR_ANY);
    }

    my_addr = apr_inet_addr((char *)w);
    if (my_addr != APR_INADDR_NONE) {
	if (p != NULL)
	    *p = ':';
	return my_addr;
    }

    hep = gethostbyname(w);

    if ((!hep) || (hep->h_addrtype != APR_INET || !hep->h_addr_list[0])) {
	ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Cannot resolve host name %s --- exiting!", w);
	exit(1);
    }

    if (hep->h_addr_list[1]) {
	ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Host %s has multiple addresses ---", w);
	ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "you must choose one explicitly for use as");
	ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "a virtual host.  Exiting!!!");
	exit(1);
    }

    if (p != NULL)
	*p = ':';

    return ((struct in_addr *) (hep->h_addr))->s_addr;
}


static char *find_fqdn(apr_pool_t *a, struct hostent *p)
{
    int x;