winhttp: Support IPv6 addresses in open_connection.

This commit is contained in:
Juan Lang 2009-07-08 10:40:04 -07:00 committed by Alexandre Julliard
parent 646b9cae80
commit d48eade7fb
1 changed files with 8 additions and 1 deletions

View File

@ -710,11 +710,15 @@ BOOL WINAPI WinHttpQueryHeaders( HINTERNET hrequest, DWORD level, LPCWSTR name,
return ret;
}
#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 46
#endif
static BOOL open_connection( request_t *request )
{
connect_t *connect;
const void *addr;
char address[32];
char address[INET6_ADDRSTRLEN];
WCHAR *addressW;
INTERNET_PORT port;
socklen_t slen;
@ -733,6 +737,9 @@ static BOOL open_connection( request_t *request )
case AF_INET:
addr = &((struct sockaddr_in *)&connect->sockaddr)->sin_addr;
break;
case AF_INET6:
addr = &((struct sockaddr_in6 *)&connect->sockaddr)->sin6_addr;
break;
default:
WARN("unsupported address family %d\n", connect->sockaddr.ss_family);
return FALSE;