From: Jeff Trawick Date: Fri, 15 Dec 2000 13:28:57 +0000 (+0000) Subject: Axe ap_get_virthost_addr(). This
[:port] parse routine X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7b2976dfeea0918ccc37e6b6ca3e1a31fa5cbf4e;p=apache Axe ap_get_virthost_addr(). This
[: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 --- diff --git a/include/httpd.h b/include/httpd.h index 3451a141a0..e8f324cb14 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -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
[: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... * diff --git a/server/util.c b/server/util.c index 8234e00ba4..a9fc058a1d 100644 --- a/server/util.c +++ b/server/util.c @@ -1845,59 +1845,6 @@ AP_DECLARE(gid_t) ap_gname2id(const char *name) } -/* - * Parses a host of the form
[: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;