[WINHTTP] Sync with Wine Staging 3.3. CORE-14434
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 24 Mar 2018 12:15:44 +0000 (13:15 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 24 Mar 2018 12:15:44 +0000 (13:15 +0100)
dll/win32/winhttp/CMakeLists.txt
dll/win32/winhttp/cookie.c
dll/win32/winhttp/handle.c
dll/win32/winhttp/main.c
dll/win32/winhttp/net.c
dll/win32/winhttp/precomp.h [new file with mode: 0644]
dll/win32/winhttp/request.c
dll/win32/winhttp/session.c
dll/win32/winhttp/url.c
dll/win32/winhttp/winhttp_private.h
media/doc/README.WINE

index 9245cfa..988c769 100644 (file)
@@ -17,7 +17,7 @@ list(APPEND SOURCE
     request.c
     session.c
     url.c
     request.c
     session.c
     url.c
-    winhttp_private.h)
+    precomp.h)
 
 set_source_files_properties(rsrc.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/winhttp_tlb.tlb)
 add_typelib(winhttp_tlb.idl)
 
 set_source_files_properties(rsrc.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/winhttp_tlb.tlb)
 add_typelib(winhttp_tlb.idl)
@@ -32,5 +32,5 @@ target_link_libraries(winhttp uuid wine)
 add_delay_importlibs(winhttp oleaut32 ole32 crypt32 secur32)
 add_importlibs(winhttp user32 advapi32 ws2_32 jsproxy kernel32_vista msvcrt kernel32 ntdll)
 add_dependencies(winhttp stdole2)
 add_delay_importlibs(winhttp oleaut32 ole32 crypt32 secur32)
 add_importlibs(winhttp user32 advapi32 ws2_32 jsproxy kernel32_vista msvcrt kernel32 ntdll)
 add_dependencies(winhttp stdole2)
-add_pch(winhttp winhttp_private.h SOURCE)
+add_pch(winhttp precomp.h SOURCE)
 add_cd_file(TARGET winhttp DESTINATION reactos/system32 FOR all)
 add_cd_file(TARGET winhttp DESTINATION reactos/system32 FOR all)
index 2d2dbf3..b4b2530 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include <stdarg.h>
+
+#include "wine/debug.h"
+#include "wine/list.h"
+
+#include "windef.h"
+#include "winbase.h"
+#include "winhttp.h"
+
 #include "winhttp_private.h"
 
 #include "winhttp_private.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
