[WINHTTP] Sync with Wine Staging 3.3. CORE-14434

This commit is contained in:
Amine Khaldi 2018-03-24 13:15:44 +01:00
parent ce9211a205
commit 0530cb8bed
11 changed files with 174 additions and 93 deletions

View file

@ -17,7 +17,7 @@ list(APPEND SOURCE
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)
@ -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_pch(winhttp winhttp_private.h SOURCE)
add_pch(winhttp precomp.h SOURCE)
add_cd_file(TARGET winhttp DESTINATION reactos/system32 FOR all)

View file

@ -16,8 +16,20 @@
* 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"
WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
static domain_t *add_domain( session_t *session, WCHAR *name )
{
domain_t *domain;

View file

@ -18,8 +18,20 @@
* 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"
WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
#define HANDLE_CHUNK_SIZE 0x10
static CRITICAL_SECTION handle_cs;

View file

@ -16,13 +16,24 @@
* 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 <rpcproxy.h>
#include <httprequest.h>
HINSTANCE winhttp_instance;
WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
/******************************************************************
* DllMain (winhttp.@)
*/

View file

@ -17,11 +17,15 @@
* 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 <schannel.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
@ -35,6 +39,25 @@
# 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() */

View file

@ -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_ */

View file

@ -19,19 +19,34 @@
* 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
#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"
#endif
#define DEFAULT_KEEP_ALIVE_TIMEOUT 30000
@ -391,7 +406,7 @@ static BOOL delete_header( request_t *request, DWORD index )
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;
@ -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;
DWORD len, i, flags;
DWORD len;
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 );

View file

@ -16,12 +16,40 @@
* 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 <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
@ -589,8 +617,6 @@ static void request_destroy( object_header_t *hdr )
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++)
@ -1016,32 +1042,14 @@ static const object_vtbl_t request_vtbl =
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;
DWORD i;
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;

View file

@ -16,8 +16,21 @@
* 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"
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};

View file

@ -19,27 +19,15 @@
#ifndef _WINE_WINHTTP_PRIVATE_H_
#define _WINE_WINHTTP_PRIVATE_H_
#include <wine/config.h>
#ifndef __WINE_CONFIG_H
# error You must include config.h to use this header
#endif
#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>
#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
@ -56,10 +44,8 @@
# 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};
@ -238,8 +224,6 @@ typedef struct
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;
@ -334,34 +318,16 @@ void destroy_authinfo( struct authinfo * ) 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;
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 BOOL heap_free( LPVOID mem )
{
return HeapFree( GetProcessHeap(), 0, mem );
}
static inline WCHAR *strdupW( const WCHAR *src )
{
WCHAR *dst;

View 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/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