[389-commits] esc/src/lib/NssHttpClient httpClientNss.cpp,1.3,1.4

Jack Magne jmagne at fedoraproject.org
Tue Jun 23 02:02:05 UTC 2009


Author: jmagne

Update of /cvs/dirsec/esc/src/lib/NssHttpClient
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv2297

Modified Files:
	httpClientNss.cpp 
Log Message:
Bugzilla


Index: httpClientNss.cpp
===================================================================
RCS file: /cvs/dirsec/esc/src/lib/NssHttpClient/httpClientNss.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- httpClientNss.cpp	4 Feb 2009 01:43:47 -0000	1.3
+++ httpClientNss.cpp	23 Jun 2009 02:02:02 -0000	1.4
@@ -64,8 +64,53 @@
 
 PSHttpResponse *HttpClientNss::httpSendChunked(char *host_port, char *uri, char *method, char *body,PSChunkedResponseCallback cb,void *uw,PRBool doSSL,int messageTimeout )
 {
-    
-    PSHttpServer server(host_port, PR_AF_INET);
+    char *pPort = NULL;
+    char *pPortActual = NULL;
+
+    char hostName[512];
+
+    /*
+     * Isolate the host name, account for IPV6 numeric addresses.
+     *
+     */
+
+    if(host_port)
+        strncpy(hostName,host_port,512);
+
+    pPort = hostName;
+    while(1)  {
+        pPort = strchr(pPort, ':');
+        if (pPort) {
+            pPortActual = pPort;
+            pPort++;
+        } else
+            break;
+    }
+
+    if(pPortActual)
+        *pPortActual = '\0';
+
+    /*
+    *  Rifle through the values for the host
+    */
+
+    PRAddrInfo *ai;
+    void *iter;
+    PRNetAddr addr;
+    int family = PR_AF_INET;
+
+    ai = PR_GetAddrInfoByName(hostName, PR_AF_UNSPEC, PR_AI_ADDRCONFIG);
+    if (ai) {
+        printf("%s\n", PR_GetCanonNameFromAddrInfo(ai));
+        iter = NULL;
+        while ((iter = PR_EnumerateAddrInfo(iter, ai, 0, &addr)) != NULL) {
+            family = PR_NetAddrFamily(&addr);
+            break;
+        }
+        PR_FreeAddrInfo(ai);
+    }
+
+    PSHttpServer server(host_port, family);
  
     PSHttpRequest request( &server, uri, HTTP11, 0 );
     _request = &request;




More information about the Fedora-directory-commits mailing list