+
 static domain_t *add_domain( session_t *session, WCHAR *name )
 {
     domain_t *domain;
 static domain_t *add_domain( session_t *session, WCHAR *name )
 {
     domain_t *domain;
index e67e5e3..6026a49 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+#include "wine/debug.h"
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winhttp.h"
+
 #include "winhttp_private.h"
 
 #include "winhttp_private.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
+
 #define HANDLE_CHUNK_SIZE 0x10
 
 static CRITICAL_SECTION handle_cs;
 #define HANDLE_CHUNK_SIZE 0x10
 
 static CRITICAL_SECTION handle_cs;
index 55c601e..a63f28c 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#define COBJMACROS
+#include "config.h"
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "objbase.h"
+#include "rpcproxy.h"
+#include "httprequest.h"
+#include "winhttp.h"
+
+#include "wine/debug.h"
 #include "winhttp_private.h"
 
 #include "winhttp_private.h"
 
-#include <rpcproxy.h>
-#include <httprequest.h>
-
 HINSTANCE winhttp_instance;
 
 HINSTANCE winhttp_instance;
 
+WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
+
 /******************************************************************
  *              DllMain (winhttp.@)
  */
 /******************************************************************
  *              DllMain (winhttp.@)
  */
index bf78b22..e9ff86a 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "winhttp_private.h"
+#include "config.h"
+#include "wine/port.h"
 
 
+#include <stdarg.h>
+#include <stdio.h>
+#include <errno.h>
 #include <assert.h>
 #include <assert.h>
-#include <schannel.h>
 
 
+#include <sys/types.h>
 #ifdef HAVE_SYS_SOCKET_H
 # include <sys/socket.h>
 #endif
 #ifdef HAVE_SYS_SOCKET_H
 # include <sys/socket.h>
 #endif
 # include <poll.h>
 #endif
 
 # include <poll.h>
 #endif
 
+#define NONAMELESSUNION
+
+#include "wine/debug.h"
+#include "wine/library.h"
+
+#include "windef.h"
+#include "winbase.h"
+#include "winhttp.h"
+#include "wincrypt.h"
+#include "schannel.h"
+
+#include "winhttp_private.h"
+
+/* to avoid conflicts with the Unix socket headers */
+#define USE_WS_PREFIX
+#include "winsock2.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
+
 #ifndef HAVE_GETADDRINFO
 
 /* critical section to protect non-reentrant gethostbyname() */
 #ifndef HAVE_GETADDRINFO
 
 /* critical section to protect non-reentrant gethostbyname() */
diff --git a/dll/win32/winhttp/precomp.h b/dll/win32/winhttp/precomp.h
new file mode 100644 (file)
index 0000000..53f0b13
--- /dev/null
@@ -0,0 +1,26 @@
+
+#ifndef _WINHTTP_PRECOMP_H_
+#define _WINHTTP_PRECOMP_H_
+
+#include <wine/config.h>
+
+#include <stdarg.h>
+
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
+#define COBJMACROS
+#define NONAMELESSUNION
+
+#include <windef.h>
+#include <winbase.h>
+#include <ole2.h>
+#include <winsock2.h>
+#include <winhttp.h>
+
+#include <wine/debug.h>
+
+#include "winhttp_private.h"
+
+#endif /* !_WINHTTP_PRECOMP_H_ */
index f3098e3..5bb5b09 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "winhttp_private.h"
+#define COBJMACROS
+#include "config.h"
+#include "wine/port.h"
 
 
+#include <stdarg.h>
+#include <assert.h>
 #ifdef HAVE_ARPA_INET_H
 # include <arpa/inet.h>
 #endif
 
 #ifdef HAVE_ARPA_INET_H
 # include <arpa/inet.h>
 #endif
 
-#include <assert.h>
-#include <winuser.h>
-#include <httprequest.h>
-#include <httprequestid.h>
-#include <schannel.h>
+#include "windef.h"
+#include "winbase.h"
+#include "ole2.h"
+#include "initguid.h"
+#include "httprequest.h"
+#include "httprequestid.h"
+#include "schannel.h"
+#include "winhttp.h"
+
+#include "winhttp_private.h"
+
+#include "wine/debug.h"
 
 
+WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
+
+#ifdef __REACTOS__
 #include "inet_ntop.c"
 #include "inet_ntop.c"
+#endif
 
 #define DEFAULT_KEEP_ALIVE_TIMEOUT 30000
 
 
 #define DEFAULT_KEEP_ALIVE_TIMEOUT 30000
 
@@ -391,7 +406,7 @@ static BOOL delete_header( request_t *request, DWORD index )
     return TRUE;
 }
 
     return TRUE;
 }
 
