Synchronize with trunk's revision r57652.
[reactos.git] / dll / win32 / winhttp / winhttp_ros.diff
1 --- wine-1.5.4/dlls/winhttp/net.c 2012-06-20 14:30:41 +0200
2 +++ dll/win32/winhttp/net.c 2012-06-21 18:00:53 +0200
3 @@ -160,6 +160,7 @@ static void ssl_lock_callback(int mode,
4 #endif
5
6 /* translate a unix error code into a winsock error code */
7 +#ifndef __REACTOS__
8 static int sock_get_error( int err )
9 {
10 #if !defined(__MINGW32__) && !defined (_MSC_VER)
11 @@ -225,6 +226,15 @@ static int sock_get_error( int err )
12 #endif
13 return err;
14 }
15 +#else
16 +#define sock_get_error(x) WSAGetLastError()
17 +
18 +static inline int unix_ioctl(int filedes, long request, void *arg)
19 +{
20 + return ioctlsocket(filedes, request, arg);
21 +}
22 +#define ioctlsocket unix_ioctl
23 +#endif
24
25 #ifdef SONAME_LIBSSL
26 static PCCERT_CONTEXT X509_to_cert_context(X509 *cert)
27 @@ -648,11 +658,17 @@ BOOL netconn_connect( netconn_t *conn, c
28 res = sock_get_error( errno );
29 if (res == WSAEWOULDBLOCK || res == WSAEINPROGRESS)
30 {
31 - struct pollfd pfd;
32 + // ReactOS: use select instead of poll
33 + fd_set outfd;
34 + struct timeval tv;
35
36 - pfd.fd = conn->socket;
37 - pfd.events = POLLOUT;
38 - if (poll( &pfd, 1, timeout ) > 0)
39 + FD_ZERO(&outfd);
40 + FD_SET(conn->socket, &outfd);
41 +
42 + tv.tv_sec = 0;
43 + tv.tv_usec = timeout * 1000;
44 +
45 + if (select( 0, NULL, &outfd, NULL, &tv ) > 0)
46 ret = TRUE;
47 else
48 res = sock_get_error( errno );
49 @@ -848,7 +864,8 @@ BOOL netconn_query_data_available( netco
50
51 BOOL netconn_get_next_line( netconn_t *conn, char *buffer, DWORD *buflen )
52 {
53 - struct pollfd pfd;
54 + // ReactOS: use select instead of poll
55 + fd_set infd;
56 BOOL ret = FALSE;
57 DWORD recvd = 0;
58
59 @@ -884,19 +901,21 @@ BOOL netconn_get_next_line( netconn_t *c
60 #endif
61 }
62
63 - pfd.fd = conn->socket;
64 - pfd.events = POLLIN;
65 + FD_ZERO(&infd);
66 + FD_SET(conn->socket, &infd);
67 +
68 while (recvd < *buflen)
69 {
70 - int timeout, res;
71 - struct timeval tv;
72 + int res;
73 + struct timeval tv, *ptv;
74 socklen_t len = sizeof(tv);
75
76 if ((res = getsockopt( conn->socket, SOL_SOCKET, SO_RCVTIMEO, (void*)&tv, &len ) != -1))
77 - timeout = tv.tv_sec * 1000 + tv.tv_usec / 1000;
78 + ptv = &tv;
79 else
80 - timeout = -1;
81 - if (poll( &pfd, 1, timeout ) > 0)
82 + ptv = NULL;
83 +
84 + if (select( 0, &infd, NULL, NULL, ptv ) > 0)
85 {
86 if ((res = recv( conn->socket, &buffer[recvd], 1, 0 )) <= 0)
87 {
88 --- wine-1.5.4/dlls/winhttp/request.c 2012-06-20 14:30:41 +0200
89 +++ dll/win32/winhttp/request.c 2012-06-21 17:32:47 +0200
90 @@ -38,6 +38,8 @@
91
92 #include "winhttp_private.h"
93
94 +#include "inet_ntop.c"
95 +
96 WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
97
98 static const WCHAR attr_accept[] = {'A','c','c','e','p','t',0};
99 --- wine-1.5.4/dlls/winhttp/rsrc.rc 2012-06-20 14:30:41 +0200
100 +++ dll/win32/winhttp/rsrc.rc 2012-07-14 15:25:28 +0200
101 @@ -16,6 +16,12 @@
102 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
103 */
104
105 +/* @makedep: winhttp_tlb.tlb */
106 +1 TYPELIB winhttp_tlb.tlb
107 +
108 +/* @makedep: winhttp_tlb.rgs */
109 +1 WINE_REGISTRY winhttp_tlb.rgs
110 +
111 /* @makedep: pac.js */
112 pac.js 40 "pac.js"
113
114 --- wine-1.5.4/dlls/winhttp/session.c 2012-07-13 15:34:57 +0200
115 +++ dll/win32/winhttp/session.c 2012-06-23 17:51:47 +0200
116 @@ -95,6 +95,9 @@ static void session_destroy( object_head
117 heap_free( session->proxy_username );
118 heap_free( session->proxy_password );
119 heap_free( session );
120 +#ifdef __REACTOS__
121 + WSACleanup();
122 +#endif
123 }
124
125 static BOOL session_query_option( object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen )
126 @@ -203,6 +206,11 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR ag
127 {
128 session_t *session;
129 HINTERNET handle = NULL;
130 +#ifdef __REACTOS__
131 + WSADATA wsaData;
132 + int error = WSAStartup(MAKEWORD(2, 2), &wsaData);
133 + if (error) ERR("WSAStartup failed: %d\n", error);
134 +#endif
135
136 TRACE("%s, %u, %s, %s, 0x%08x\n", debugstr_w(agent), access, debugstr_w(proxy), debugstr_w(bypass), flags);
137