wininet: Convert WININETSESSIONW's socketAddress to a struct sockaddr_storage.

This commit is contained in:
Juan Lang 2009-07-09 11:36:00 -07:00 committed by Alexandre Julliard
parent c572e1c99a
commit 058e918da5
2 changed files with 26 additions and 6 deletions

View File

@ -1452,6 +1452,7 @@ static BOOL HTTP_ResolveName(LPWININETHTTPREQW lpwhr)
{
char szaddr[32];
LPWININETHTTPSESSIONW lpwhs = lpwhr->lpHttpSession;
const void *addr;
INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_RESOLVING_NAME,
@ -1466,8 +1467,17 @@ static BOOL HTTP_ResolveName(LPWININETHTTPREQW lpwhr)
return FALSE;
}
inet_ntop(lpwhs->socketAddress.sin_family, &lpwhs->socketAddress.sin_addr,
szaddr, sizeof(szaddr));
switch (lpwhs->socketAddress.ss_family)
{
case AF_INET:
addr = &((struct sockaddr_in *)&lpwhs->socketAddress)->sin_addr;
break;
default:
WARN("unsupported family %d\n", lpwhs->socketAddress.ss_family);
INTERNET_SetLastError(ERROR_INTERNET_NAME_NOT_RESOLVED);
return FALSE;
}
inet_ntop(lpwhs->socketAddress.ss_family, addr, szaddr, sizeof(szaddr));
INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_NAME_RESOLVED,
szaddr, strlen(szaddr)+1);
@ -4108,6 +4118,7 @@ static BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr)
LPWININETHTTPSESSIONW lpwhs;
LPWININETAPPINFOW hIC = NULL;
char szaddr[32];
const void *addr;
TRACE("-->\n");
@ -4128,14 +4139,23 @@ static BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr)
lpwhs = lpwhr->lpHttpSession;
hIC = lpwhs->lpAppInfo;
inet_ntop(lpwhs->socketAddress.sin_family, &lpwhs->socketAddress.sin_addr,
szaddr, sizeof(szaddr));
switch (lpwhs->socketAddress.ss_family)
{
case AF_INET:
addr = &((struct sockaddr_in *)&lpwhs->socketAddress)->sin_addr;
break;
default:
WARN("unsupported family %d\n", lpwhs->socketAddress.ss_family);
INTERNET_SetLastError(ERROR_INTERNET_NAME_NOT_RESOLVED);
return FALSE;
}
inet_ntop(lpwhs->socketAddress.ss_family, addr, szaddr, sizeof(szaddr));
INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
INTERNET_STATUS_CONNECTING_TO_SERVER,
szaddr,
strlen(szaddr)+1);
if (!NETCON_create(&lpwhr->netConnection, lpwhs->socketAddress.sin_family,
if (!NETCON_create(&lpwhr->netConnection, lpwhs->socketAddress.ss_family,
SOCK_STREAM, 0))
{
WARN("Socket creation failed: %u\n", INTERNET_GetLastError());

View File

@ -165,7 +165,7 @@ typedef struct
LPWSTR lpszPassword;
INTERNET_PORT nHostPort; /* the final destination port of the request */
INTERNET_PORT nServerPort; /* the port of the server we directly connect to */
struct sockaddr_in socketAddress;
struct sockaddr_storage socketAddress;
socklen_t sa_len;
} WININETHTTPSESSIONW, *LPWININETHTTPSESSIONW;