-static BOOL process_header( request_t *request, LPCWSTR field, LPCWSTR value, DWORD flags, BOOL request_only )
+BOOL process_header( request_t *request, LPCWSTR field, LPCWSTR value, DWORD flags, BOOL request_only )
 {
     int index;
     header_t hdr;
 {
     int index;
     header_t hdr;
@@ -2060,16 +2075,11 @@ static BOOL send_request( request_t *request, LPCWSTR headers, DWORD headers_len
     WCHAR *req = NULL;
     char *req_ascii;
     int bytes_sent;
     WCHAR *req = NULL;
     char *req_ascii;
     int bytes_sent;
-    DWORD len, i, flags;
+    DWORD len;
 
     clear_response_headers( request );
     drain_content( request );
 
 
     clear_response_headers( request );
     drain_content( request );
 
-    flags = WINHTTP_ADDREQ_FLAG_ADD|WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA;
-    for (i = 0; i < request->num_accept_types; i++)
-    {
-        process_header( request, attr_accept, request->accept_types[i], flags, TRUE );
-    }
     if (session->agent)
         process_header( request, attr_user_agent, session->agent, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW, TRUE );
 
     if (session->agent)
         process_header( request, attr_user_agent, session->agent, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW, TRUE );
 
index 7ab10a6..cef533f 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include "wine/port.h"
+#include "wine/debug.h"
+
+#include <stdarg.h>
+#include <stdlib.h>
+
+#ifdef HAVE_CORESERVICES_CORESERVICES_H
+#define GetCurrentThread MacGetCurrentThread
+#define LoadResource MacLoadResource
+#include <CoreServices/CoreServices.h>
+#undef GetCurrentThread
+#undef LoadResource
+#undef DPRINTF
+#endif
+
+#include "windef.h"
+#include "winbase.h"
+#ifndef __MINGW32__
+#define USE_WS_PREFIX
+#endif
+#include "winsock2.h"
+#include "ws2ipdef.h"
+#include "winhttp.h"
+#include "wincrypt.h"
+#include "winreg.h"
+#define COBJMACROS
+#include "ole2.h"
+#include "dispex.h"
+#include "activscp.h"
+
 #include "winhttp_private.h"
 
 #include "winhttp_private.h"
 
-#include <wincrypt.h>
-#include <winreg.h>
-#include <dispex.h>
-#include <activscp.h>
+WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
 
 #define DEFAULT_RESOLVE_TIMEOUT     0
 #define DEFAULT_CONNECT_TIMEOUT     20000
 
 #define DEFAULT_RESOLVE_TIMEOUT     0
 #define DEFAULT_CONNECT_TIMEOUT     20000
@@ -589,8 +617,6 @@ static void request_destroy( object_header_t *hdr )
         heap_free( request->headers[i].value );
     }
     heap_free( request->headers );
         heap_free( request->headers[i].value );
     }
     heap_free( request->headers );
-    for (i = 0; i < request->num_accept_types; i++) heap_free( request->accept_types[i] );
-    heap_free( request->accept_types );
     for (i = 0; i < TARGET_MAX; i++)
     {
         for (j = 0; j < SCHEME_MAX; j++)
     for (i = 0; i < TARGET_MAX; i++)
     {
         for (j = 0; j < SCHEME_MAX; j++)
@@ -1016,32 +1042,14 @@ static const object_vtbl_t request_vtbl =
 
 static BOOL store_accept_types( request_t *request, const WCHAR **accept_types )
 {
 
 static BOOL store_accept_types( request_t *request, const WCHAR **accept_types )
 {
+    static const WCHAR attr_accept[] = {'A','c','c','e','p','t',0};
+    static const DWORD flags = WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA;
     const WCHAR **types = accept_types;
     const WCHAR **types = accept_types;
-    DWORD i;
 
     if (!types) return TRUE;
     while (*types)
     {
 
     if (!types) return TRUE;
     while (*types)
     {
-        request->num_accept_types++;
-        types++;
-    }
-    if (!request->num_accept_types) return TRUE;
-    if (!(request->accept_types = heap_alloc( request->num_accept_types * sizeof(WCHAR *))))
-    {
-        request->num_accept_types = 0;
-        return FALSE;
-    }
-    types = accept_types;
-    for (i = 0; i < request->num_accept_types; i++)
-    {
-        if (!(request->accept_types[i] = strdupW( *types )))
-        {
-            for ( ; i > 0; --i) heap_free( request->accept_types[i - 1] );
-            heap_free( request->accept_types );
-            request->accept_types = NULL;
-            request->num_accept_types = 0;
-            return FALSE;
-        }
+        process_header( request, attr_accept, *types, flags, TRUE );
         types++;
     }
     return TRUE;
         types++;
     }
     return TRUE;
index e21dbfc..32b30da 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "config.h"
+#include <stdarg.h>
+
+#include "wine/debug.h"
+
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
+#include "winhttp.h"
+#include "shlwapi.h"
+
 #include "winhttp_private.h"
 
 #include "winhttp_private.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
+
 static const WCHAR scheme_http[] = {'h','t','t','p',0};
 static const WCHAR scheme_https[] = {'h','t','t','p','s',0};
 
 static const WCHAR scheme_http[] = {'h','t','t','p',0};
 static const WCHAR scheme_https[] = {'h','t','t','p','s',0};
 
index 1e6d16a..d5ec9ca 100644 (file)
 #ifndef _WINE_WINHTTP_PRIVATE_H_
 #define _WINE_WINHTTP_PRIVATE_H_
 
 #ifndef _WINE_WINHTTP_PRIVATE_H_
 #define _WINE_WINHTTP_PRIVATE_H_
 
-#include <wine/config.h>
-
-#include <stdarg.h>
-
-#define WIN32_NO_STATUS
-#define _INC_WINDOWS
-#define COM_NO_WINDOWS_H
-
-#define COBJMACROS
-#define NONAMELESSUNION
-
-#include <windef.h>
-#include <winbase.h>
-#include <objbase.h>
-#include <oleauto.h>
-#include <winsock2.h>
-#include <winhttp.h>
+#ifndef __WINE_CONFIG_H
+# error You must include config.h to use this header
+#endif
 
 
-#include <wine/list.h>
-#include <wine/unicode.h>
+#include "wine/heap.h"
+#include "wine/list.h"
+#include "wine/unicode.h"
 
 
+#include <sys/types.h>
 #ifdef HAVE_SYS_SOCKET_H
 # include <sys/socket.h>
 #endif
 #ifdef HAVE_SYS_SOCKET_H
 # include <sys/socket.h>
 #endif
 # define ioctlsocket ioctl
 #endif
 
 # define ioctlsocket ioctl
 #endif
 
-#include <sspi.h>
-
-#include <wine/debug.h>
-WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
+#include "ole2.h"
+#include "sspi.h"
 
 static const WCHAR getW[]    = {'G','E','T',0};
 static const WCHAR postW[]   = {'P','O','S','T',0};
 
 static const WCHAR getW[]    = {'G','E','T',0};
 static const WCHAR postW[]   = {'P','O','S','T',0};
@@ -238,8 +224,6 @@ typedef struct
     char  read_buf[8192]; /* buffer for already read but not returned data */
     header_t *headers;
     DWORD num_headers;
     char  read_buf[8192]; /* buffer for already read but not returned data */
     header_t *headers;
     DWORD num_headers;
-    WCHAR **accept_types;
-    DWORD num_accept_types;
     struct authinfo *authinfo;
     struct authinfo *proxy_authinfo;
     HANDLE task_wait;
     struct authinfo *authinfo;
     struct authinfo *proxy_authinfo;
     HANDLE task_wait;
@@ -334,34 +318,16 @@ void destroy_authinfo( struct authinfo * ) DECLSPEC_HIDDEN;
 
 void release_host( hostdata_t *host ) DECLSPEC_HIDDEN;
 
 
 void release_host( hostdata_t *host ) DECLSPEC_HIDDEN;
 
+BOOL process_header( request_t *request, LPCWSTR field, LPCWSTR value, DWORD flags, BOOL request_only ) DECLSPEC_HIDDEN;
+
 extern HRESULT WinHttpRequest_create( void ** ) DECLSPEC_HIDDEN;
 void release_typelib( void ) DECLSPEC_HIDDEN;
 
 extern HRESULT WinHttpRequest_create( void ** ) DECLSPEC_HIDDEN;
 void release_typelib( void ) DECLSPEC_HIDDEN;
 
-static inline void* __WINE_ALLOC_SIZE(1) heap_alloc( SIZE_T size )
-{
-    return HeapAlloc( GetProcessHeap(), 0, size );
-}
-
-static inline void* __WINE_ALLOC_SIZE(1) heap_alloc_zero( SIZE_T size )
-{
-    return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size );
-}
-
-static inline void* __WINE_ALLOC_SIZE(2) heap_realloc( LPVOID mem, SIZE_T size )
-{
-    return HeapReAlloc( GetProcessHeap(), 0, mem, size );
-}
-
 static inline void* __WINE_ALLOC_SIZE(2) heap_realloc_zero( LPVOID mem, SIZE_T size )
 {
     return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, mem, size );
 }
 
 static inline void* __WINE_ALLOC_SIZE(2) heap_realloc_zero( LPVOID mem, SIZE_T size )
 {
     return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, mem, size );
 }
 
-static inline BOOL heap_free( LPVOID mem )
-{
-    return HeapFree( GetProcessHeap(), 0, mem );
-}
-
 static inline WCHAR *strdupW( const WCHAR *src )
 {
     WCHAR *dst;
 static inline WCHAR *strdupW( const WCHAR *src )
 {
     WCHAR *dst;
index 3f6efec..15c38ec 100644 (file)
@@ -200,7 +200,7 @@ reactos/dll/win32/windowscodecs       # Synced to WineStaging-3.3
 reactos/dll/win32/windowscodecsext    # Synced to WineStaging-2.9
 reactos/dll/win32/winemp3.acm         # Synced to WineStaging-3.3
 reactos/dll/win32/wing32              # Synced to WineStaging-3.3
 reactos/dll/win32/windowscodecsext    # Synced to WineStaging-2.9
 reactos/dll/win32/winemp3.acm         # Synced to WineStaging-3.3
 reactos/dll/win32/wing32              # Synced to WineStaging-3.3
-reactos/dll/win32/winhttp             # Synced to Wine-3.0
+reactos/dll/win32/winhttp             # Synced to WineStaging-3.3
 reactos/dll/win32/wininet             # Synced to Wine-3.0
 reactos/dll/win32/winmm               # Forked at Wine-20050628
 reactos/dll/win32/winmm/midimap       # Forked at Wine-20050628
 reactos/dll/win32/wininet             # Synced to Wine-3.0
 reactos/dll/win32/winmm               # Forked at Wine-20050628
 reactos/dll/win32/winmm/midimap       # Forked at Wine-20050628