Return-Path: Delivered-To: apmail-apache-cvs-archive@apache.org Received: (qmail 92007 invoked by uid 500); 18 Dec 2000 17:52:32 -0000 Mailing-List: contact apache-cvs-help@apache.org; run by ezmlm Precedence: bulk Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list apache-cvs@apache.org Received: (qmail 91525 invoked by uid 500); 18 Dec 2000 17:52:24 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Date: 18 Dec 2000 17:52:12 -0000 Message-ID: <20001218175212.91481.qmail@locus.apache.org> From: trawick@locus.apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/support httpd.exp trawick 00/12/18 09:52:09 Modified: . CHANGES ApacheCore.def modules/proxy proxy_util.c include util_uri.h server util_uri.c support httpd.exp Log: API routines ap_pgethostbyname() and ap_pduphostent() are no longer available. Use apr_getaddrinfo() instead. The ap_pduphostent() code was moved to modules/proxy/proxy_util.c for now since that is the only caller. When the proxy's use of the resolver is APR-ized this won't be needed anymore. Revision Changes Path 1.11 +4 -0 httpd-2.0/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/httpd-2.0/CHANGES,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- CHANGES 2000/12/18 02:30:31 1.10 +++ CHANGES 2000/12/18 17:51:34 1.11 @@ -1,4 +1,8 @@ Changes with Apache 2.0b1 + + *) API routines ap_pgethostbyname() and ap_pduphostent() are no longer + available. Use apr_getaddrinfo() instead. [Jeff Trawick] + *) Get "NameVirtualHost *" working in 2.0. [Ryan Bloom] *) Return HTTP_RANGE_NOT_SATISFIABLE if the every range requested starts 1.45 +2 -2 httpd-2.0/ApacheCore.def Index: ApacheCore.def =================================================================== RCS file: /home/cvs/httpd-2.0/ApacheCore.def,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- ApacheCore.def 2000/12/07 21:37:42 1.44 +++ ApacheCore.def 2000/12/18 17:51:36 1.45 @@ -182,11 +182,11 @@ - ap_pduphostent - ap_pgethostbyname + + ap_pregcomp 1.32 +53 -1 httpd-2.0/modules/proxy/proxy_util.c Index: proxy_util.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_util.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- proxy_util.c 2000/11/20 18:10:19 1.31 +++ proxy_util.c 2000/12/18 17:51:46 1.32 @@ -1024,6 +1024,58 @@ && strncasecmp(&host[h_len - d_len], This->name, d_len) == 0; } +/* Create a copy of a "struct hostent" record; it was presumably returned + * from a call to gethostbyname() and lives in static storage. + * By creating a copy we can tuck it away for later use. + */ +static struct hostent * pduphostent(apr_pool_t *p, const struct hostent *hp) +{ + struct hostent *newent; + char **ptrs; + char **aliases; + struct in_addr *addrs; + int i = 0, j = 0; + + if (hp == NULL) + return NULL; + + /* Count number of alias entries */ + if (hp->h_aliases != NULL) + for (; hp->h_aliases[j] != NULL; ++j) + continue; + + /* Count number of in_addr entries */ + if (hp->h_addr_list != NULL) + for (; hp->h_addr_list[i] != NULL; ++i) + continue; + + /* Allocate hostent structure, alias ptrs, addr ptrs, addrs */ + newent = (struct hostent *) apr_palloc(p, sizeof(*hp)); + aliases = (char **) apr_palloc(p, (j+1) * sizeof(char*)); + ptrs = (char **) apr_palloc(p, (i+1) * sizeof(char*)); + addrs = (struct in_addr *) apr_palloc(p, (i+1) * sizeof(struct in_addr)); + + *newent = *hp; + newent->h_name = apr_pstrdup(p, hp->h_name); + newent->h_aliases = aliases; + newent->h_addr_list = (char**) ptrs; + + /* Copy Alias Names: */ + for (j = 0; hp->h_aliases[j] != NULL; ++j) { + aliases[j] = apr_pstrdup(p, hp->h_aliases[j]); + } + aliases[j] = NULL; + + /* Copy address entries */ + for (i = 0; hp->h_addr_list[i] != NULL; ++i) { + ptrs[i] = (char*) &addrs[i]; + addrs[i] = *(struct in_addr *) hp->h_addr_list[i]; + } + ptrs[i] = NULL; + + return newent; +} + /* Return TRUE if addr represents a host name */ int ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *p) { @@ -1049,7 +1101,7 @@ if (addr[i] != '\0' || ap_proxy_host2addr(addr, &host) != NULL) return 0; - This->hostentry = ap_pduphostent (p, &host); + This->hostentry = pduphostent (p, &host); /* Strip trailing dots */ for (i = strlen(addr) - 1; i > 0 && addr[i] == '.'; --i) 1.13 +0 -20 httpd-2.0/include/util_uri.h Index: util_uri.h =================================================================== RCS file: /home/cvs/httpd-2.0/include/util_uri.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- util_uri.h 2000/11/08 11:35:38 1.12 +++ util_uri.h 2000/12/18 17:51:53 1.13 @@ -158,26 +158,6 @@ AP_DECLARE(apr_port_t) ap_default_port_for_request(const request_rec *r); /** - * Create a copy of a "struct hostent" record; it was presumably returned - * from a call to gethostbyname() and lives in static storage. - * By creating a copy we can tuck it away for later use. - * @param p Pool to allocate out of - * @param hp hostent to duplicate - * @deffunc struct hostent * ap_pduphostent(apr_pool_t *p, const struct hostent *hp) - */ -AP_DECLARE(struct hostent *) ap_pduphostent(apr_pool_t *p, const struct hostent *hp); - -/** - * resolve hostname, if successful return an ALLOCATED COPY OF the hostent - * structure, intended to be stored and used later. - * @param p The pool to allocate out of - * @param hostname The hostname to resolve - * @return The allocated hostent structure - * @deffunc struct hostent * ap_pgethostbyname(apr_pool_t *p, const char *hostname) - */ -AP_DECLARE(struct hostent *) ap_pgethostbyname(apr_pool_t *p, const char *hostname); - -/** * Unparse a uri_components structure to an URI string. Optionally suppress * the password for security reasons. * @param p The pool to allocate out of 1.21 +0 -64 httpd-2.0/server/util_uri.c Index: util_uri.c =================================================================== RCS file: /home/cvs/httpd-2.0/server/util_uri.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- util_uri.c 2000/11/08 11:35:15 1.20 +++ util_uri.c 2000/12/18 17:51:59 1.21 @@ -112,70 +112,6 @@ : 0; } -/* Create a copy of a "struct hostent" record; it was presumably returned - * from a call to gethostbyname() and lives in static storage. - * By creating a copy we can tuck it away for later use. - */ -AP_DECLARE(struct hostent *) ap_pduphostent(apr_pool_t *p, const struct hostent *hp) -{ - struct hostent *newent; - char **ptrs; - char **aliases; - struct in_addr *addrs; - int i = 0, j = 0; - - if (hp == NULL) - return NULL; - - /* Count number of alias entries */ - if (hp->h_aliases != NULL) - for (; hp->h_aliases[j] != NULL; ++j) - continue; - - /* Count number of in_addr entries */ - if (hp->h_addr_list != NULL) - for (; hp->h_addr_list[i] != NULL; ++i) - continue; - - /* Allocate hostent structure, alias ptrs, addr ptrs, addrs */ - newent = (struct hostent *) apr_palloc(p, sizeof(*hp)); - aliases = (char **) apr_palloc(p, (j+1) * sizeof(char*)); - ptrs = (char **) apr_palloc(p, (i+1) * sizeof(char*)); - addrs = (struct in_addr *) apr_palloc(p, (i+1) * sizeof(struct in_addr)); - - *newent = *hp; - newent->h_name = apr_pstrdup(p, hp->h_name); - newent->h_aliases = aliases; - newent->h_addr_list = (char**) ptrs; - - /* Copy Alias Names: */ - for (j = 0; hp->h_aliases[j] != NULL; ++j) { - aliases[j] = apr_pstrdup(p, hp->h_aliases[j]); - } - aliases[j] = NULL; - - /* Copy address entries */ - for (i = 0; hp->h_addr_list[i] != NULL; ++i) { - ptrs[i] = (char*) &addrs[i]; - addrs[i] = *(struct in_addr *) hp->h_addr_list[i]; - } - ptrs[i] = NULL; - - return newent; -} - - -/* pgethostbyname(): resolve hostname, if successful return an ALLOCATED - * COPY OF the hostent structure, intended to be stored and used later. - * (gethostbyname() uses static storage that would be overwritten on each call) - */ -AP_DECLARE(struct hostent *) ap_pgethostbyname(apr_pool_t *p, const char *hostname) -{ - struct hostent *hp = gethostbyname(hostname); - return (hp == NULL) ? NULL : ap_pduphostent(p, hp); -} - - /* Unparse a uri_components structure to an URI string. * Optionally suppress the password for security reasons. */ 1.23 +0 -2 httpd-2.0/support/httpd.exp Index: httpd.exp =================================================================== RCS file: /home/cvs/httpd-2.0/support/httpd.exp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- httpd.exp 2000/12/18 17:01:11 1.22 +++ httpd.exp 2000/12/18 17:52:05 1.23 @@ -236,8 +236,6 @@ ap_pbase64encode ap_pcfg_open_custom ap_pcfg_openfile -ap_pduphostent -ap_pgethostbyname ap_post_config_hook ap_pregcomp ap_pregfree