mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
[WINHTTP] Sync with Wine Staging 4.18. CORE-16441
This commit is contained in:
parent
611eb5508c
commit
5bd6580fc6
9 changed files with 1622 additions and 1438 deletions
|
@ -17,24 +17,39 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#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);
|
||||||
|
|
||||||
static domain_t *add_domain( session_t *session, WCHAR *name )
|
struct cookie
|
||||||
{
|
{
|
||||||
domain_t *domain;
|
struct list entry;
|
||||||
|
WCHAR *name;
|
||||||
|
WCHAR *value;
|
||||||
|
WCHAR *path;
|
||||||
|
};
|
||||||
|
|
||||||
if (!(domain = heap_alloc_zero( sizeof(domain_t) ))) return NULL;
|
struct domain
|
||||||
|
{
|
||||||
|
struct list entry;
|
||||||
|
WCHAR *name;
|
||||||
|
struct list cookies;
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct domain *add_domain( struct session *session, WCHAR *name )
|
||||||
|
{
|
||||||
|
struct domain *domain;
|
||||||
|
|
||||||
|
if (!(domain = heap_alloc_zero( sizeof(struct domain) ))) return NULL;
|
||||||
|
|
||||||
list_init( &domain->entry );
|
list_init( &domain->entry );
|
||||||
list_init( &domain->cookies );
|
list_init( &domain->cookies );
|
||||||
|
@ -46,14 +61,14 @@ static domain_t *add_domain( session_t *session, WCHAR *name )
|
||||||
return domain;
|
return domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cookie_t *find_cookie( domain_t *domain, const WCHAR *path, const WCHAR *name )
|
static struct cookie *find_cookie( struct domain *domain, const WCHAR *path, const WCHAR *name )
|
||||||
{
|
{
|
||||||
struct list *item;
|
struct list *item;
|
||||||
cookie_t *cookie;
|
struct cookie *cookie;
|
||||||
|
|
||||||
LIST_FOR_EACH( item, &domain->cookies )
|
LIST_FOR_EACH( item, &domain->cookies )
|
||||||
{
|
{
|
||||||
cookie = LIST_ENTRY( item, cookie_t, entry );
|
cookie = LIST_ENTRY( item, struct cookie, entry );
|
||||||
if (!strcmpW( cookie->path, path ) && !strcmpW( cookie->name, name ))
|
if (!strcmpW( cookie->path, path ) && !strcmpW( cookie->name, name ))
|
||||||
{
|
{
|
||||||
TRACE("found %s=%s\n", debugstr_w(cookie->name), debugstr_w(cookie->value));
|
TRACE("found %s=%s\n", debugstr_w(cookie->name), debugstr_w(cookie->value));
|
||||||
|
@ -63,7 +78,7 @@ static cookie_t *find_cookie( domain_t *domain, const WCHAR *path, const WCHAR *
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL domain_match( const WCHAR *name, domain_t *domain, BOOL partial )
|
static BOOL domain_match( const WCHAR *name, struct domain *domain, BOOL partial )
|
||||||
{
|
{
|
||||||
TRACE("comparing %s with %s\n", debugstr_w(name), debugstr_w(domain->name));
|
TRACE("comparing %s with %s\n", debugstr_w(name), debugstr_w(domain->name));
|
||||||
|
|
||||||
|
@ -72,7 +87,7 @@ static BOOL domain_match( const WCHAR *name, domain_t *domain, BOOL partial )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_cookie( cookie_t *cookie )
|
static void free_cookie( struct cookie *cookie )
|
||||||
{
|
{
|
||||||
heap_free( cookie->name );
|
heap_free( cookie->name );
|
||||||
heap_free( cookie->value );
|
heap_free( cookie->value );
|
||||||
|
@ -80,20 +95,20 @@ static void free_cookie( cookie_t *cookie )
|
||||||
heap_free( cookie );
|
heap_free( cookie );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void delete_cookie( cookie_t *cookie )
|
static void delete_cookie( struct cookie *cookie )
|
||||||
{
|
{
|
||||||
list_remove( &cookie->entry );
|
list_remove( &cookie->entry );
|
||||||
free_cookie( cookie );
|
free_cookie( cookie );
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete_domain( domain_t *domain )
|
static void delete_domain( struct domain *domain )
|
||||||
{
|
{
|
||||||
cookie_t *cookie;
|
struct cookie *cookie;
|
||||||
struct list *item, *next;
|
struct list *item, *next;
|
||||||
|
|
||||||
LIST_FOR_EACH_SAFE( item, next, &domain->cookies )
|
LIST_FOR_EACH_SAFE( item, next, &domain->cookies )
|
||||||
{
|
{
|
||||||
cookie = LIST_ENTRY( item, cookie_t, entry );
|
cookie = LIST_ENTRY( item, struct cookie, entry );
|
||||||
delete_cookie( cookie );
|
delete_cookie( cookie );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,35 +117,51 @@ void delete_domain( domain_t *domain )
|
||||||
heap_free( domain );
|
heap_free( domain );
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL add_cookie( session_t *session, cookie_t *cookie, WCHAR *domain_name, WCHAR *path )
|
void destroy_cookies( struct session *session )
|
||||||
{
|
{
|
||||||
domain_t *domain = NULL;
|
struct list *item, *next;
|
||||||
cookie_t *old_cookie;
|
struct domain *domain;
|
||||||
|
|
||||||
|
LIST_FOR_EACH_SAFE( item, next, &session->cookie_cache )
|
||||||
|
{
|
||||||
|
domain = LIST_ENTRY( item, struct domain, entry );
|
||||||
|
delete_domain( domain );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL add_cookie( struct session *session, struct cookie *cookie, WCHAR *domain_name, WCHAR *path )
|
||||||
|
{
|
||||||
|
struct domain *domain = NULL;
|
||||||
|
struct cookie *old_cookie;
|
||||||
struct list *item;
|
struct list *item;
|
||||||
|
|
||||||
|
if (!(cookie->path = strdupW( path ))) return FALSE;
|
||||||
|
|
||||||
|
EnterCriticalSection( &session->cs );
|
||||||
|
|
||||||
LIST_FOR_EACH( item, &session->cookie_cache )
|
LIST_FOR_EACH( item, &session->cookie_cache )
|
||||||
{
|
{
|
||||||
domain = LIST_ENTRY( item, domain_t, entry );
|
domain = LIST_ENTRY( item, struct domain, entry );
|
||||||
if (domain_match( domain_name, domain, FALSE )) break;
|
if (domain_match( domain_name, domain, FALSE )) break;
|
||||||
domain = NULL;
|
domain = NULL;
|
||||||
}
|
}
|
||||||
if (!domain)
|
if (!domain) domain = add_domain( session, domain_name );
|
||||||
{
|
|
||||||
if (!(domain = add_domain( session, domain_name ))) return FALSE;
|
|
||||||
}
|
|
||||||
else if ((old_cookie = find_cookie( domain, path, cookie->name ))) delete_cookie( old_cookie );
|
else if ((old_cookie = find_cookie( domain, path, cookie->name ))) delete_cookie( old_cookie );
|
||||||
|
|
||||||
cookie->path = strdupW( path );
|
if (domain)
|
||||||
|
{
|
||||||
list_add_head( &domain->cookies, &cookie->entry );
|
list_add_head( &domain->cookies, &cookie->entry );
|
||||||
|
|
||||||
TRACE("domain %s path %s <- %s=%s\n", debugstr_w(domain_name), debugstr_w(cookie->path),
|
TRACE("domain %s path %s <- %s=%s\n", debugstr_w(domain_name), debugstr_w(cookie->path),
|
||||||
debugstr_w(cookie->name), debugstr_w(cookie->value));
|
debugstr_w(cookie->name), debugstr_w(cookie->value));
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static cookie_t *parse_cookie( const WCHAR *string )
|
LeaveCriticalSection( &session->cs );
|
||||||
|
return domain != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct cookie *parse_cookie( const WCHAR *string )
|
||||||
{
|
{
|
||||||
cookie_t *cookie;
|
struct cookie *cookie;
|
||||||
const WCHAR *p;
|
const WCHAR *p;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
@ -139,7 +170,7 @@ static cookie_t *parse_cookie( const WCHAR *string )
|
||||||
while (len && string[len - 1] == ' ') len--;
|
while (len && string[len - 1] == ' ') len--;
|
||||||
if (!len) return NULL;
|
if (!len) return NULL;
|
||||||
|
|
||||||
if (!(cookie = heap_alloc_zero( sizeof(cookie_t) ))) return NULL;
|
if (!(cookie = heap_alloc_zero( sizeof(struct cookie) ))) return NULL;
|
||||||
list_init( &cookie->entry );
|
list_init( &cookie->entry );
|
||||||
|
|
||||||
if (!(cookie->name = heap_alloc( (len + 1) * sizeof(WCHAR) )))
|
if (!(cookie->name = heap_alloc( (len + 1) * sizeof(WCHAR) )))
|
||||||
|
@ -229,7 +260,7 @@ static struct attr *parse_attr( const WCHAR *str, int *used )
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL set_cookies( request_t *request, const WCHAR *cookies )
|
BOOL set_cookies( struct request *request, const WCHAR *cookies )
|
||||||
{
|
{
|
||||||
static const WCHAR pathW[] = {'p','a','t','h',0};
|
static const WCHAR pathW[] = {'p','a','t','h',0};
|
||||||
static const WCHAR domainW[] = {'d','o','m','a','i','n',0};
|
static const WCHAR domainW[] = {'d','o','m','a','i','n',0};
|
||||||
|
@ -237,8 +268,8 @@ BOOL set_cookies( request_t *request, const WCHAR *cookies )
|
||||||
WCHAR *buffer, *p;
|
WCHAR *buffer, *p;
|
||||||
WCHAR *cookie_domain = NULL, *cookie_path = NULL;
|
WCHAR *cookie_domain = NULL, *cookie_path = NULL;
|
||||||
struct attr *attr, *domain = NULL, *path = NULL;
|
struct attr *attr, *domain = NULL, *path = NULL;
|
||||||
session_t *session = request->connect->session;
|
struct session *session = request->connect->session;
|
||||||
cookie_t *cookie;
|
struct cookie *cookie;
|
||||||
int len, used;
|
int len, used;
|
||||||
|
|
||||||
len = strlenW( cookies );
|
len = strlenW( cookies );
|
||||||
|
@ -290,14 +321,16 @@ end:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL add_cookie_headers( request_t *request )
|
BOOL add_cookie_headers( struct request *request )
|
||||||
{
|
{
|
||||||
struct list *domain_cursor;
|
struct list *domain_cursor;
|
||||||
session_t *session = request->connect->session;
|
struct session *session = request->connect->session;
|
||||||
|
|
||||||
|
EnterCriticalSection( &session->cs );
|
||||||
|
|
||||||
LIST_FOR_EACH( domain_cursor, &session->cookie_cache )
|
LIST_FOR_EACH( domain_cursor, &session->cookie_cache )
|
||||||
{
|
{
|
||||||
domain_t *domain = LIST_ENTRY( domain_cursor, domain_t, entry );
|
struct domain *domain = LIST_ENTRY( domain_cursor, struct domain, entry );
|
||||||
if (domain_match( request->connect->servername, domain, TRUE ))
|
if (domain_match( request->connect->servername, domain, TRUE ))
|
||||||
{
|
{
|
||||||
struct list *cookie_cursor;
|
struct list *cookie_cursor;
|
||||||
|
@ -305,19 +338,23 @@ BOOL add_cookie_headers( request_t *request )
|
||||||
|
|
||||||
LIST_FOR_EACH( cookie_cursor, &domain->cookies )
|
LIST_FOR_EACH( cookie_cursor, &domain->cookies )
|
||||||
{
|
{
|
||||||
cookie_t *cookie = LIST_ENTRY( cookie_cursor, cookie_t, entry );
|
struct cookie *cookie = LIST_ENTRY( cookie_cursor, struct cookie, entry );
|
||||||
|
|
||||||
TRACE("comparing path %s with %s\n", debugstr_w(request->path), debugstr_w(cookie->path));
|
TRACE("comparing path %s with %s\n", debugstr_w(request->path), debugstr_w(cookie->path));
|
||||||
|
|
||||||
if (strstrW( request->path, cookie->path ) == request->path)
|
if (strstrW( request->path, cookie->path ) == request->path)
|
||||||
{
|
{
|
||||||
const WCHAR cookieW[] = {'C','o','o','k','i','e',':',' '};
|
static const WCHAR cookieW[] = {'C','o','o','k','i','e',':',' '};
|
||||||
int len, len_cookie = sizeof(cookieW) / sizeof(cookieW[0]), len_name = strlenW( cookie->name );
|
int len, len_cookie = ARRAY_SIZE( cookieW ), len_name = strlenW( cookie->name );
|
||||||
WCHAR *header;
|
WCHAR *header;
|
||||||
|
|
||||||
len = len_cookie + len_name;
|
len = len_cookie + len_name;
|
||||||
if (cookie->value) len += strlenW( cookie->value ) + 1;
|
if (cookie->value) len += strlenW( cookie->value ) + 1;
|
||||||
if (!(header = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return FALSE;
|
if (!(header = heap_alloc( (len + 1) * sizeof(WCHAR) )))
|
||||||
|
{
|
||||||
|
LeaveCriticalSection( &session->cs );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy( header, cookieW, len_cookie * sizeof(WCHAR) );
|
memcpy( header, cookieW, len_cookie * sizeof(WCHAR) );
|
||||||
strcpyW( header + len_cookie, cookie->name );
|
strcpyW( header + len_cookie, cookie->name );
|
||||||
|
@ -335,5 +372,7 @@ BOOL add_cookie_headers( request_t *request )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LeaveCriticalSection( &session->cs );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
@ -43,20 +42,20 @@ static CRITICAL_SECTION_DEBUG handle_cs_debug =
|
||||||
};
|
};
|
||||||
static CRITICAL_SECTION handle_cs = { &handle_cs_debug, -1, 0, 0, 0, 0 };
|
static CRITICAL_SECTION handle_cs = { &handle_cs_debug, -1, 0, 0, 0, 0 };
|
||||||
|
|
||||||
static object_header_t **handles;
|
static struct object_header **handles;
|
||||||
static ULONG_PTR next_handle;
|
static ULONG_PTR next_handle;
|
||||||
static ULONG_PTR max_handles;
|
static ULONG_PTR max_handles;
|
||||||
|
|
||||||
object_header_t *addref_object( object_header_t *hdr )
|
struct object_header *addref_object( struct object_header *hdr )
|
||||||
{
|
{
|
||||||
ULONG refs = InterlockedIncrement( &hdr->refs );
|
ULONG refs = InterlockedIncrement( &hdr->refs );
|
||||||
TRACE("%p -> refcount = %d\n", hdr, refs);
|
TRACE("%p -> refcount = %d\n", hdr, refs);
|
||||||
return hdr;
|
return hdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_header_t *grab_object( HINTERNET hinternet )
|
struct object_header *grab_object( HINTERNET hinternet )
|
||||||
{
|
{
|
||||||
object_header_t *hdr = NULL;
|
struct object_header *hdr = NULL;
|
||||||
ULONG_PTR handle = (ULONG_PTR)hinternet;
|
ULONG_PTR handle = (ULONG_PTR)hinternet;
|
||||||
|
|
||||||
EnterCriticalSection( &handle_cs );
|
EnterCriticalSection( &handle_cs );
|
||||||
|
@ -70,13 +69,13 @@ object_header_t *grab_object( HINTERNET hinternet )
|
||||||
return hdr;
|
return hdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void release_object( object_header_t *hdr )
|
void release_object( struct object_header *hdr )
|
||||||
{
|
{
|
||||||
ULONG refs = InterlockedDecrement( &hdr->refs );
|
ULONG refs = InterlockedDecrement( &hdr->refs );
|
||||||
TRACE("object %p refcount = %d\n", hdr, refs);
|
TRACE("object %p refcount = %d\n", hdr, refs);
|
||||||
if (!refs)
|
if (!refs)
|
||||||
{
|
{
|
||||||
if (hdr->type == WINHTTP_HANDLE_TYPE_REQUEST) close_connection( (request_t *)hdr );
|
if (hdr->type == WINHTTP_HANDLE_TYPE_REQUEST) close_connection( (struct request *)hdr );
|
||||||
|
|
||||||
send_callback( hdr, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, &hdr->handle, sizeof(HINTERNET) );
|
send_callback( hdr, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, &hdr->handle, sizeof(HINTERNET) );
|
||||||
|
|
||||||
|
@ -86,9 +85,9 @@ void release_object( object_header_t *hdr )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HINTERNET alloc_handle( object_header_t *hdr )
|
HINTERNET alloc_handle( struct object_header *hdr )
|
||||||
{
|
{
|
||||||
object_header_t **p;
|
struct object_header **p;
|
||||||
ULONG_PTR handle, num;
|
ULONG_PTR handle, num;
|
||||||
|
|
||||||
list_init( &hdr->children );
|
list_init( &hdr->children );
|
||||||
|
@ -125,7 +124,7 @@ BOOL free_handle( HINTERNET hinternet )
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
ULONG_PTR handle = (ULONG_PTR)hinternet;
|
ULONG_PTR handle = (ULONG_PTR)hinternet;
|
||||||
object_header_t *hdr = NULL, *child, *next;
|
struct object_header *hdr = NULL, *child, *next;
|
||||||
|
|
||||||
EnterCriticalSection( &handle_cs );
|
EnterCriticalSection( &handle_cs );
|
||||||
|
|
||||||
|
@ -145,7 +144,7 @@ BOOL free_handle( HINTERNET hinternet )
|
||||||
|
|
||||||
if (hdr)
|
if (hdr)
|
||||||
{
|
{
|
||||||
LIST_FOR_EACH_ENTRY_SAFE( child, next, &hdr->children, object_header_t, entry )
|
LIST_FOR_EACH_ENTRY_SAFE( child, next, &hdr->children, struct object_header, entry )
|
||||||
{
|
{
|
||||||
TRACE("freeing child handle %p for parent handle 0x%lx\n", child->handle, handle + 1);
|
TRACE("freeing child handle %p for parent handle 0x%lx\n", child->handle, handle + 1);
|
||||||
free_handle( child->handle );
|
free_handle( child->handle );
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -18,145 +18,31 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "wine/port.h"
|
#define NONAMELESSUNION
|
||||||
|
#include "ws2tcpip.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
|
||||||
# include <sys/socket.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_IOCTL_H
|
|
||||||
# include <sys/ioctl.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_FILIO_H
|
|
||||||
# include <sys/filio.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_POLL_H
|
|
||||||
# include <poll.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NONAMELESSUNION
|
|
||||||
|
|
||||||
#include "wine/debug.h"
|
|
||||||
#include "wine/library.h"
|
|
||||||
|
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "winhttp.h"
|
#include "winhttp.h"
|
||||||
#include "wincrypt.h"
|
|
||||||
#include "schannel.h"
|
#include "schannel.h"
|
||||||
|
|
||||||
|
#include "wine/debug.h"
|
||||||
|
#include "wine/library.h"
|
||||||
#include "winhttp_private.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);
|
WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
|
||||||
|
|
||||||
#ifndef HAVE_GETADDRINFO
|
|
||||||
|
|
||||||
/* critical section to protect non-reentrant gethostbyname() */
|
|
||||||
static CRITICAL_SECTION cs_gethostbyname;
|
|
||||||
static CRITICAL_SECTION_DEBUG critsect_debug =
|
|
||||||
{
|
|
||||||
0, 0, &cs_gethostbyname,
|
|
||||||
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
|
|
||||||
0, 0, { (DWORD_PTR)(__FILE__ ": cs_gethostbyname") }
|
|
||||||
};
|
|
||||||
static CRITICAL_SECTION cs_gethostbyname = { &critsect_debug, -1, 0, 0, 0, 0 };
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* translate a unix error code into a winsock error code */
|
|
||||||
#ifndef __REACTOS__
|
|
||||||
static int sock_get_error( int err )
|
|
||||||
{
|
|
||||||
#if !defined(__MINGW32__) && !defined (_MSC_VER)
|
|
||||||
switch (err)
|
|
||||||
{
|
|
||||||
case EINTR: return WSAEINTR;
|
|
||||||
case EBADF: return WSAEBADF;
|
|
||||||
case EPERM:
|
|
||||||
case EACCES: return WSAEACCES;
|
|
||||||
case EFAULT: return WSAEFAULT;
|
|
||||||
case EINVAL: return WSAEINVAL;
|
|
||||||
case EMFILE: return WSAEMFILE;
|
|
||||||
case EWOULDBLOCK: return WSAEWOULDBLOCK;
|
|
||||||
case EINPROGRESS: return WSAEINPROGRESS;
|
|
||||||
case EALREADY: return WSAEALREADY;
|
|
||||||
case ENOTSOCK: return WSAENOTSOCK;
|
|
||||||
case EDESTADDRREQ: return WSAEDESTADDRREQ;
|
|
||||||
case EMSGSIZE: return WSAEMSGSIZE;
|
|
||||||
case EPROTOTYPE: return WSAEPROTOTYPE;
|
|
||||||
case ENOPROTOOPT: return WSAENOPROTOOPT;
|
|
||||||
case EPROTONOSUPPORT: return WSAEPROTONOSUPPORT;
|
|
||||||
case ESOCKTNOSUPPORT: return WSAESOCKTNOSUPPORT;
|
|
||||||
case EOPNOTSUPP: return WSAEOPNOTSUPP;
|
|
||||||
case EPFNOSUPPORT: return WSAEPFNOSUPPORT;
|
|
||||||
case EAFNOSUPPORT: return WSAEAFNOSUPPORT;
|
|
||||||
case EADDRINUSE: return WSAEADDRINUSE;
|
|
||||||
case EADDRNOTAVAIL: return WSAEADDRNOTAVAIL;
|
|
||||||
case ENETDOWN: return WSAENETDOWN;
|
|
||||||
case ENETUNREACH: return WSAENETUNREACH;
|
|
||||||
case ENETRESET: return WSAENETRESET;
|
|
||||||
case ECONNABORTED: return WSAECONNABORTED;
|
|
||||||
case EPIPE:
|
|
||||||
case ECONNRESET: return WSAECONNRESET;
|
|
||||||
case ENOBUFS: return WSAENOBUFS;
|
|
||||||
case EISCONN: return WSAEISCONN;
|
|
||||||
case ENOTCONN: return WSAENOTCONN;
|
|
||||||
case ESHUTDOWN: return WSAESHUTDOWN;
|
|
||||||
case ETOOMANYREFS: return WSAETOOMANYREFS;
|
|
||||||
case ETIMEDOUT: return WSAETIMEDOUT;
|
|
||||||
case ECONNREFUSED: return WSAECONNREFUSED;
|
|
||||||
case ELOOP: return WSAELOOP;
|
|
||||||
case ENAMETOOLONG: return WSAENAMETOOLONG;
|
|
||||||
case EHOSTDOWN: return WSAEHOSTDOWN;
|
|
||||||
case EHOSTUNREACH: return WSAEHOSTUNREACH;
|
|
||||||
case ENOTEMPTY: return WSAENOTEMPTY;
|
|
||||||
#ifdef EPROCLIM
|
|
||||||
case EPROCLIM: return WSAEPROCLIM;
|
|
||||||
#endif
|
|
||||||
#ifdef EUSERS
|
|
||||||
case EUSERS: return WSAEUSERS;
|
|
||||||
#endif
|
|
||||||
#ifdef EDQUOT
|
|
||||||
case EDQUOT: return WSAEDQUOT;
|
|
||||||
#endif
|
|
||||||
#ifdef ESTALE
|
|
||||||
case ESTALE: return WSAESTALE;
|
|
||||||
#endif
|
|
||||||
#ifdef EREMOTE
|
|
||||||
case EREMOTE: return WSAEREMOTE;
|
|
||||||
#endif
|
|
||||||
default: errno = err; perror( "sock_set_error" ); return WSAEFAULT;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define sock_get_error(x) WSAGetLastError()
|
|
||||||
|
|
||||||
static inline int unix_ioctl(int filedes, long request, void *arg)
|
|
||||||
{
|
|
||||||
return ioctlsocket(filedes, request, arg);
|
|
||||||
}
|
|
||||||
#define ioctlsocket unix_ioctl
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int sock_send(int fd, const void *msg, size_t len, int flags)
|
static int sock_send(int fd, const void *msg, size_t len, int flags)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if ((ret = send(fd, msg, len, flags)) == -1) WARN("send error %s\n", strerror(errno));
|
if ((ret = send(fd, msg, len, flags)) == -1) WARN("send error %u\n", WSAGetLastError());
|
||||||
}
|
}
|
||||||
while(ret == -1 && errno == EINTR);
|
while(ret == -1 && WSAGetLastError() == WSAEINTR);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,13 +51,13 @@ static int sock_recv(int fd, void *msg, size_t len, int flags)
|
||||||
int ret;
|
int ret;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if ((ret = recv(fd, msg, len, flags)) == -1) WARN("recv error %s\n", strerror(errno));
|
if ((ret = recv(fd, msg, len, flags)) == -1) WARN("recv error %u\n", WSAGetLastError());
|
||||||
}
|
}
|
||||||
while(ret == -1 && errno == EINTR);
|
while(ret == -1 && WSAGetLastError() == WSAEINTR);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD netconn_verify_cert( PCCERT_CONTEXT cert, WCHAR *server, DWORD security_flags )
|
static DWORD netconn_verify_cert( PCCERT_CONTEXT cert, WCHAR *server, DWORD security_flags, BOOL check_revocation )
|
||||||
{
|
{
|
||||||
HCERTSTORE store = cert->hCertStore;
|
HCERTSTORE store = cert->hCertStore;
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
@ -184,9 +70,10 @@ static DWORD netconn_verify_cert( PCCERT_CONTEXT cert, WCHAR *server, DWORD secu
|
||||||
TRACE("verifying %s\n", debugstr_w( server ));
|
TRACE("verifying %s\n", debugstr_w( server ));
|
||||||
chainPara.RequestedUsage.Usage.cUsageIdentifier = 1;
|
chainPara.RequestedUsage.Usage.cUsageIdentifier = 1;
|
||||||
chainPara.RequestedUsage.Usage.rgpszUsageIdentifier = server_auth;
|
chainPara.RequestedUsage.Usage.rgpszUsageIdentifier = server_auth;
|
||||||
if ((ret = CertGetCertificateChain( NULL, cert, NULL, store, &chainPara,
|
ret = CertGetCertificateChain( NULL, cert, NULL, store, &chainPara,
|
||||||
CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT,
|
check_revocation ? CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT : 0,
|
||||||
NULL, &chain )))
|
NULL, &chain );
|
||||||
|
if (ret)
|
||||||
{
|
{
|
||||||
if (chain->TrustStatus.dwErrorStatus)
|
if (chain->TrustStatus.dwErrorStatus)
|
||||||
{
|
{
|
||||||
|
@ -264,46 +151,41 @@ static DWORD netconn_verify_cert( PCCERT_CONTEXT cert, WCHAR *server, DWORD secu
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __REACTOS__
|
static BOOL winsock_loaded;
|
||||||
static BOOL winsock_initialized = FALSE;
|
|
||||||
BOOL netconn_init_winsock()
|
|
||||||
{
|
|
||||||
WSADATA wsaData;
|
|
||||||
int error;
|
|
||||||
if (!winsock_initialized)
|
|
||||||
{
|
|
||||||
error = WSAStartup(MAKEWORD(1, 1), &wsaData);
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
ERR("WSAStartup failed: %d\n", error);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
winsock_initialized = TRUE;
|
|
||||||
}
|
|
||||||
return winsock_initialized;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void netconn_unload( void )
|
void netconn_unload( void )
|
||||||
{
|
{
|
||||||
#ifndef HAVE_GETADDRINFO
|
if (winsock_loaded) WSACleanup();
|
||||||
DeleteCriticalSection(&cs_gethostbyname);
|
|
||||||
#endif
|
|
||||||
#ifdef __REACTOS__
|
|
||||||
if(winsock_initialized)
|
|
||||||
WSACleanup();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
netconn_t *netconn_create( hostdata_t *host, const struct sockaddr_storage *sockaddr, int timeout )
|
static BOOL WINAPI winsock_startup( INIT_ONCE *once, void *param, void **ctx )
|
||||||
{
|
{
|
||||||
netconn_t *conn;
|
int ret;
|
||||||
|
WSADATA data;
|
||||||
|
if (!(ret = WSAStartup( MAKEWORD(1,1), &data ))) winsock_loaded = TRUE;
|
||||||
|
else ERR( "WSAStartup failed: %d\n", ret );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void winsock_init(void)
|
||||||
|
{
|
||||||
|
static INIT_ONCE once = INIT_ONCE_STATIC_INIT;
|
||||||
|
InitOnceExecuteOnce( &once, winsock_startup, NULL, NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_blocking( struct netconn *conn, BOOL blocking )
|
||||||
|
{
|
||||||
|
ULONG state = !blocking;
|
||||||
|
ioctlsocket( conn->socket, FIONBIO, &state );
|
||||||
|
}
|
||||||
|
|
||||||
|
struct netconn *netconn_create( struct hostdata *host, const struct sockaddr_storage *sockaddr, int timeout )
|
||||||
|
{
|
||||||
|
struct netconn *conn;
|
||||||
unsigned int addr_len;
|
unsigned int addr_len;
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
int res;
|
|
||||||
ULONG state;
|
winsock_init();
|
||||||
|
|
||||||
conn = heap_alloc_zero(sizeof(*conn));
|
conn = heap_alloc_zero(sizeof(*conn));
|
||||||
if (!conn) return NULL;
|
if (!conn) return NULL;
|
||||||
|
@ -311,8 +193,7 @@ netconn_t *netconn_create( hostdata_t *host, const struct sockaddr_storage *sock
|
||||||
conn->sockaddr = *sockaddr;
|
conn->sockaddr = *sockaddr;
|
||||||
if ((conn->socket = socket( sockaddr->ss_family, SOCK_STREAM, 0 )) == -1)
|
if ((conn->socket = socket( sockaddr->ss_family, SOCK_STREAM, 0 )) == -1)
|
||||||
{
|
{
|
||||||
WARN("unable to create socket (%s)\n", strerror(errno));
|
WARN("unable to create socket (%u)\n", WSAGetLastError());
|
||||||
set_last_error( sock_get_error( errno ) );
|
|
||||||
heap_free(conn);
|
heap_free(conn);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -329,83 +210,39 @@ netconn_t *netconn_create( hostdata_t *host, const struct sockaddr_storage *sock
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeout > 0)
|
if (timeout > 0) set_blocking( conn, FALSE );
|
||||||
{
|
|
||||||
state = 1;
|
|
||||||
ioctlsocket( conn->socket, FIONBIO, &state );
|
|
||||||
}
|
|
||||||
|
|
||||||
for (;;)
|
if (!connect( conn->socket, (const struct sockaddr *)&conn->sockaddr, addr_len )) ret = TRUE;
|
||||||
{
|
|
||||||
res = 0;
|
|
||||||
if (connect( conn->socket, (const struct sockaddr *)&conn->sockaddr, addr_len ) < 0)
|
|
||||||
{
|
|
||||||
res = sock_get_error( errno );
|
|
||||||
if (res == WSAEWOULDBLOCK || res == WSAEINPROGRESS)
|
|
||||||
{
|
|
||||||
#ifdef __REACTOS__
|
|
||||||
/* ReactOS: use select instead of poll */
|
|
||||||
fd_set outfd;
|
|
||||||
struct timeval tv;
|
|
||||||
|
|
||||||
FD_ZERO(&outfd);
|
|
||||||
FD_SET(conn->socket, &outfd);
|
|
||||||
|
|
||||||
tv.tv_sec = 0;
|
|
||||||
tv.tv_usec = timeout * 1000;
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
res = 0;
|
|
||||||
|
|
||||||
if (select( 0, NULL, &outfd, NULL, &tv ) > 0)
|
|
||||||
#else
|
|
||||||
struct pollfd pfd;
|
|
||||||
|
|
||||||
pfd.fd = conn->socket;
|
|
||||||
pfd.events = POLLOUT;
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
res = 0;
|
|
||||||
if (poll( &pfd, 1, timeout ) > 0)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
ret = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res = sock_get_error( errno );
|
DWORD err = WSAGetLastError();
|
||||||
if (res != WSAEINTR) break;
|
if (err == WSAEWOULDBLOCK || err == WSAEINPROGRESS)
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (res != WSAEINTR) break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
ret = TRUE;
|
FD_SET set;
|
||||||
break;
|
TIMEVAL timeval = { 0, timeout * 1000 };
|
||||||
|
int res;
|
||||||
|
|
||||||
|
FD_ZERO( &set );
|
||||||
|
FD_SET( conn->socket, &set );
|
||||||
|
if ((res = select( conn->socket + 1, NULL, &set, NULL, &timeval )) > 0) ret = TRUE;
|
||||||
|
else if (!res) SetLastError( ERROR_WINHTTP_TIMEOUT );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (timeout > 0)
|
|
||||||
{
|
if (timeout > 0) set_blocking( conn, TRUE );
|
||||||
state = 0;
|
|
||||||
ioctlsocket( conn->socket, FIONBIO, &state );
|
|
||||||
}
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
WARN("unable to connect to host (%d)\n", res);
|
WARN("unable to connect to host (%u)\n", GetLastError());
|
||||||
set_last_error( res );
|
closesocket( conn->socket );
|
||||||
netconn_close( conn );
|
heap_free( conn );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL netconn_close( netconn_t *conn )
|
void netconn_close( struct netconn *conn )
|
||||||
{
|
{
|
||||||
int res;
|
|
||||||
|
|
||||||
if (conn->secure)
|
if (conn->secure)
|
||||||
{
|
{
|
||||||
heap_free( conn->peek_msg_mem );
|
heap_free( conn->peek_msg_mem );
|
||||||
|
@ -413,18 +250,13 @@ BOOL netconn_close( netconn_t *conn )
|
||||||
heap_free(conn->extra_buf);
|
heap_free(conn->extra_buf);
|
||||||
DeleteSecurityContext(&conn->ssl_ctx);
|
DeleteSecurityContext(&conn->ssl_ctx);
|
||||||
}
|
}
|
||||||
res = closesocket( conn->socket );
|
closesocket( conn->socket );
|
||||||
release_host( conn->host );
|
release_host( conn->host );
|
||||||
heap_free(conn);
|
heap_free(conn);
|
||||||
if (res == -1)
|
|
||||||
{
|
|
||||||
set_last_error( sock_get_error( errno ) );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL netconn_secure_connect( netconn_t *conn, WCHAR *hostname, DWORD security_flags, CredHandle *cred_handle )
|
BOOL netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD security_flags, CredHandle *cred_handle,
|
||||||
|
BOOL check_revocation)
|
||||||
{
|
{
|
||||||
SecBuffer out_buf = {0, SECBUFFER_TOKEN, NULL}, in_bufs[2] = {{0, SECBUFFER_TOKEN}, {0, SECBUFFER_EMPTY}};
|
SecBuffer out_buf = {0, SECBUFFER_TOKEN, NULL}, in_bufs[2] = {{0, SECBUFFER_TOKEN}, {0, SECBUFFER_EMPTY}};
|
||||||
SecBufferDesc out_desc = {SECBUFFER_VERSION, 1, &out_buf}, in_desc = {SECBUFFER_VERSION, 2, in_bufs};
|
SecBufferDesc out_desc = {SECBUFFER_VERSION, 1, &out_buf}, in_desc = {SECBUFFER_VERSION, 2, in_bufs};
|
||||||
|
@ -520,7 +352,7 @@ BOOL netconn_secure_connect( netconn_t *conn, WCHAR *hostname, DWORD security_fl
|
||||||
|
|
||||||
status = QueryContextAttributesW(&ctx, SECPKG_ATTR_REMOTE_CERT_CONTEXT, (void*)&cert);
|
status = QueryContextAttributesW(&ctx, SECPKG_ATTR_REMOTE_CERT_CONTEXT, (void*)&cert);
|
||||||
if(status == SEC_E_OK) {
|
if(status == SEC_E_OK) {
|
||||||
res = netconn_verify_cert(cert, hostname, security_flags);
|
res = netconn_verify_cert(cert, hostname, security_flags, check_revocation);
|
||||||
CertFreeCertificateContext(cert);
|
CertFreeCertificateContext(cert);
|
||||||
if(res != ERROR_SUCCESS) {
|
if(res != ERROR_SUCCESS) {
|
||||||
WARN("cert verify failed: %u\n", res);
|
WARN("cert verify failed: %u\n", res);
|
||||||
|
@ -546,7 +378,7 @@ BOOL netconn_secure_connect( netconn_t *conn, WCHAR *hostname, DWORD security_fl
|
||||||
heap_free(conn->ssl_buf);
|
heap_free(conn->ssl_buf);
|
||||||
conn->ssl_buf = NULL;
|
conn->ssl_buf = NULL;
|
||||||
DeleteSecurityContext(&ctx);
|
DeleteSecurityContext(&ctx);
|
||||||
set_last_error(res ? res : ERROR_WINHTTP_SECURE_CHANNEL_ERROR);
|
SetLastError(res ? res : ERROR_WINHTTP_SECURE_CHANNEL_ERROR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +389,7 @@ BOOL netconn_secure_connect( netconn_t *conn, WCHAR *hostname, DWORD security_fl
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL send_ssl_chunk(netconn_t *conn, const void *msg, size_t size)
|
static BOOL send_ssl_chunk(struct netconn *conn, const void *msg, size_t size)
|
||||||
{
|
{
|
||||||
SecBuffer bufs[4] = {
|
SecBuffer bufs[4] = {
|
||||||
{conn->ssl_sizes.cbHeader, SECBUFFER_STREAM_HEADER, conn->ssl_buf},
|
{conn->ssl_sizes.cbHeader, SECBUFFER_STREAM_HEADER, conn->ssl_buf},
|
||||||
|
@ -565,7 +397,7 @@ static BOOL send_ssl_chunk(netconn_t *conn, const void *msg, size_t size)
|
||||||
{conn->ssl_sizes.cbTrailer, SECBUFFER_STREAM_TRAILER, conn->ssl_buf+conn->ssl_sizes.cbHeader+size},
|
{conn->ssl_sizes.cbTrailer, SECBUFFER_STREAM_TRAILER, conn->ssl_buf+conn->ssl_sizes.cbHeader+size},
|
||||||
{0, SECBUFFER_EMPTY, NULL}
|
{0, SECBUFFER_EMPTY, NULL}
|
||||||
};
|
};
|
||||||
SecBufferDesc buf_desc = {SECBUFFER_VERSION, sizeof(bufs)/sizeof(*bufs), bufs};
|
SecBufferDesc buf_desc = {SECBUFFER_VERSION, ARRAY_SIZE(bufs), bufs};
|
||||||
SECURITY_STATUS res;
|
SECURITY_STATUS res;
|
||||||
|
|
||||||
memcpy(bufs[1].pvBuffer, msg, size);
|
memcpy(bufs[1].pvBuffer, msg, size);
|
||||||
|
@ -583,7 +415,7 @@ static BOOL send_ssl_chunk(netconn_t *conn, const void *msg, size_t size)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL netconn_send( netconn_t *conn, const void *msg, size_t len, int *sent )
|
BOOL netconn_send( struct netconn *conn, const void *msg, size_t len, int *sent )
|
||||||
{
|
{
|
||||||
if (conn->secure)
|
if (conn->secure)
|
||||||
{
|
{
|
||||||
|
@ -604,19 +436,14 @@ BOOL netconn_send( netconn_t *conn, const void *msg, size_t len, int *sent )
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if ((*sent = sock_send( conn->socket, msg, len, 0 )) == -1)
|
return ((*sent = sock_send( conn->socket, msg, len, 0 )) != -1);
|
||||||
{
|
|
||||||
set_last_error( sock_get_error( errno ) );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, SIZE_T *ret_size, BOOL *eof)
|
static BOOL read_ssl_chunk(struct netconn *conn, void *buf, SIZE_T buf_size, SIZE_T *ret_size, BOOL *eof)
|
||||||
{
|
{
|
||||||
const SIZE_T ssl_buf_size = conn->ssl_sizes.cbHeader+conn->ssl_sizes.cbMaximumMessage+conn->ssl_sizes.cbTrailer;
|
const SIZE_T ssl_buf_size = conn->ssl_sizes.cbHeader+conn->ssl_sizes.cbMaximumMessage+conn->ssl_sizes.cbTrailer;
|
||||||
SecBuffer bufs[4];
|
SecBuffer bufs[4];
|
||||||
SecBufferDesc buf_desc = {SECBUFFER_VERSION, sizeof(bufs)/sizeof(*bufs), bufs};
|
SecBufferDesc buf_desc = {SECBUFFER_VERSION, ARRAY_SIZE(bufs), bufs};
|
||||||
SSIZE_T size, buf_len;
|
SSIZE_T size, buf_len;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
SECURITY_STATUS res;
|
SECURITY_STATUS res;
|
||||||
|
@ -672,7 +499,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, SIZE_T *
|
||||||
}
|
}
|
||||||
} while(res != SEC_E_OK);
|
} while(res != SEC_E_OK);
|
||||||
|
|
||||||
for(i=0; i < sizeof(bufs)/sizeof(*bufs); i++) {
|
for(i = 0; i < ARRAY_SIZE(bufs); i++) {
|
||||||
if(bufs[i].BufferType == SECBUFFER_DATA) {
|
if(bufs[i].BufferType == SECBUFFER_DATA) {
|
||||||
size = min(buf_size, bufs[i].cbBuffer);
|
size = min(buf_size, bufs[i].cbBuffer);
|
||||||
memcpy(buf, bufs[i].pvBuffer, size);
|
memcpy(buf, bufs[i].pvBuffer, size);
|
||||||
|
@ -689,7 +516,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, SIZE_T *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i < sizeof(bufs)/sizeof(*bufs); i++) {
|
for(i = 0; i < ARRAY_SIZE(bufs); i++) {
|
||||||
if(bufs[i].BufferType == SECBUFFER_EXTRA) {
|
if(bufs[i].BufferType == SECBUFFER_EXTRA) {
|
||||||
conn->extra_buf = heap_alloc(bufs[i].cbBuffer);
|
conn->extra_buf = heap_alloc(bufs[i].cbBuffer);
|
||||||
if(!conn->extra_buf)
|
if(!conn->extra_buf)
|
||||||
|
@ -703,7 +530,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, SIZE_T *
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL netconn_recv( netconn_t *conn, void *buf, size_t len, int flags, int *recvd )
|
BOOL netconn_recv( struct netconn *conn, void *buf, size_t len, int flags, int *recvd )
|
||||||
{
|
{
|
||||||
*recvd = 0;
|
*recvd = 0;
|
||||||
if (!len) return TRUE;
|
if (!len) return TRUE;
|
||||||
|
@ -752,101 +579,64 @@ BOOL netconn_recv( netconn_t *conn, void *buf, size_t len, int flags, int *recvd
|
||||||
*recvd = size;
|
*recvd = size;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if ((*recvd = sock_recv( conn->socket, buf, len, flags )) == -1)
|
return ((*recvd = sock_recv( conn->socket, buf, len, flags )) != -1);
|
||||||
{
|
|
||||||
set_last_error( sock_get_error( errno ) );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG netconn_query_data_available( netconn_t *conn )
|
ULONG netconn_query_data_available( struct netconn *conn )
|
||||||
{
|
{
|
||||||
return conn->secure ? conn->peek_len : 0;
|
return conn->secure ? conn->peek_len : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD netconn_set_timeout( netconn_t *netconn, BOOL send, int value )
|
DWORD netconn_set_timeout( struct netconn *netconn, BOOL send, int value )
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
int opt = send ? SO_SNDTIMEO : SO_RCVTIMEO;
|
||||||
|
if (setsockopt( netconn->socket, SOL_SOCKET, opt, (void *)&value, sizeof(value) ) == -1)
|
||||||
/* value is in milliseconds, convert to struct timeval */
|
|
||||||
tv.tv_sec = value / 1000;
|
|
||||||
tv.tv_usec = (value % 1000) * 1000;
|
|
||||||
|
|
||||||
if (setsockopt( netconn->socket, SOL_SOCKET, send ? SO_SNDTIMEO : SO_RCVTIMEO, (void*)&tv, sizeof(tv) ) == -1)
|
|
||||||
{
|
{
|
||||||
WARN("setsockopt failed (%s)\n", strerror( errno ));
|
DWORD err = WSAGetLastError();
|
||||||
return sock_get_error( errno );
|
WARN("setsockopt failed (%u)\n", err );
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL netconn_is_alive( netconn_t *netconn )
|
BOOL netconn_is_alive( struct netconn *netconn )
|
||||||
{
|
{
|
||||||
#ifdef MSG_DONTWAIT
|
|
||||||
ssize_t len;
|
|
||||||
BYTE b;
|
|
||||||
|
|
||||||
len = recv( netconn->socket, &b, 1, MSG_PEEK | MSG_DONTWAIT );
|
|
||||||
return len == 1 || (len == -1 && errno == EWOULDBLOCK);
|
|
||||||
#elif defined(__MINGW32__) || defined(_MSC_VER)
|
|
||||||
ULONG mode;
|
|
||||||
int len;
|
int len;
|
||||||
char b;
|
char b;
|
||||||
|
DWORD err;
|
||||||
|
|
||||||
mode = 1;
|
set_blocking( netconn, FALSE );
|
||||||
if(!ioctlsocket(netconn->socket, FIONBIO, &mode))
|
len = sock_recv( netconn->socket, &b, 1, MSG_PEEK );
|
||||||
return FALSE;
|
err = WSAGetLastError();
|
||||||
|
set_blocking( netconn, TRUE );
|
||||||
|
|
||||||
len = recv(netconn->socket, &b, 1, MSG_PEEK);
|
return len == 1 || (len == -1 && err == WSAEWOULDBLOCK);
|
||||||
|
|
||||||
mode = 0;
|
|
||||||
if(!ioctlsocket(netconn->socket, FIONBIO, &mode))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return len == 1 || (len == -1 && WSAGetLastError() == WSAEWOULDBLOCK);
|
|
||||||
#else
|
|
||||||
FIXME("not supported on this platform\n");
|
|
||||||
return TRUE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD resolve_hostname( const WCHAR *hostnameW, INTERNET_PORT port, struct sockaddr_storage *sa )
|
static DWORD resolve_hostname( const WCHAR *name, INTERNET_PORT port, struct sockaddr_storage *sa )
|
||||||
{
|
{
|
||||||
char *hostname;
|
ADDRINFOW *res, hints;
|
||||||
#ifdef HAVE_GETADDRINFO
|
|
||||||
struct addrinfo *res, hints;
|
|
||||||
int ret;
|
int ret;
|
||||||
#else
|
|
||||||
struct hostent *he;
|
|
||||||
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(hostname = strdupWA( hostnameW ))) return ERROR_OUTOFMEMORY;
|
memset( &hints, 0, sizeof(hints) );
|
||||||
|
|
||||||
#ifdef HAVE_GETADDRINFO
|
|
||||||
memset( &hints, 0, sizeof(struct addrinfo) );
|
|
||||||
/* Prefer IPv4 to IPv6 addresses, since some web servers do not listen on
|
/* Prefer IPv4 to IPv6 addresses, since some web servers do not listen on
|
||||||
* their IPv6 addresses even though they have IPv6 addresses in the DNS.
|
* their IPv6 addresses even though they have IPv6 addresses in the DNS.
|
||||||
*/
|
*/
|
||||||
hints.ai_family = AF_INET;
|
hints.ai_family = AF_INET;
|
||||||
|
|
||||||
ret = getaddrinfo( hostname, NULL, &hints, &res );
|
ret = GetAddrInfoW( name, NULL, &hints, &res );
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
TRACE("failed to get IPv4 address of %s (%s), retrying with IPv6\n", debugstr_w(hostnameW), gai_strerror(ret));
|
TRACE("failed to get IPv4 address of %s, retrying with IPv6\n", debugstr_w(name));
|
||||||
hints.ai_family = AF_INET6;
|
hints.ai_family = AF_INET6;
|
||||||
ret = getaddrinfo( hostname, NULL, &hints, &res );
|
ret = GetAddrInfoW( name, NULL, &hints, &res );
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
TRACE("failed to get address of %s (%s)\n", debugstr_w(hostnameW), gai_strerror(ret));
|
TRACE("failed to get address of %s\n", debugstr_w(name));
|
||||||
heap_free( hostname );
|
|
||||||
return ERROR_WINHTTP_NAME_NOT_RESOLVED;
|
return ERROR_WINHTTP_NAME_NOT_RESOLVED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
heap_free( hostname );
|
|
||||||
memcpy( sa, res->ai_addr, res->ai_addrlen );
|
memcpy( sa, res->ai_addr, res->ai_addrlen );
|
||||||
/* Copy port */
|
|
||||||
switch (res->ai_family)
|
switch (res->ai_family)
|
||||||
{
|
{
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
|
@ -857,28 +647,11 @@ static DWORD resolve_hostname( const WCHAR *hostnameW, INTERNET_PORT port, struc
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
freeaddrinfo( res );
|
FreeAddrInfoW( res );
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
#else
|
|
||||||
EnterCriticalSection( &cs_gethostbyname );
|
|
||||||
|
|
||||||
he = gethostbyname( hostname );
|
|
||||||
heap_free( hostname );
|
|
||||||
if (!he)
|
|
||||||
{
|
|
||||||
TRACE("failed to get address of %s (%d)\n", debugstr_w(hostnameW), h_errno);
|
|
||||||
LeaveCriticalSection( &cs_gethostbyname );
|
|
||||||
return ERROR_WINHTTP_NAME_NOT_RESOLVED;
|
|
||||||
}
|
}
|
||||||
memset( sa, 0, sizeof(struct sockaddr_in) );
|
|
||||||
memcpy( &sin->sin_addr, he->h_addr, he->h_length );
|
|
||||||
sin->sin_family = he->h_addrtype;
|
|
||||||
sin->sin_port = htons( port );
|
|
||||||
|
|
||||||
LeaveCriticalSection( &cs_gethostbyname );
|
#ifdef __REACTOS__
|
||||||
return ERROR_SUCCESS;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
struct resolve_args
|
struct resolve_args
|
||||||
{
|
{
|
||||||
|
@ -919,13 +692,64 @@ BOOL netconn_resolve( WCHAR *hostname, INTERNET_PORT port, struct sockaddr_stora
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
set_last_error( ret );
|
SetLastError( ret );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const void *netconn_get_certificate( netconn_t *conn )
|
#else /* __REACTOS__ */
|
||||||
|
|
||||||
|
struct async_resolve
|
||||||
|
{
|
||||||
|
const WCHAR *hostname;
|
||||||
|
INTERNET_PORT port;
|
||||||
|
struct sockaddr_storage *addr;
|
||||||
|
DWORD result;
|
||||||
|
HANDLE done;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void CALLBACK resolve_proc( TP_CALLBACK_INSTANCE *instance, void *ctx )
|
||||||
|
{
|
||||||
|
struct async_resolve *async = ctx;
|
||||||
|
async->result = resolve_hostname( async->hostname, async->port, async->addr );
|
||||||
|
SetEvent( async->done );
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL netconn_resolve( WCHAR *hostname, INTERNET_PORT port, struct sockaddr_storage *addr, int timeout )
|
||||||
|
{
|
||||||
|
DWORD ret;
|
||||||
|
|
||||||
|
if (!timeout) ret = resolve_hostname( hostname, port, addr );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
struct async_resolve async;
|
||||||
|
|
||||||
|
async.hostname = hostname;
|
||||||
|
async.port = port;
|
||||||
|
async.addr = addr;
|
||||||
|
if (!(async.done = CreateEventW( NULL, FALSE, FALSE, NULL ))) return FALSE;
|
||||||
|
if (!TrySubmitThreadpoolCallback( resolve_proc, &async, NULL ))
|
||||||
|
{
|
||||||
|
CloseHandle( async.done );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (WaitForSingleObject( async.done, timeout ) != WAIT_OBJECT_0) ret = ERROR_WINHTTP_TIMEOUT;
|
||||||
|
else ret = async.result;
|
||||||
|
CloseHandle( async.done );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
SetLastError( ret );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __REACTOS__ */
|
||||||
|
|
||||||
|
const void *netconn_get_certificate( struct netconn *conn )
|
||||||
{
|
{
|
||||||
const CERT_CONTEXT *ret;
|
const CERT_CONTEXT *ret;
|
||||||
SECURITY_STATUS res;
|
SECURITY_STATUS res;
|
||||||
|
@ -935,7 +759,7 @@ const void *netconn_get_certificate( netconn_t *conn )
|
||||||
return res == SEC_E_OK ? ret : NULL;
|
return res == SEC_E_OK ? ret : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int netconn_get_cipher_strength( netconn_t *conn )
|
int netconn_get_cipher_strength( struct netconn *conn )
|
||||||
{
|
{
|
||||||
SecPkgContext_ConnectionInfo conn_info;
|
SecPkgContext_ConnectionInfo conn_info;
|
||||||
SECURITY_STATUS res;
|
SECURITY_STATUS res;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -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);
|
||||||
|
@ -34,27 +34,33 @@ WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
|
||||||
static const WCHAR scheme_http[] = {'h','t','t','p',0};
|
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_https[] = {'h','t','t','p','s',0};
|
||||||
|
|
||||||
static DWORD set_component( WCHAR **str, DWORD *str_len, WCHAR *value, DWORD len, DWORD flags, BOOL *overflow )
|
struct url_component
|
||||||
{
|
{
|
||||||
if (*str && !*str_len) return ERROR_INVALID_PARAMETER;
|
WCHAR **str;
|
||||||
if (!*str_len) return ERROR_SUCCESS;
|
DWORD *len;
|
||||||
if (!*str)
|
};
|
||||||
|
|
||||||
|
static DWORD set_component( struct url_component *comp, WCHAR *value, DWORD len, DWORD flags, BOOL *overflow )
|
||||||
{
|
{
|
||||||
if (len && *str_len && (flags & (ICU_DECODE|ICU_ESCAPE))) return ERROR_INVALID_PARAMETER;
|
if (*comp->str && !*comp->len) return ERROR_INVALID_PARAMETER;
|
||||||
*str = value;
|
if (!*comp->len) return ERROR_SUCCESS;
|
||||||
*str_len = len;
|
if (!*comp->str)
|
||||||
|
{
|
||||||
|
if (len && *comp->len && (flags & (ICU_DECODE|ICU_ESCAPE))) return ERROR_INVALID_PARAMETER;
|
||||||
|
*comp->str = value;
|
||||||
|
*comp->len = len;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (len >= *str_len)
|
if (len >= *comp->len)
|
||||||
{
|
{
|
||||||
*str_len = len+1;
|
*comp->len = len + 1;
|
||||||
*overflow = TRUE;
|
*overflow = TRUE;
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
memcpy( *str, value, len * sizeof(WCHAR) );
|
memcpy( *comp->str, value, len * sizeof(WCHAR) );
|
||||||
(*str)[len] = 0;
|
(*comp->str)[len] = 0;
|
||||||
*str_len = len;
|
*comp->len = len;
|
||||||
}
|
}
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -87,81 +93,71 @@ static WCHAR *decode_url( LPCWSTR url, DWORD *len )
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL need_escape( WCHAR c )
|
static inline BOOL need_escape( WCHAR ch )
|
||||||
{
|
{
|
||||||
if (isalnumW( c )) return FALSE;
|
static const WCHAR escapes[] = {' ','"','#','%','<','>','[','\\',']','^','`','{','|','}','~',0};
|
||||||
|
const WCHAR *p = escapes;
|
||||||
|
|
||||||
if (c <= 31 || c >= 127) return TRUE;
|
if (ch <= 31 || ch >= 127) return TRUE;
|
||||||
else
|
while (*p)
|
||||||
{
|
{
|
||||||
switch (c)
|
if (ch == *p++) return TRUE;
|
||||||
{
|
}
|
||||||
case ' ':
|
|
||||||
case '"':
|
|
||||||
case '#':
|
|
||||||
case '%':
|
|
||||||
case '<':
|
|
||||||
case '>':
|
|
||||||
case ']':
|
|
||||||
case '\\':
|
|
||||||
case '[':
|
|
||||||
case '^':
|
|
||||||
case '`':
|
|
||||||
case '{':
|
|
||||||
case '|':
|
|
||||||
case '}':
|
|
||||||
case '~':
|
|
||||||
return TRUE;
|
|
||||||
default:
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static DWORD copy_escape( WCHAR *dst, const WCHAR *src, DWORD len )
|
static BOOL escape_string( const WCHAR *src, DWORD src_len, WCHAR *dst, DWORD *dst_len )
|
||||||
{
|
{
|
||||||
static const WCHAR hex[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
|
static const WCHAR hex[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
|
||||||
DWORD ret = len;
|
|
||||||
unsigned int i;
|
|
||||||
WCHAR *p = dst;
|
WCHAR *p = dst;
|
||||||
|
DWORD i;
|
||||||
|
|
||||||
for (i = 0; i < len; i++, p++)
|
*dst_len = src_len;
|
||||||
|
for (i = 0; i < src_len; i++)
|
||||||
{
|
{
|
||||||
|
if (src[i] > 0xff) return FALSE;
|
||||||
if (need_escape( src[i] ))
|
if (need_escape( src[i] ))
|
||||||
|
{
|
||||||
|
if (dst)
|
||||||
{
|
{
|
||||||
p[0] = '%';
|
p[0] = '%';
|
||||||
p[1] = hex[(src[i] >> 4) & 0xf];
|
p[1] = hex[(src[i] >> 4) & 0xf];
|
||||||
p[2] = hex[src[i] & 0xf];
|
p[2] = hex[src[i] & 0xf];
|
||||||
ret += 2;
|
p += 3;
|
||||||
p += 2;
|
|
||||||
}
|
}
|
||||||
else *p = src[i];
|
*dst_len += 2;
|
||||||
}
|
}
|
||||||
dst[ret] = 0;
|
else if (dst) *p++ = src[i];
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static WCHAR *escape_url( LPCWSTR url, DWORD *len )
|
if (dst) dst[*dst_len] = 0;
|
||||||
{
|
return TRUE;
|
||||||
WCHAR *ret;
|
}
|
||||||
const WCHAR *p, *q;
|
|
||||||
|
|
||||||
if ((p = q = strrchrW( url, '/' )))
|
static DWORD escape_url( const WCHAR *url, DWORD *len, WCHAR **ret )
|
||||||
{
|
{
|
||||||
while (*q)
|
const WCHAR *p;
|
||||||
|
DWORD len_base, len_path;
|
||||||
|
|
||||||
|
if ((p = strrchrW( url, '/' )))
|
||||||
{
|
{
|
||||||
if (need_escape( *q )) *len += 2;
|
len_base = p - url;
|
||||||
q++;
|
if (!escape_string( p, *len - len_base, NULL, &len_path )) return ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!(ret = heap_alloc( (*len + 1) * sizeof(WCHAR) ))) return NULL;
|
|
||||||
if (!p) strcpyW( ret, url );
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memcpy( ret, url, (p - url) * sizeof(WCHAR) );
|
len_base = *len;
|
||||||
copy_escape( ret + (p - url), p, q - p );
|
len_path = 0;
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
|
if (!(*ret = heap_alloc( (len_base + len_path + 1) * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY;
|
||||||
|
memcpy( *ret, url, len_base * sizeof(WCHAR) );
|
||||||
|
|
||||||
|
if (p) escape_string( p, *len - (p - url), *ret + len_base, &len_path );
|
||||||
|
(*ret)[len_base + len_path] = 0;
|
||||||
|
|
||||||
|
*len = len_base + len_path;
|
||||||
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD parse_port( const WCHAR *str, DWORD len, INTERNET_PORT *ret )
|
static DWORD parse_port( const WCHAR *str, DWORD len, INTERNET_PORT *ret )
|
||||||
|
@ -183,24 +179,25 @@ static DWORD parse_port( const WCHAR *str, DWORD len, INTERNET_PORT *ret )
|
||||||
BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONENTSW uc )
|
BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONENTSW uc )
|
||||||
{
|
{
|
||||||
WCHAR *p, *q, *r, *url_decoded = NULL, *url_escaped = NULL;
|
WCHAR *p, *q, *r, *url_decoded = NULL, *url_escaped = NULL;
|
||||||
INTERNET_SCHEME scheme = 0;
|
INTERNET_SCHEME scheme_number = 0;
|
||||||
|
struct url_component scheme, username, password, hostname, path, extra;
|
||||||
BOOL overflow = FALSE;
|
BOOL overflow = FALSE;
|
||||||
DWORD err;
|
DWORD err;
|
||||||
|
|
||||||
TRACE("%s, %d, %x, %p\n", debugstr_wn(url, len), len, flags, uc);
|
TRACE("%s, %d, %x, %p\n", debugstr_wn(url, len), len, flags, uc);
|
||||||
|
|
||||||
if (!url || !uc || uc->dwStructSize != sizeof(URL_COMPONENTS))
|
if (!url || !uc || uc->dwStructSize != sizeof(*uc))
|
||||||
{
|
{
|
||||||
set_last_error( ERROR_INVALID_PARAMETER );
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!len) len = strlenW( url );
|
if (!len) len = strlenW( url );
|
||||||
|
|
||||||
if (flags & ICU_ESCAPE)
|
if (flags & ICU_ESCAPE)
|
||||||
{
|
{
|
||||||
if (!(url_escaped = escape_url( url, &len )))
|
if ((err = escape_url( url, &len, &url_escaped )))
|
||||||
{
|
{
|
||||||
set_last_error( ERROR_OUTOFMEMORY );
|
SetLastError( err );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
url = url_escaped;
|
url = url_escaped;
|
||||||
|
@ -209,25 +206,28 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
|
||||||
{
|
{
|
||||||
if (!(url_decoded = decode_url( url, &len )))
|
if (!(url_decoded = decode_url( url, &len )))
|
||||||
{
|
{
|
||||||
set_last_error( ERROR_OUTOFMEMORY );
|
SetLastError( ERROR_OUTOFMEMORY );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
url = url_decoded;
|
url = url_decoded;
|
||||||
}
|
}
|
||||||
if (!(p = strchrW( url, ':' )))
|
if (!(p = strchrW( url, ':' )))
|
||||||
{
|
{
|
||||||
set_last_error( ERROR_WINHTTP_UNRECOGNIZED_SCHEME );
|
SetLastError( ERROR_WINHTTP_UNRECOGNIZED_SCHEME );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (p - url == 4 && !strncmpiW( url, scheme_http, 4 )) scheme = INTERNET_SCHEME_HTTP;
|
if (p - url == 4 && !strncmpiW( url, scheme_http, 4 )) scheme_number = INTERNET_SCHEME_HTTP;
|
||||||
else if (p - url == 5 && !strncmpiW( url, scheme_https, 5 )) scheme = INTERNET_SCHEME_HTTPS;
|
else if (p - url == 5 && !strncmpiW( url, scheme_https, 5 )) scheme_number = INTERNET_SCHEME_HTTPS;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
err = ERROR_WINHTTP_UNRECOGNIZED_SCHEME;
|
err = ERROR_WINHTTP_UNRECOGNIZED_SCHEME;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err = set_component( &uc->lpszScheme, &uc->dwSchemeLength, (WCHAR *)url, p - url, flags, &overflow ))) goto exit;
|
scheme.str = &uc->lpszScheme;
|
||||||
|
scheme.len = &uc->dwSchemeLength;
|
||||||
|
|
||||||
|
if ((err = set_component( &scheme, (WCHAR *)url, p - url, flags, &overflow ))) goto exit;
|
||||||
|
|
||||||
p++; /* skip ':' */
|
p++; /* skip ':' */
|
||||||
if (!p[0] || p[0] != '/' || p[1] != '/')
|
if (!p[0] || p[0] != '/' || p[1] != '/')
|
||||||
|
@ -241,83 +241,105 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
|
||||||
err = ERROR_WINHTTP_INVALID_URL;
|
err = ERROR_WINHTTP_INVALID_URL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
username.str = &uc->lpszUserName;
|
||||||
|
username.len = &uc->dwUserNameLength;
|
||||||
|
|
||||||
|
password.str = &uc->lpszPassword;
|
||||||
|
password.len = &uc->dwPasswordLength;
|
||||||
|
|
||||||
if ((q = memchrW( p, '@', len - (p - url) )) && !(memchrW( p, '/', q - p )))
|
if ((q = memchrW( p, '@', len - (p - url) )) && !(memchrW( p, '/', q - p )))
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((r = memchrW( p, ':', q - p )))
|
if ((r = memchrW( p, ':', q - p )))
|
||||||
{
|
{
|
||||||
if ((err = set_component( &uc->lpszUserName, &uc->dwUserNameLength, p, r - p, flags, &overflow ))) goto exit;
|
if ((err = set_component( &username, p, r - p, flags, &overflow ))) goto exit;
|
||||||
r++;
|
r++;
|
||||||
if ((err = set_component( &uc->lpszPassword, &uc->dwPasswordLength, r, q - r, flags, &overflow ))) goto exit;
|
if ((err = set_component( &password, r, q - r, flags, &overflow ))) goto exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((err = set_component( &uc->lpszUserName, &uc->dwUserNameLength, p, q - p, flags, &overflow ))) goto exit;
|
if ((err = set_component( &username, p, q - p, flags, &overflow ))) goto exit;
|
||||||
if ((err = set_component( &uc->lpszPassword, &uc->dwPasswordLength, NULL, 0, flags, &overflow ))) goto exit;
|
if ((err = set_component( &password, NULL, 0, flags, &overflow ))) goto exit;
|
||||||
}
|
}
|
||||||
p = q + 1;
|
p = q + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((err = set_component( &uc->lpszUserName, &uc->dwUserNameLength, NULL, 0, flags, &overflow ))) goto exit;
|
if ((err = set_component( &username, NULL, 0, flags, &overflow ))) goto exit;
|
||||||
if ((err = set_component( &uc->lpszPassword, &uc->dwPasswordLength, NULL, 0, flags, &overflow ))) goto exit;
|
if ((err = set_component( &password, NULL, 0, flags, &overflow ))) goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hostname.str = &uc->lpszHostName;
|
||||||
|
hostname.len = &uc->dwHostNameLength;
|
||||||
|
|
||||||
|
path.str = &uc->lpszUrlPath;
|
||||||
|
path.len = &uc->dwUrlPathLength;
|
||||||
|
|
||||||
|
extra.str = &uc->lpszExtraInfo;
|
||||||
|
extra.len = &uc->dwExtraInfoLength;
|
||||||
|
|
||||||
if ((q = memchrW( p, '/', len - (p - url) )))
|
if ((q = memchrW( p, '/', len - (p - url) )))
|
||||||
{
|
{
|
||||||
if ((r = memchrW( p, ':', q - p )))
|
if ((r = memchrW( p, ':', q - p )))
|
||||||
{
|
{
|
||||||
if ((err = set_component( &uc->lpszHostName, &uc->dwHostNameLength, p, r - p, flags, &overflow ))) goto exit;
|
if ((err = set_component( &hostname, p, r - p, flags, &overflow ))) goto exit;
|
||||||
r++;
|
r++;
|
||||||
if ((err = parse_port( r, q - r, &uc->nPort ))) goto exit;
|
if ((err = parse_port( r, q - r, &uc->nPort ))) goto exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((err = set_component( &uc->lpszHostName, &uc->dwHostNameLength, p, q - p, flags, &overflow ))) goto exit;
|
if ((err = set_component( &hostname, p, q - p, flags, &overflow ))) goto exit;
|
||||||
if (scheme == INTERNET_SCHEME_HTTP) uc->nPort = INTERNET_DEFAULT_HTTP_PORT;
|
if (scheme_number == INTERNET_SCHEME_HTTP) uc->nPort = INTERNET_DEFAULT_HTTP_PORT;
|
||||||
if (scheme == INTERNET_SCHEME_HTTPS) uc->nPort = INTERNET_DEFAULT_HTTPS_PORT;
|
if (scheme_number == INTERNET_SCHEME_HTTPS) uc->nPort = INTERNET_DEFAULT_HTTPS_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((r = memchrW( q, '?', len - (q - url) )))
|
if ((r = memchrW( q, '?', len - (q - url) )))
|
||||||
{
|
{
|
||||||
if ((err = set_component( &uc->lpszUrlPath, &uc->dwUrlPathLength, q, r - q, flags, &overflow ))) goto exit;
|
if (*extra.len)
|
||||||
if ((err = set_component( &uc->lpszExtraInfo, &uc->dwExtraInfoLength, r, len - (r - url), flags, &overflow ))) goto exit;
|
{
|
||||||
|
if ((err = set_component( &path, q, r - q, flags, &overflow ))) goto exit;
|
||||||
|
if ((err = set_component( &extra, r, len - (r - url), flags, &overflow ))) goto exit;
|
||||||
|
}
|
||||||
|
else if ((err = set_component( &path, q, len - (q - url), flags, &overflow ))) goto exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((err = set_component( &uc->lpszUrlPath, &uc->dwUrlPathLength, q, len - (q - url), flags, &overflow ))) goto exit;
|
if ((err = set_component( &path, q, len - (q - url), flags, &overflow ))) goto exit;
|
||||||
if ((err = set_component( &uc->lpszExtraInfo, &uc->dwExtraInfoLength, (WCHAR *)url + len, 0, flags, &overflow ))) goto exit;
|
if ((err = set_component( &extra, (WCHAR *)url + len, 0, flags, &overflow ))) goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((r = memchrW( p, ':', len - (p - url) )))
|
if ((r = memchrW( p, ':', len - (p - url) )))
|
||||||
{
|
{
|
||||||
if ((err = set_component( &uc->lpszHostName, &uc->dwHostNameLength, p, r - p, flags, &overflow ))) goto exit;
|
if ((err = set_component( &hostname, p, r - p, flags, &overflow ))) goto exit;
|
||||||
r++;
|
r++;
|
||||||
if ((err = parse_port( r, len - (r - url), &uc->nPort ))) goto exit;
|
if ((err = parse_port( r, len - (r - url), &uc->nPort ))) goto exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((err = set_component( &uc->lpszHostName, &uc->dwHostNameLength, p, len - (p - url), flags, &overflow ))) goto exit;
|
if ((err = set_component( &hostname, p, len - (p - url), flags, &overflow ))) goto exit;
|
||||||
if (scheme == INTERNET_SCHEME_HTTP) uc->nPort = INTERNET_DEFAULT_HTTP_PORT;
|
if (scheme_number == INTERNET_SCHEME_HTTP) uc->nPort = INTERNET_DEFAULT_HTTP_PORT;
|
||||||
if (scheme == INTERNET_SCHEME_HTTPS) uc->nPort = INTERNET_DEFAULT_HTTPS_PORT;
|
if (scheme_number == INTERNET_SCHEME_HTTPS) uc->nPort = INTERNET_DEFAULT_HTTPS_PORT;
|
||||||
}
|
}
|
||||||
if ((err = set_component( &uc->lpszUrlPath, &uc->dwUrlPathLength, (WCHAR *)url + len, 0, flags, &overflow ))) goto exit;
|
if ((err = set_component( &path, (WCHAR *)url + len, 0, flags, &overflow ))) goto exit;
|
||||||
if ((err = set_component( &uc->lpszExtraInfo, &uc->dwExtraInfoLength, (WCHAR *)url + len, 0, flags, &overflow ))) goto exit;
|
if ((err = set_component( &extra, (WCHAR *)url + len, 0, flags, &overflow ))) goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("scheme(%s) host(%s) port(%d) path(%s) extra(%s)\n", debugstr_wn( uc->lpszScheme, uc->dwSchemeLength ),
|
TRACE("scheme(%s) host(%s) port(%d) path(%s) extra(%s)\n", debugstr_wn(*scheme.str, *scheme.len),
|
||||||
debugstr_wn( uc->lpszHostName, uc->dwHostNameLength ), uc->nPort, debugstr_wn( uc->lpszUrlPath, uc->dwUrlPathLength ),
|
debugstr_wn(*hostname.str, *hostname.len ), uc->nPort, debugstr_wn(*path.str, *path.len),
|
||||||
debugstr_wn( uc->lpszExtraInfo, uc->dwExtraInfoLength ));
|
debugstr_wn(*extra.str, *extra.len));
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
if (overflow) err = ERROR_INSUFFICIENT_BUFFER;
|
if (overflow) err = ERROR_INSUFFICIENT_BUFFER;
|
||||||
uc->nScheme = scheme;
|
uc->nScheme = scheme_number;
|
||||||
}
|
}
|
||||||
heap_free( url_decoded );
|
heap_free( url_decoded );
|
||||||
heap_free( url_escaped );
|
heap_free( url_escaped );
|
||||||
set_last_error( err );
|
SetLastError( err );
|
||||||
return !err;
|
return !err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +364,7 @@ static BOOL uses_default_port( INTERNET_SCHEME scheme, INTERNET_PORT port )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD comp_length( DWORD len, DWORD flags, WCHAR *comp )
|
static DWORD get_comp_length( DWORD len, DWORD flags, WCHAR *comp )
|
||||||
{
|
{
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -353,7 +375,7 @@ static DWORD comp_length( DWORD len, DWORD flags, WCHAR *comp )
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL calc_length( URL_COMPONENTS *uc, DWORD flags, LPDWORD len )
|
static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len )
|
||||||
{
|
{
|
||||||
static const WCHAR formatW[] = {'%','u',0};
|
static const WCHAR formatW[] = {'%','u',0};
|
||||||
INTERNET_SCHEME scheme;
|
INTERNET_SCHEME scheme;
|
||||||
|
@ -361,7 +383,7 @@ static BOOL calc_length( URL_COMPONENTS *uc, DWORD flags, LPDWORD len )
|
||||||
*len = 0;
|
*len = 0;
|
||||||
if (uc->lpszScheme)
|
if (uc->lpszScheme)
|
||||||
{
|
{
|
||||||
DWORD scheme_len = comp_length( uc->dwSchemeLength, 0, uc->lpszScheme );
|
DWORD scheme_len = get_comp_length( uc->dwSchemeLength, 0, uc->lpszScheme );
|
||||||
*len += scheme_len;
|
*len += scheme_len;
|
||||||
scheme = get_scheme( uc->lpszScheme, scheme_len );
|
scheme = get_scheme( uc->lpszScheme, scheme_len );
|
||||||
}
|
}
|
||||||
|
@ -371,30 +393,29 @@ static BOOL calc_length( URL_COMPONENTS *uc, DWORD flags, LPDWORD len )
|
||||||
if (!scheme) scheme = INTERNET_SCHEME_HTTP;
|
if (!scheme) scheme = INTERNET_SCHEME_HTTP;
|
||||||
*len += strlenW( get_scheme_string( scheme ) );
|
*len += strlenW( get_scheme_string( scheme ) );
|
||||||
}
|
}
|
||||||
*len += 1; /* ':' */
|
*len += 3; /* "://" */
|
||||||
if (uc->lpszHostName) *len += 2; /* "//" */
|
|
||||||
|
|
||||||
if (uc->lpszUserName)
|
if (uc->lpszUserName)
|
||||||
{
|
{
|
||||||
*len += comp_length( uc->dwUserNameLength, 0, uc->lpszUserName );
|
*len += get_comp_length( uc->dwUserNameLength, 0, uc->lpszUserName );
|
||||||
*len += 1; /* "@" */
|
*len += 1; /* "@" */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (uc->lpszPassword)
|
if (uc->lpszPassword)
|
||||||
{
|
{
|
||||||
set_last_error( ERROR_INVALID_PARAMETER );
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (uc->lpszPassword)
|
if (uc->lpszPassword)
|
||||||
{
|
{
|
||||||
*len += 1; /* ":" */
|
*len += 1; /* ":" */
|
||||||
*len += comp_length( uc->dwPasswordLength, 0, uc->lpszPassword );
|
*len += get_comp_length( uc->dwPasswordLength, 0, uc->lpszPassword );
|
||||||
}
|
}
|
||||||
if (uc->lpszHostName)
|
if (uc->lpszHostName)
|
||||||
{
|
{
|
||||||
*len += comp_length( uc->dwHostNameLength, 0, uc->lpszHostName );
|
*len += get_comp_length( uc->dwHostNameLength, 0, uc->lpszHostName );
|
||||||
|
|
||||||
if (!uses_default_port( scheme, uc->nPort ))
|
if (!uses_default_port( scheme, uc->nPort ))
|
||||||
{
|
{
|
||||||
|
@ -405,8 +426,8 @@ static BOOL calc_length( URL_COMPONENTS *uc, DWORD flags, LPDWORD len )
|
||||||
}
|
}
|
||||||
if (uc->lpszUrlPath && *uc->lpszUrlPath != '/') *len += 1; /* '/' */
|
if (uc->lpszUrlPath && *uc->lpszUrlPath != '/') *len += 1; /* '/' */
|
||||||
}
|
}
|
||||||
if (uc->lpszUrlPath) *len += comp_length( uc->dwUrlPathLength, flags, uc->lpszUrlPath );
|
if (uc->lpszUrlPath) *len += get_comp_length( uc->dwUrlPathLength, flags, uc->lpszUrlPath );
|
||||||
if (uc->lpszExtraInfo) *len += comp_length( uc->dwExtraInfoLength, flags, uc->lpszExtraInfo );
|
if (uc->lpszExtraInfo) *len += get_comp_length( uc->dwExtraInfoLength, flags, uc->lpszExtraInfo );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,29 +437,28 @@ static BOOL calc_length( URL_COMPONENTS *uc, DWORD flags, LPDWORD len )
|
||||||
BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDWORD required )
|
BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDWORD required )
|
||||||
{
|
{
|
||||||
static const WCHAR formatW[] = {'%','u',0};
|
static const WCHAR formatW[] = {'%','u',0};
|
||||||
static const WCHAR twoslashW[] = {'/','/'};
|
DWORD len, len_escaped;
|
||||||
DWORD len;
|
|
||||||
INTERNET_SCHEME scheme;
|
INTERNET_SCHEME scheme;
|
||||||
|
|
||||||
TRACE("%p, 0x%08x, %p, %p\n", uc, flags, url, required);
|
TRACE("%p, 0x%08x, %p, %p\n", uc, flags, url, required);
|
||||||
|
|
||||||
if (!uc || uc->dwStructSize != sizeof(URL_COMPONENTS) || !required)
|
if (!uc || uc->dwStructSize != sizeof(URL_COMPONENTS) || !required)
|
||||||
{
|
{
|
||||||
set_last_error( ERROR_INVALID_PARAMETER );
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!calc_length( uc, flags, &len )) return FALSE;
|
if (!get_url_length( uc, flags, &len )) return FALSE;
|
||||||
|
|
||||||
if (*required < len)
|
if (*required < len)
|
||||||
{
|
{
|
||||||
*required = len + 1;
|
*required = len + 1;
|
||||||
set_last_error( ERROR_INSUFFICIENT_BUFFER );
|
SetLastError( ERROR_INSUFFICIENT_BUFFER );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!url)
|
if (!url)
|
||||||
{
|
{
|
||||||
set_last_error( ERROR_INVALID_PARAMETER );
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +466,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
|
||||||
*required = len;
|
*required = len;
|
||||||
if (uc->lpszScheme)
|
if (uc->lpszScheme)
|
||||||
{
|
{
|
||||||
len = comp_length( uc->dwSchemeLength, 0, uc->lpszScheme );
|
len = get_comp_length( uc->dwSchemeLength, 0, uc->lpszScheme );
|
||||||
memcpy( url, uc->lpszScheme, len * sizeof(WCHAR) );
|
memcpy( url, uc->lpszScheme, len * sizeof(WCHAR) );
|
||||||
url += len;
|
url += len;
|
||||||
|
|
||||||
|
@ -465,58 +485,55 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
|
||||||
url += len;
|
url += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all schemes are followed by at least a colon */
|
*url++ = ':';
|
||||||
*url = ':';
|
*url++ = '/';
|
||||||
url++;
|
*url++ = '/';
|
||||||
|
|
||||||
if (uc->lpszHostName)
|
|
||||||
{
|
|
||||||
memcpy( url, twoslashW, sizeof(twoslashW) );
|
|
||||||
url += sizeof(twoslashW) / sizeof(twoslashW[0]);
|
|
||||||
}
|
|
||||||
if (uc->lpszUserName)
|
if (uc->lpszUserName)
|
||||||
{
|
{
|
||||||
len = comp_length( uc->dwUserNameLength, 0, uc->lpszUserName );
|
len = get_comp_length( uc->dwUserNameLength, 0, uc->lpszUserName );
|
||||||
memcpy( url, uc->lpszUserName, len * sizeof(WCHAR) );
|
memcpy( url, uc->lpszUserName, len * sizeof(WCHAR) );
|
||||||
url += len;
|
url += len;
|
||||||
|
|
||||||
if (uc->lpszPassword)
|
if (uc->lpszPassword)
|
||||||
{
|
{
|
||||||
*url = ':';
|
*url++ = ':';
|
||||||
url++;
|
len = get_comp_length( uc->dwPasswordLength, 0, uc->lpszPassword );
|
||||||
|
|
||||||
len = comp_length( uc->dwPasswordLength, 0, uc->lpszPassword );
|
|
||||||
memcpy( url, uc->lpszPassword, len * sizeof(WCHAR) );
|
memcpy( url, uc->lpszPassword, len * sizeof(WCHAR) );
|
||||||
url += len;
|
url += len;
|
||||||
}
|
}
|
||||||
*url = '@';
|
*url++ = '@';
|
||||||
url++;
|
|
||||||
}
|
}
|
||||||
if (uc->lpszHostName)
|
if (uc->lpszHostName)
|
||||||
{
|
{
|
||||||
len = comp_length( uc->dwHostNameLength, 0, uc->lpszHostName );
|
len = get_comp_length( uc->dwHostNameLength, 0, uc->lpszHostName );
|
||||||
memcpy( url, uc->lpszHostName, len * sizeof(WCHAR) );
|
memcpy( url, uc->lpszHostName, len * sizeof(WCHAR) );
|
||||||
url += len;
|
url += len;
|
||||||
|
|
||||||
if (!uses_default_port( scheme, uc->nPort ))
|
if (!uses_default_port( scheme, uc->nPort ))
|
||||||
{
|
{
|
||||||
*url = ':';
|
*url++ = ':';
|
||||||
url++;
|
|
||||||
|
|
||||||
url += sprintfW( url, formatW, uc->nPort );
|
url += sprintfW( url, formatW, uc->nPort );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add slash between hostname and path if necessary */
|
/* add slash between hostname and path if necessary */
|
||||||
if (uc->lpszUrlPath && *uc->lpszUrlPath != '/')
|
if (uc->lpszUrlPath && *uc->lpszUrlPath != '/')
|
||||||
{
|
{
|
||||||
*url = '/';
|
*url++ = '/';
|
||||||
url++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (uc->lpszUrlPath)
|
if (uc->lpszUrlPath)
|
||||||
{
|
{
|
||||||
len = comp_length( uc->dwUrlPathLength, 0, uc->lpszUrlPath );
|
len = get_comp_length( uc->dwUrlPathLength, 0, uc->lpszUrlPath );
|
||||||
if (flags & ICU_ESCAPE) url += copy_escape( url, uc->lpszUrlPath, len );
|
if (flags & ICU_ESCAPE)
|
||||||
|
{
|
||||||
|
if (!escape_string( uc->lpszUrlPath, len, url, &len_escaped ))
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
url += len_escaped;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memcpy( url, uc->lpszUrlPath, len * sizeof(WCHAR) );
|
memcpy( url, uc->lpszUrlPath, len * sizeof(WCHAR) );
|
||||||
|
@ -525,8 +542,16 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
|
||||||
}
|
}
|
||||||
if (uc->lpszExtraInfo)
|
if (uc->lpszExtraInfo)
|
||||||
{
|
{
|
||||||
len = comp_length( uc->dwExtraInfoLength, 0, uc->lpszExtraInfo );
|
len = get_comp_length( uc->dwExtraInfoLength, 0, uc->lpszExtraInfo );
|
||||||
if (flags & ICU_ESCAPE) url += copy_escape( url, uc->lpszExtraInfo, len );
|
if (flags & ICU_ESCAPE)
|
||||||
|
{
|
||||||
|
if (!escape_string( uc->lpszExtraInfo, len, url, &len_escaped ))
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
url += len_escaped;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memcpy( url, uc->lpszExtraInfo, len * sizeof(WCHAR) );
|
memcpy( url, uc->lpszExtraInfo, len * sizeof(WCHAR) );
|
||||||
|
@ -534,6 +559,6 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*url = 0;
|
*url = 0;
|
||||||
set_last_error( ERROR_SUCCESS );
|
SetLastError( ERROR_SUCCESS );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,25 +27,9 @@
|
||||||
#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"
|
||||||
|
|
||||||
static const WCHAR getW[] = {'G','E','T',0};
|
static const WCHAR getW[] = {'G','E','T',0};
|
||||||
static const WCHAR postW[] = {'P','O','S','T',0};
|
static const WCHAR postW[] = {'P','O','S','T',0};
|
||||||
|
@ -55,20 +39,19 @@ static const WCHAR http1_0[] = {'H','T','T','P','/','1','.','0',0};
|
||||||
static const WCHAR http1_1[] = {'H','T','T','P','/','1','.','1',0};
|
static const WCHAR http1_1[] = {'H','T','T','P','/','1','.','1',0};
|
||||||
static const WCHAR chunkedW[] = {'c','h','u','n','k','e','d',0};
|
static const WCHAR chunkedW[] = {'c','h','u','n','k','e','d',0};
|
||||||
|
|
||||||
typedef struct _object_header_t object_header_t;
|
struct object_header;
|
||||||
|
struct object_vtbl
|
||||||
typedef struct
|
|
||||||
{
|
{
|
||||||
void (*destroy)( object_header_t * );
|
void (*destroy)( struct object_header * );
|
||||||
BOOL (*query_option)( object_header_t *, DWORD, void *, DWORD * );
|
BOOL (*query_option)( struct object_header *, DWORD, void *, DWORD * );
|
||||||
BOOL (*set_option)( object_header_t *, DWORD, void *, DWORD );
|
BOOL (*set_option)( struct object_header *, DWORD, void *, DWORD );
|
||||||
} object_vtbl_t;
|
};
|
||||||
|
|
||||||
struct _object_header_t
|
struct object_header
|
||||||
{
|
{
|
||||||
DWORD type;
|
DWORD type;
|
||||||
HINTERNET handle;
|
HINTERNET handle;
|
||||||
const object_vtbl_t *vtbl;
|
const struct object_vtbl *vtbl;
|
||||||
DWORD flags;
|
DWORD flags;
|
||||||
DWORD disable_flags;
|
DWORD disable_flags;
|
||||||
DWORD logon_policy;
|
DWORD logon_policy;
|
||||||
|
@ -82,71 +65,58 @@ struct _object_header_t
|
||||||
struct list children;
|
struct list children;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
struct hostdata
|
||||||
{
|
{
|
||||||
struct list entry;
|
|
||||||
WCHAR *name;
|
|
||||||
struct list cookies;
|
|
||||||
} domain_t;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
struct list entry;
|
|
||||||
WCHAR *name;
|
|
||||||
WCHAR *value;
|
|
||||||
WCHAR *path;
|
|
||||||
} cookie_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
struct list entry;
|
struct list entry;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
WCHAR *hostname;
|
WCHAR *hostname;
|
||||||
INTERNET_PORT port;
|
INTERNET_PORT port;
|
||||||
BOOL secure;
|
BOOL secure;
|
||||||
struct list connections;
|
struct list connections;
|
||||||
} hostdata_t;
|
};
|
||||||
|
|
||||||
typedef struct
|
struct session
|
||||||
{
|
{
|
||||||
object_header_t hdr;
|
struct object_header hdr;
|
||||||
LPWSTR agent;
|
CRITICAL_SECTION cs;
|
||||||
|
WCHAR *agent;
|
||||||
DWORD access;
|
DWORD access;
|
||||||
int resolve_timeout;
|
int resolve_timeout;
|
||||||
int connect_timeout;
|
int connect_timeout;
|
||||||
int send_timeout;
|
int send_timeout;
|
||||||
int recv_timeout;
|
int receive_timeout;
|
||||||
LPWSTR proxy_server;
|
int receive_response_timeout;
|
||||||
LPWSTR proxy_bypass;
|
WCHAR *proxy_server;
|
||||||
LPWSTR proxy_username;
|
WCHAR *proxy_bypass;
|
||||||
LPWSTR proxy_password;
|
WCHAR *proxy_username;
|
||||||
|
WCHAR *proxy_password;
|
||||||
struct list cookie_cache;
|
struct list cookie_cache;
|
||||||
HANDLE unload_event;
|
HANDLE unload_event;
|
||||||
CredHandle cred_handle;
|
|
||||||
BOOL cred_handle_initialized;
|
|
||||||
DWORD secure_protocols;
|
DWORD secure_protocols;
|
||||||
} session_t;
|
DWORD passport_flags;
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct
|
struct connect
|
||||||
{
|
{
|
||||||
object_header_t hdr;
|
struct object_header hdr;
|
||||||
session_t *session;
|
struct session *session;
|
||||||
LPWSTR hostname; /* final destination of the request */
|
WCHAR *hostname; /* final destination of the request */
|
||||||
LPWSTR servername; /* name of the server we directly connect to */
|
WCHAR *servername; /* name of the server we directly connect to */
|
||||||
LPWSTR username;
|
WCHAR *username;
|
||||||
LPWSTR password;
|
WCHAR *password;
|
||||||
INTERNET_PORT hostport;
|
INTERNET_PORT hostport;
|
||||||
INTERNET_PORT serverport;
|
INTERNET_PORT serverport;
|
||||||
struct sockaddr_storage sockaddr;
|
struct sockaddr_storage sockaddr;
|
||||||
BOOL resolved;
|
BOOL resolved;
|
||||||
} connect_t;
|
};
|
||||||
|
|
||||||
typedef struct
|
struct netconn
|
||||||
{
|
{
|
||||||
struct list entry;
|
struct list entry;
|
||||||
int socket;
|
int socket;
|
||||||
struct sockaddr_storage sockaddr;
|
struct sockaddr_storage sockaddr;
|
||||||
BOOL secure; /* SSL active on connection? */
|
BOOL secure; /* SSL active on connection? */
|
||||||
hostdata_t *host;
|
struct hostdata *host;
|
||||||
ULONGLONG keep_until;
|
ULONGLONG keep_until;
|
||||||
CtxtHandle ssl_ctx;
|
CtxtHandle ssl_ctx;
|
||||||
SecPkgContext_StreamSizes ssl_sizes;
|
SecPkgContext_StreamSizes ssl_sizes;
|
||||||
|
@ -156,14 +126,14 @@ typedef struct
|
||||||
char *peek_msg;
|
char *peek_msg;
|
||||||
char *peek_msg_mem;
|
char *peek_msg_mem;
|
||||||
size_t peek_len;
|
size_t peek_len;
|
||||||
} netconn_t;
|
};
|
||||||
|
|
||||||
typedef struct
|
struct header
|
||||||
{
|
{
|
||||||
LPWSTR field;
|
WCHAR *field;
|
||||||
LPWSTR value;
|
WCHAR *value;
|
||||||
BOOL is_request; /* part of request headers? */
|
BOOL is_request; /* part of request headers? */
|
||||||
} header_t;
|
};
|
||||||
|
|
||||||
enum auth_target
|
enum auth_target
|
||||||
{
|
{
|
||||||
|
@ -197,23 +167,29 @@ struct authinfo
|
||||||
BOOL finished; /* finished authenticating */
|
BOOL finished; /* finished authenticating */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
struct request
|
||||||
{
|
{
|
||||||
object_header_t hdr;
|
struct object_header hdr;
|
||||||
connect_t *connect;
|
struct connect *connect;
|
||||||
LPWSTR verb;
|
WCHAR *verb;
|
||||||
LPWSTR path;
|
WCHAR *path;
|
||||||
LPWSTR version;
|
WCHAR *version;
|
||||||
LPWSTR raw_headers;
|
WCHAR *raw_headers;
|
||||||
void *optional;
|
void *optional;
|
||||||
DWORD optional_len;
|
DWORD optional_len;
|
||||||
netconn_t *netconn;
|
struct netconn *netconn;
|
||||||
DWORD security_flags;
|
DWORD security_flags;
|
||||||
|
BOOL check_revocation;
|
||||||
|
const CERT_CONTEXT *server_cert;
|
||||||
|
const CERT_CONTEXT *client_cert;
|
||||||
|
CredHandle cred_handle;
|
||||||
|
BOOL cred_handle_initialized;
|
||||||
int resolve_timeout;
|
int resolve_timeout;
|
||||||
int connect_timeout;
|
int connect_timeout;
|
||||||
int send_timeout;
|
int send_timeout;
|
||||||
int recv_timeout;
|
int receive_timeout;
|
||||||
LPWSTR status_text;
|
int receive_response_timeout;
|
||||||
|
WCHAR *status_text;
|
||||||
DWORD content_length; /* total number of bytes to be read */
|
DWORD content_length; /* total number of bytes to be read */
|
||||||
DWORD content_read; /* bytes read so far */
|
DWORD content_read; /* bytes read so far */
|
||||||
BOOL read_chunked; /* are we reading in chunked mode? */
|
BOOL read_chunked; /* are we reading in chunked mode? */
|
||||||
|
@ -222,13 +198,17 @@ typedef struct
|
||||||
DWORD read_pos; /* current read position in read_buf */
|
DWORD read_pos; /* current read position in read_buf */
|
||||||
DWORD read_size; /* valid data size in read_buf */
|
DWORD read_size; /* valid data size in read_buf */
|
||||||
char read_buf[8192]; /* buffer for already read but not returned data */
|
char read_buf[8192]; /* buffer for already read but not returned data */
|
||||||
header_t *headers;
|
struct header *headers;
|
||||||
DWORD num_headers;
|
DWORD num_headers;
|
||||||
struct authinfo *authinfo;
|
struct authinfo *authinfo;
|
||||||
struct authinfo *proxy_authinfo;
|
struct authinfo *proxy_authinfo;
|
||||||
HANDLE task_wait;
|
HANDLE task_wait;
|
||||||
HANDLE task_cancel;
|
HANDLE task_cancel;
|
||||||
|
#ifdef __REACTOS__
|
||||||
HANDLE task_thread;
|
HANDLE task_thread;
|
||||||
|
#else
|
||||||
|
BOOL task_proc_running;
|
||||||
|
#endif
|
||||||
struct list task_queue;
|
struct list task_queue;
|
||||||
CRITICAL_SECTION task_cs;
|
CRITICAL_SECTION task_cs;
|
||||||
struct
|
struct
|
||||||
|
@ -236,89 +216,84 @@ typedef struct
|
||||||
WCHAR *username;
|
WCHAR *username;
|
||||||
WCHAR *password;
|
WCHAR *password;
|
||||||
} creds[TARGET_MAX][SCHEME_MAX];
|
} creds[TARGET_MAX][SCHEME_MAX];
|
||||||
} request_t;
|
|
||||||
|
|
||||||
typedef struct _task_header_t task_header_t;
|
|
||||||
|
|
||||||
struct _task_header_t
|
|
||||||
{
|
|
||||||
struct list entry;
|
|
||||||
request_t *request;
|
|
||||||
void (*proc)( task_header_t * );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
struct task_header
|
||||||
{
|
{
|
||||||
task_header_t hdr;
|
struct list entry;
|
||||||
LPWSTR headers;
|
struct request *request;
|
||||||
|
void (*proc)( struct task_header * );
|
||||||
|
};
|
||||||
|
|
||||||
|
struct send_request
|
||||||
|
{
|
||||||
|
struct task_header hdr;
|
||||||
|
WCHAR *headers;
|
||||||
DWORD headers_len;
|
DWORD headers_len;
|
||||||
LPVOID optional;
|
void *optional;
|
||||||
DWORD optional_len;
|
DWORD optional_len;
|
||||||
DWORD total_len;
|
DWORD total_len;
|
||||||
DWORD_PTR context;
|
DWORD_PTR context;
|
||||||
} send_request_t;
|
};
|
||||||
|
|
||||||
typedef struct
|
struct receive_response
|
||||||
{
|
{
|
||||||
task_header_t hdr;
|
struct task_header hdr;
|
||||||
} receive_response_t;
|
};
|
||||||
|
|
||||||
typedef struct
|
struct query_data
|
||||||
{
|
{
|
||||||
task_header_t hdr;
|
struct task_header hdr;
|
||||||
LPDWORD available;
|
DWORD *available;
|
||||||
} query_data_t;
|
};
|
||||||
|
|
||||||
typedef struct
|
struct read_data
|
||||||
{
|
{
|
||||||
task_header_t hdr;
|
struct task_header hdr;
|
||||||
LPVOID buffer;
|
void *buffer;
|
||||||
DWORD to_read;
|
DWORD to_read;
|
||||||
LPDWORD read;
|
DWORD *read;
|
||||||
} read_data_t;
|
};
|
||||||
|
|
||||||
typedef struct
|
struct write_data
|
||||||
{
|
{
|
||||||
task_header_t hdr;
|
struct task_header hdr;
|
||||||
LPCVOID buffer;
|
const void *buffer;
|
||||||
DWORD to_write;
|
DWORD to_write;
|
||||||
LPDWORD written;
|
DWORD *written;
|
||||||
} write_data_t;
|
};
|
||||||
|
|
||||||
object_header_t *addref_object( object_header_t * ) DECLSPEC_HIDDEN;
|
struct object_header *addref_object( struct object_header * ) DECLSPEC_HIDDEN;
|
||||||
object_header_t *grab_object( HINTERNET ) DECLSPEC_HIDDEN;
|
struct object_header *grab_object( HINTERNET ) DECLSPEC_HIDDEN;
|
||||||
void release_object( object_header_t * ) DECLSPEC_HIDDEN;
|
void release_object( struct object_header * ) DECLSPEC_HIDDEN;
|
||||||
HINTERNET alloc_handle( object_header_t * ) DECLSPEC_HIDDEN;
|
HINTERNET alloc_handle( struct object_header * ) DECLSPEC_HIDDEN;
|
||||||
BOOL free_handle( HINTERNET ) DECLSPEC_HIDDEN;
|
BOOL free_handle( HINTERNET ) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
void set_last_error( DWORD ) DECLSPEC_HIDDEN;
|
void send_callback( struct object_header *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN;
|
||||||
DWORD get_last_error( void ) DECLSPEC_HIDDEN;
|
void close_connection( struct request * ) DECLSPEC_HIDDEN;
|
||||||
void send_callback( object_header_t *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN;
|
|
||||||
void close_connection( request_t * ) DECLSPEC_HIDDEN;
|
|
||||||
|
|
||||||
BOOL netconn_close( netconn_t * ) DECLSPEC_HIDDEN;
|
void netconn_close( struct netconn * ) DECLSPEC_HIDDEN;
|
||||||
netconn_t *netconn_create( hostdata_t *, const struct sockaddr_storage *, int ) DECLSPEC_HIDDEN;
|
struct netconn *netconn_create( struct hostdata *, 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( struct netconn * ) DECLSPEC_HIDDEN;
|
||||||
BOOL netconn_recv( netconn_t *, void *, size_t, int, int * ) DECLSPEC_HIDDEN;
|
BOOL netconn_recv( struct netconn *, void *, size_t, int, int * ) DECLSPEC_HIDDEN;
|
||||||
BOOL netconn_resolve( WCHAR *, INTERNET_PORT, struct sockaddr_storage *, int ) DECLSPEC_HIDDEN;
|
BOOL netconn_resolve( WCHAR *, INTERNET_PORT, struct sockaddr_storage *, int ) DECLSPEC_HIDDEN;
|
||||||
BOOL netconn_secure_connect( netconn_t *, WCHAR *, DWORD, CredHandle * ) DECLSPEC_HIDDEN;
|
BOOL netconn_secure_connect( struct netconn *, WCHAR *, DWORD, CredHandle *, BOOL ) DECLSPEC_HIDDEN;
|
||||||
BOOL netconn_send( netconn_t *, const void *, size_t, int * ) DECLSPEC_HIDDEN;
|
BOOL netconn_send( struct netconn *, const void *, size_t, int * ) DECLSPEC_HIDDEN;
|
||||||
DWORD netconn_set_timeout( netconn_t *, BOOL, int ) DECLSPEC_HIDDEN;
|
DWORD netconn_set_timeout( struct netconn *, BOOL, int ) DECLSPEC_HIDDEN;
|
||||||
BOOL netconn_is_alive( netconn_t * ) DECLSPEC_HIDDEN;
|
BOOL netconn_is_alive( struct netconn * ) DECLSPEC_HIDDEN;
|
||||||
const void *netconn_get_certificate( netconn_t * ) DECLSPEC_HIDDEN;
|
const void *netconn_get_certificate( struct netconn * ) DECLSPEC_HIDDEN;
|
||||||
int netconn_get_cipher_strength( netconn_t * ) DECLSPEC_HIDDEN;
|
int netconn_get_cipher_strength( struct netconn * ) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
BOOL set_cookies( request_t *, const WCHAR * ) DECLSPEC_HIDDEN;
|
BOOL set_cookies( struct request *, const WCHAR * ) DECLSPEC_HIDDEN;
|
||||||
BOOL add_cookie_headers( request_t * ) DECLSPEC_HIDDEN;
|
BOOL add_cookie_headers( struct request * ) DECLSPEC_HIDDEN;
|
||||||
BOOL add_request_headers( request_t *, LPCWSTR, DWORD, DWORD ) DECLSPEC_HIDDEN;
|
BOOL add_request_headers( struct request *, const WCHAR *, DWORD, DWORD ) DECLSPEC_HIDDEN;
|
||||||
void delete_domain( domain_t * ) DECLSPEC_HIDDEN;
|
void destroy_cookies( struct session * ) DECLSPEC_HIDDEN;
|
||||||
BOOL set_server_for_hostname( connect_t *, LPCWSTR, INTERNET_PORT ) DECLSPEC_HIDDEN;
|
BOOL set_server_for_hostname( struct connect *, const WCHAR *, INTERNET_PORT ) DECLSPEC_HIDDEN;
|
||||||
void destroy_authinfo( struct authinfo * ) DECLSPEC_HIDDEN;
|
void destroy_authinfo( struct authinfo * ) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
void release_host( hostdata_t *host ) DECLSPEC_HIDDEN;
|
void release_host( struct hostdata * ) DECLSPEC_HIDDEN;
|
||||||
|
BOOL process_header( struct request *, const WCHAR *, const WCHAR *, DWORD, BOOL ) 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;
|
extern HRESULT WinHttpRequest_create( void ** ) DECLSPEC_HIDDEN;
|
||||||
void release_typelib( void ) DECLSPEC_HIDDEN;
|
void release_typelib( void ) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -201,7 +201,7 @@ dll/win32/windowscodecs # Synced to WineStaging-4.18
|
||||||
dll/win32/windowscodecsext # Synced to WineStaging-2.9
|
dll/win32/windowscodecsext # Synced to WineStaging-2.9
|
||||||
dll/win32/winemp3.acm # Synced to WineStaging-4.18
|
dll/win32/winemp3.acm # Synced to WineStaging-4.18
|
||||||
dll/win32/wing32 # Synced to WineStaging-3.3
|
dll/win32/wing32 # Synced to WineStaging-3.3
|
||||||
dll/win32/winhttp # Synced to WineStaging-3.9
|
dll/win32/winhttp # Synced to WineStaging-4.18
|
||||||
dll/win32/wininet # Synced to WineStaging-3.9
|
dll/win32/wininet # Synced to WineStaging-3.9
|
||||||
dll/win32/winmm # Forked at Wine-20050628
|
dll/win32/winmm # Forked at Wine-20050628
|
||||||
dll/win32/winmm/midimap # Forked at Wine-20050628
|
dll/win32/winmm/midimap # Forked at Wine-20050628
|
||||||
|
|
Loading…
Reference in a new issue