diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 36037616123..c7e4d59dc18 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -4314,6 +4314,7 @@ static BOOL HTTP_OpenConnection(http_request_t *lpwhr) appinfo_t *hIC = NULL; char szaddr[INET6_ADDRSTRLEN]; const void *addr; + DWORD res = ERROR_SUCCESS; TRACE("-->\n"); @@ -4353,10 +4354,10 @@ static BOOL HTTP_OpenConnection(http_request_t *lpwhr) szaddr, strlen(szaddr)+1); - if (!NETCON_create(&lpwhr->netConnection, lpwhs->socketAddress.ss_family, - SOCK_STREAM, 0)) + res = NETCON_create(&lpwhr->netConnection, lpwhs->socketAddress.ss_family, SOCK_STREAM, 0); + if (res != ERROR_SUCCESS) { - WARN("Socket creation failed: %u\n", INTERNET_GetLastError()); + WARN("Socket creation failed: %u\n", res); goto lend; } @@ -4392,6 +4393,9 @@ lend: lpwhr->read_pos = lpwhr->read_size = 0; lpwhr->read_chunked = FALSE; + if(res != ERROR_SUCCESS) + INTERNET_SetLastError(res); + TRACE("%d <--\n", bSuccess); return bSuccess; } diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index 75568faf253..adebaf681ee 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -430,7 +430,7 @@ VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext, BOOL NETCON_connected(WININET_NETCONNECTION *connection); BOOL NETCON_init(WININET_NETCONNECTION *connnection, BOOL useSSL); void NETCON_unload(void); -BOOL NETCON_create(WININET_NETCONNECTION *connection, int domain, +DWORD NETCON_create(WININET_NETCONNECTION *connection, int domain, int type, int protocol); BOOL NETCON_close(WININET_NETCONNECTION *connection); BOOL NETCON_connect(WININET_NETCONNECTION *connection, const struct sockaddr *serv_addr, diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c index 16cce406533..7ab33ae8dd6 100644 --- a/dlls/wininet/netconnection.c +++ b/dlls/wininet/netconnection.c @@ -385,21 +385,19 @@ static int sock_get_error( int err ) * NETCON_create * Basically calls 'socket()' */ -BOOL NETCON_create(WININET_NETCONNECTION *connection, int domain, +DWORD NETCON_create(WININET_NETCONNECTION *connection, int domain, int type, int protocol) { #ifdef SONAME_LIBSSL if (connection->useSSL) - return FALSE; + return ERROR_NOT_SUPPORTED; #endif connection->socketFD = socket(domain, type, protocol); if (connection->socketFD == -1) - { - INTERNET_SetLastError(sock_get_error(errno)); - return FALSE; - } - return TRUE; + return sock_get_error(errno); + + return ERROR_SUCCESS; } /******************************************************************************