Commit ca56f992 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Use winsock sockets.

parent 79bc939b
MODULE = winhttp.dll MODULE = winhttp.dll
IMPORTLIB = winhttp IMPORTLIB = winhttp
IMPORTS = uuid jsproxy user32 advapi32 IMPORTS = uuid jsproxy user32 advapi32 ws2_32
DELAYIMPORTS = oleaut32 ole32 crypt32 secur32 DELAYIMPORTS = oleaut32 ole32 crypt32 secur32
EXTRALIBS = $(CORESERVICES_LIBS) $(SOCKET_LIBS) EXTRALIBS = $(CORESERVICES_LIBS)
C_SRCS = \ C_SRCS = \
cookie.c \ cookie.c \
......
...@@ -17,15 +17,15 @@ ...@@ -17,15 +17,15 @@
*/ */
#include "config.h" #include "config.h"
#include "ws2tcpip.h"
#include <stdarg.h> #include <stdarg.h>
#include "wine/debug.h"
#include "wine/list.h"
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winhttp.h" #include "winhttp.h"
#include "wine/debug.h"
#include "wine/list.h"
#include "winhttp_private.h" #include "winhttp_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(winhttp); WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
......
...@@ -19,15 +19,14 @@ ...@@ -19,15 +19,14 @@
*/ */
#include "config.h" #include "config.h"
#include "wine/port.h" #include "ws2tcpip.h"
#include "wine/debug.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winhttp.h" #include "winhttp.h"
#include "wine/debug.h"
#include "winhttp_private.h" #include "winhttp_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(winhttp); WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#define COBJMACROS #define COBJMACROS
#include "config.h" #include "config.h"
#include "ws2tcpip.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
......
...@@ -21,13 +21,9 @@ ...@@ -21,13 +21,9 @@
#define COBJMACROS #define COBJMACROS
#include "config.h" #include "config.h"
#include "wine/port.h" #include "ws2tcpip.h"
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
...@@ -38,9 +34,8 @@ ...@@ -38,9 +34,8 @@
#include "schannel.h" #include "schannel.h"
#include "winhttp.h" #include "winhttp.h"
#include "winhttp_private.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "winhttp_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(winhttp); WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
...@@ -1481,10 +1476,6 @@ static BOOL secure_proxy_connect( request_t *request ) ...@@ -1481,10 +1476,6 @@ static BOOL secure_proxy_connect( request_t *request )
return ret; return ret;
} }
#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 46
#endif
static WCHAR *addr_to_str( struct sockaddr_storage *addr ) static WCHAR *addr_to_str( struct sockaddr_storage *addr )
{ {
char buf[INET6_ADDRSTRLEN]; char buf[INET6_ADDRSTRLEN];
......
...@@ -17,9 +17,7 @@ ...@@ -17,9 +17,7 @@
*/ */
#include "config.h" #include "config.h"
#include "wine/port.h" #include "ws2tcpip.h"
#include "wine/debug.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -34,9 +32,6 @@ ...@@ -34,9 +32,6 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#ifndef __MINGW32__
#define USE_WS_PREFIX
#endif
#include "winsock2.h" #include "winsock2.h"
#include "ws2ipdef.h" #include "ws2ipdef.h"
#include "winhttp.h" #include "winhttp.h"
...@@ -46,6 +41,7 @@ ...@@ -46,6 +41,7 @@
#include "dispex.h" #include "dispex.h"
#include "activscp.h" #include "activscp.h"
#include "wine/debug.h"
#include "winhttp_private.h" #include "winhttp_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(winhttp); WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
...@@ -649,46 +645,8 @@ static WCHAR *blob_to_str( DWORD encoding, CERT_NAME_BLOB *blob ) ...@@ -649,46 +645,8 @@ static WCHAR *blob_to_str( DWORD encoding, CERT_NAME_BLOB *blob )
return ret; return ret;
} }
static BOOL convert_sockaddr( const struct sockaddr *addr, SOCKADDR_STORAGE *addr_storage ) static BOOL copy_sockaddr( const struct sockaddr *addr, SOCKADDR_STORAGE *addr_storage )
{ {
#ifndef __MINGW32__
switch (addr->sa_family)
{
case AF_INET:
{
const struct sockaddr_in *addr_unix = (const struct sockaddr_in *)addr;
struct WS_sockaddr_in *addr_win = (struct WS_sockaddr_in *)addr_storage;
char *p;
addr_win->sin_family = WS_AF_INET;
addr_win->sin_port = addr_unix->sin_port;
memcpy( &addr_win->sin_addr, &addr_unix->sin_addr, 4 );
p = (char *)&addr_win->sin_addr + 4;
memset( p, 0, sizeof(*addr_storage) - (p - (char *)addr_win) );
return TRUE;
}
case AF_INET6:
{
const struct sockaddr_in6 *addr_unix = (const struct sockaddr_in6 *)addr;
struct WS_sockaddr_in6 *addr_win = (struct WS_sockaddr_in6 *)addr_storage;
addr_win->sin6_family = WS_AF_INET6;
addr_win->sin6_port = addr_unix->sin6_port;
addr_win->sin6_flowinfo = addr_unix->sin6_flowinfo;
memcpy( &addr_win->sin6_addr, &addr_unix->sin6_addr, 16 );
#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
addr_win->sin6_scope_id = addr_unix->sin6_scope_id;
#else
addr_win->sin6_scope_id = 0;
#endif
memset( addr_win + 1, 0, sizeof(*addr_storage) - sizeof(*addr_win) );
return TRUE;
}
default:
ERR("unhandled family %u\n", addr->sa_family);
return FALSE;
}
#else
switch (addr->sa_family) switch (addr->sa_family)
{ {
case AF_INET: case AF_INET:
...@@ -711,7 +669,6 @@ static BOOL convert_sockaddr( const struct sockaddr *addr, SOCKADDR_STORAGE *add ...@@ -711,7 +669,6 @@ static BOOL convert_sockaddr( const struct sockaddr *addr, SOCKADDR_STORAGE *add
ERR("unhandled family %u\n", addr->sa_family); ERR("unhandled family %u\n", addr->sa_family);
return FALSE; return FALSE;
} }
#endif
} }
static BOOL request_query_option( object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen ) static BOOL request_query_option( object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen )
...@@ -829,8 +786,8 @@ static BOOL request_query_option( object_header_t *hdr, DWORD option, LPVOID buf ...@@ -829,8 +786,8 @@ static BOOL request_query_option( object_header_t *hdr, DWORD option, LPVOID buf
return FALSE; return FALSE;
} }
if (getsockname( request->netconn->socket, &local, &len )) return FALSE; if (getsockname( request->netconn->socket, &local, &len )) return FALSE;
if (!convert_sockaddr( &local, &info->LocalAddress )) return FALSE; if (!copy_sockaddr( &local, &info->LocalAddress )) return FALSE;
if (!convert_sockaddr( remote, &info->RemoteAddress )) return FALSE; if (!copy_sockaddr( remote, &info->RemoteAddress )) return FALSE;
info->cbSize = sizeof(*info); info->cbSize = sizeof(*info);
return TRUE; return TRUE;
} }
...@@ -1338,11 +1295,7 @@ static BOOL is_domain_suffix( const char *domain, const char *suffix ) ...@@ -1338,11 +1295,7 @@ static BOOL is_domain_suffix( const char *domain, const char *suffix )
static int reverse_lookup( const struct addrinfo *ai, char *hostname, size_t len ) static int reverse_lookup( const struct addrinfo *ai, char *hostname, size_t len )
{ {
int ret = -1; return getnameinfo( ai->ai_addr, ai->ai_addrlen, hostname, len, NULL, 0, 0 );
#ifdef HAVE_GETNAMEINFO
ret = getnameinfo( ai->ai_addr, ai->ai_addrlen, hostname, len, NULL, 0, 0 );
#endif
return ret;
} }
static WCHAR *build_wpad_url( const char *hostname, const struct addrinfo *ai ) static WCHAR *build_wpad_url( const char *hostname, const struct addrinfo *ai )
...@@ -1434,7 +1387,6 @@ BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url ) ...@@ -1434,7 +1387,6 @@ BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url )
} }
if (flags & WINHTTP_AUTO_DETECT_TYPE_DNS_A) if (flags & WINHTTP_AUTO_DETECT_TYPE_DNS_A)
{ {
#ifdef HAVE_GETADDRINFO
char *fqdn, *domain, *p; char *fqdn, *domain, *p;
if (!(fqdn = get_computer_name( ComputerNamePhysicalDnsFullyQualified ))) return FALSE; if (!(fqdn = get_computer_name( ComputerNamePhysicalDnsFullyQualified ))) return FALSE;
...@@ -1476,9 +1428,6 @@ BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url ) ...@@ -1476,9 +1428,6 @@ BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url )
} }
heap_free( domain ); heap_free( domain );
heap_free( fqdn ); heap_free( fqdn );
#else
FIXME("getaddrinfo not found at build time\n");
#endif
} }
if (!ret) if (!ret)
{ {
......
...@@ -17,16 +17,16 @@ ...@@ -17,16 +17,16 @@
*/ */
#include "config.h" #include "config.h"
#include "ws2tcpip.h"
#include <stdarg.h> #include <stdarg.h>
#include "wine/debug.h"
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winreg.h" #include "winreg.h"
#include "winhttp.h" #include "winhttp.h"
#include "shlwapi.h" #include "shlwapi.h"
#include "wine/debug.h"
#include "winhttp_private.h" #include "winhttp_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(winhttp); WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
......
...@@ -27,23 +27,6 @@ ...@@ -27,23 +27,6 @@
#include "wine/list.h" #include "wine/list.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#if defined(__MINGW32__) || defined (_MSC_VER)
# include <ws2tcpip.h>
#else
# define closesocket close
# define ioctlsocket ioctl
#endif
#include "ole2.h" #include "ole2.h"
#include "sspi.h" #include "sspi.h"
#include "wincrypt.h" #include "wincrypt.h"
...@@ -301,7 +284,7 @@ DWORD get_last_error( void ) DECLSPEC_HIDDEN; ...@@ -301,7 +284,7 @@ DWORD get_last_error( void ) DECLSPEC_HIDDEN;
void send_callback( object_header_t *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN; void send_callback( object_header_t *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN;
void close_connection( request_t * ) DECLSPEC_HIDDEN; void close_connection( request_t * ) DECLSPEC_HIDDEN;
BOOL netconn_close( netconn_t * ) DECLSPEC_HIDDEN; void netconn_close( netconn_t * ) DECLSPEC_HIDDEN;
netconn_t *netconn_create( hostdata_t *, const struct sockaddr_storage *, int ) DECLSPEC_HIDDEN; netconn_t *netconn_create( hostdata_t *, const struct sockaddr_storage *, int ) DECLSPEC_HIDDEN;
void netconn_unload( void ) DECLSPEC_HIDDEN; void netconn_unload( void ) DECLSPEC_HIDDEN;
ULONG netconn_query_data_available( netconn_t * ) DECLSPEC_HIDDEN; ULONG netconn_query_data_available( netconn_t * ) DECLSPEC_HIDDEN;
......
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