]> granicus.if.org Git - apache/commitdiff
API routines ap_pgethostbyname() and ap_pduphostent() are no longer
authorJeff Trawick <trawick@apache.org>
Mon, 18 Dec 2000 17:52:05 +0000 (17:52 +0000)
committerJeff Trawick <trawick@apache.org>
Mon, 18 Dec 2000 17:52:05 +0000 (17:52 +0000)
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.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87399 13f79535-47bb-0310-9956-ffa450edef68

ApacheCore.def
CHANGES
include/util_uri.h
libhttpd.def
modules/proxy/proxy_util.c
server/util_uri.c
support/httpd.exp

index 14962d5e7ecbe5b0ee2d2e1e342f0888b44dfe22..1e1dd317bdb8936ae9bc97d3fdb6d55210b556f7 100644 (file)
@@ -182,11 +182,11 @@ EXPORTS
 
 
 
-       ap_pduphostent
 
 
 
-       ap_pgethostbyname
+
+
 
 
        ap_pregcomp
diff --git a/CHANGES b/CHANGES
index bb5c9d8b8c06db6679efe6e741a12093cb08aae1..457e2cde3311a74801f67c75e36e6d9c010c7000 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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
index fc785fd8e8038058dcd4f4b87fd00b5d02838063..e8784184180a788d905d306d621245e4a19cbc7d 100644 (file)
@@ -157,26 +157,6 @@ AP_DECLARE(apr_port_t) ap_default_port_for_scheme(const char *scheme_str);
  */
 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.
index 14962d5e7ecbe5b0ee2d2e1e342f0888b44dfe22..1e1dd317bdb8936ae9bc97d3fdb6d55210b556f7 100644 (file)
@@ -182,11 +182,11 @@ EXPORTS
 
 
 
-       ap_pduphostent
 
 
 
-       ap_pgethostbyname
+
+
 
 
        ap_pregcomp
index e0b0fce6e547f8559ce367e783b775eb1fd5888e..1cb27a03d365b25e7e3904158c481423fcd92bcd 100644 (file)
@@ -1024,6 +1024,58 @@ static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r)
        && 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 @@ int ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *p)
     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)
index fa4293df59bc387559d52587ad701ed21f9750e0..cf4aa6b22f8faffad6897dcce2c388c22ccb563f 100644 (file)
@@ -112,70 +112,6 @@ AP_DECLARE(apr_port_t) ap_default_port_for_request(const request_rec *r)
        : 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.
  */
index d1b3114336547414c651037e71aa7337f4555ab8..1dd12d881067e3ff3b5e702b0719ad5fea868ce0 100644 (file)
@@ -236,8 +236,6 @@ ap_pbase64decode
 ap_pbase64encode
 ap_pcfg_open_custom
 ap_pcfg_openfile
-ap_pduphostent
-ap_pgethostbyname
 ap_post_config_hook
 ap_pregcomp
 ap_pregfree