diff options
| author | mharmsen <mharmsen@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2009-06-21 00:26:45 +0000 |
|---|---|---|
| committer | mharmsen <mharmsen@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2009-06-21 00:26:45 +0000 |
| commit | 27f43ae28b12735d81db2dd67acfc7020fbe4aa6 (patch) | |
| tree | 871ecefd7a5172c6948e6862c6a1bd550ad2bf1b /pki/base/tps/src/httpClient/httpClient.cpp | |
| parent | a4c30b9182afcc3a32f396423c73a5ba86094836 (diff) | |
| download | pki-27f43ae28b12735d81db2dd67acfc7020fbe4aa6.tar.gz pki-27f43ae28b12735d81db2dd67acfc7020fbe4aa6.tar.xz pki-27f43ae28b12735d81db2dd67acfc7020fbe4aa6.zip | |
Bugzilla Bug #476734 - Make TPS httpClient IPv6 enabled.
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@632 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
Diffstat (limited to 'pki/base/tps/src/httpClient/httpClient.cpp')
| -rw-r--r-- | pki/base/tps/src/httpClient/httpClient.cpp | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/pki/base/tps/src/httpClient/httpClient.cpp b/pki/base/tps/src/httpClient/httpClient.cpp index 0e4649e4..7f4e9fff 100644 --- a/pki/base/tps/src/httpClient/httpClient.cpp +++ b/pki/base/tps/src/httpClient/httpClient.cpp @@ -51,7 +51,66 @@ PSHttpResponse *httpSend(char *host_port, char *uri, char *method, char *body) const char* nickname; nickname = RA::GetConfigStore()->GetConfigAsString("ra.clientNickname", ""); - 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) { + char buf[512]; + PR_NetAddrToString(&addr, buf, sizeof buf); + RA::Debug( LL_PER_PDU, + "PSHttpResponse::httpSend: ", + "Sending addr -- Msg='%s'\n", + buf ); + family = PR_NetAddrFamily(&addr); + RA::Debug( LL_PER_PDU, + "PSHttpResponse::httpSend: ", + "Sending family -- Msg='%d'\n", + family ); + break; + } + PR_FreeAddrInfo(ai); + + } + + PSHttpServer server(host_port, family); server.setSSL(PR_TRUE); // use "HTTP10" if no chunking PSHttpRequest request( &server, uri, HTTP11, 0 ); |
