Commit 646b9cae authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

winhttp: Convert connect_t's address type from a struct sockaddr_in to a struct sockaddr_storage.

parent 831c87c1
...@@ -713,6 +713,7 @@ BOOL WINAPI WinHttpQueryHeaders( HINTERNET hrequest, DWORD level, LPCWSTR name, ...@@ -713,6 +713,7 @@ BOOL WINAPI WinHttpQueryHeaders( HINTERNET hrequest, DWORD level, LPCWSTR name,
static BOOL open_connection( request_t *request ) static BOOL open_connection( request_t *request )
{ {
connect_t *connect; connect_t *connect;
const void *addr;
char address[32]; char address[32];
WCHAR *addressW; WCHAR *addressW;
INTERNET_PORT port; INTERNET_PORT port;
...@@ -727,16 +728,25 @@ static BOOL open_connection( request_t *request ) ...@@ -727,16 +728,25 @@ static BOOL open_connection( request_t *request )
slen = sizeof(connect->sockaddr); slen = sizeof(connect->sockaddr);
if (!netconn_resolve( connect->servername, port, (struct sockaddr *)&connect->sockaddr, &slen )) return FALSE; if (!netconn_resolve( connect->servername, port, (struct sockaddr *)&connect->sockaddr, &slen )) return FALSE;
inet_ntop( connect->sockaddr.sin_family, &connect->sockaddr.sin_addr, address, sizeof(address) ); switch (connect->sockaddr.ss_family)
{
case AF_INET:
addr = &((struct sockaddr_in *)&connect->sockaddr)->sin_addr;
break;
default:
WARN("unsupported address family %d\n", connect->sockaddr.ss_family);
return FALSE;
}
inet_ntop( connect->sockaddr.ss_family, addr, address, sizeof(address) );
addressW = strdupAW( address ); addressW = strdupAW( address );
send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, addressW, strlenW(addressW) + 1 ); send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, addressW, strlenW(addressW) + 1 );
TRACE("connecting to %s:%u\n", address, ntohs(connect->sockaddr.sin_port)); TRACE("connecting to %s:%u\n", address, port);
send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, addressW, 0 ); send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, addressW, 0 );
if (!netconn_create( &request->netconn, connect->sockaddr.sin_family, SOCK_STREAM, 0 )) if (!netconn_create( &request->netconn, connect->sockaddr.ss_family, SOCK_STREAM, 0 ))
{ {
heap_free( addressW ); heap_free( addressW );
return FALSE; return FALSE;
......
...@@ -110,7 +110,7 @@ typedef struct ...@@ -110,7 +110,7 @@ typedef struct
LPWSTR password; LPWSTR password;
INTERNET_PORT hostport; INTERNET_PORT hostport;
INTERNET_PORT serverport; INTERNET_PORT serverport;
struct sockaddr_in sockaddr; struct sockaddr_storage sockaddr;
} connect_t; } connect_t;
typedef struct typedef struct
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment