mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +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 "ws2tcpip.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winhttp.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/list.h"
|
||||
#include "winhttp_private.h"
|
||||
|
||||
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->cookies );
|
||||
|
@ -46,14 +61,14 @@ static domain_t *add_domain( session_t *session, WCHAR *name )
|
|||
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;
|
||||
cookie_t *cookie;
|
||||
struct cookie *cookie;
|
||||
|
||||
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 ))
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
|
@ -72,7 +87,7 @@ static BOOL domain_match( const WCHAR *name, domain_t *domain, BOOL partial )
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void free_cookie( cookie_t *cookie )
|
||||
static void free_cookie( struct cookie *cookie )
|
||||
{
|
||||
heap_free( cookie->name );
|
||||
heap_free( cookie->value );
|
||||
|
@ -80,20 +95,20 @@ static void free_cookie( cookie_t *cookie )
|
|||
heap_free( cookie );
|
||||
}
|
||||
|
||||
static void delete_cookie( cookie_t *cookie )
|
||||
static void delete_cookie( struct cookie *cookie )
|
||||
{
|
||||
list_remove( &cookie->entry );
|
||||
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;
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
@ -102,35 +117,51 @@ void delete_domain( domain_t *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;
|
||||
cookie_t *old_cookie;
|
||||
struct list *item, *next;
|
||||
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;
|
||||
|
||||
if (!(cookie->path = strdupW( path ))) return FALSE;
|
||||
|
||||
EnterCriticalSection( &session->cs );
|
||||
|
||||
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;
|
||||
domain = NULL;
|
||||
}
|
||||
if (!domain)
|
||||
{
|
||||
if (!(domain = add_domain( session, domain_name ))) return FALSE;
|
||||
}
|
||||
if (!domain) domain = add_domain( session, domain_name );
|
||||
else if ((old_cookie = find_cookie( domain, path, cookie->name ))) delete_cookie( old_cookie );
|
||||
|
||||
cookie->path = strdupW( path );
|
||||
list_add_head( &domain->cookies, &cookie->entry );
|
||||
if (domain)
|
||||
{
|
||||
list_add_head( &domain->cookies, &cookie->entry );
|
||||
TRACE("domain %s path %s <- %s=%s\n", debugstr_w(domain_name), debugstr_w(cookie->path),
|
||||
debugstr_w(cookie->name), debugstr_w(cookie->value));
|
||||
}
|
||||
|
||||
TRACE("domain %s path %s <- %s=%s\n", debugstr_w(domain_name), debugstr_w(cookie->path),
|
||||
debugstr_w(cookie->name), debugstr_w(cookie->value));
|
||||
return TRUE;
|
||||
LeaveCriticalSection( &session->cs );
|
||||
return domain != NULL;
|
||||
}
|
||||
|
||||
static cookie_t *parse_cookie( const WCHAR *string )
|
||||
static struct cookie *parse_cookie( const WCHAR *string )
|
||||
{
|
||||
cookie_t *cookie;
|
||||
struct cookie *cookie;
|
||||
const WCHAR *p;
|
||||
int len;
|
||||
|
||||
|
@ -139,7 +170,7 @@ static cookie_t *parse_cookie( const WCHAR *string )
|
|||
while (len && string[len - 1] == ' ') len--;
|
||||
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 );
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 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 *cookie_domain = NULL, *cookie_path = NULL;
|
||||
struct attr *attr, *domain = NULL, *path = NULL;
|
||||
session_t *session = request->connect->session;
|
||||
cookie_t *cookie;
|
||||
struct session *session = request->connect->session;
|
||||
struct cookie *cookie;
|
||||
int len, used;
|
||||
|
||||
len = strlenW( cookies );
|
||||
|
@ -290,14 +321,16 @@ end:
|
|||
return ret;
|
||||
}
|
||||
|
||||
BOOL add_cookie_headers( request_t *request )
|
||||
BOOL add_cookie_headers( struct request *request )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ))
|
||||
{
|
||||
struct list *cookie_cursor;
|
||||
|
@ -305,19 +338,23 @@ BOOL add_cookie_headers( request_t *request )
|
|||
|
||||
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));
|
||||
|
||||
if (strstrW( request->path, cookie->path ) == request->path)
|
||||
{
|
||||
const WCHAR cookieW[] = {'C','o','o','k','i','e',':',' '};
|
||||
int len, len_cookie = sizeof(cookieW) / sizeof(cookieW[0]), len_name = strlenW( cookie->name );
|
||||
static const WCHAR cookieW[] = {'C','o','o','k','i','e',':',' '};
|
||||
int len, len_cookie = ARRAY_SIZE( cookieW ), len_name = strlenW( cookie->name );
|
||||
WCHAR *header;
|
||||
|
||||
len = len_cookie + len_name;
|
||||
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) );
|
||||
strcpyW( header + len_cookie, cookie->name );
|
||||
|
@ -335,5 +372,7 @@ BOOL add_cookie_headers( request_t *request )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
LeaveCriticalSection( &session->cs );
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -19,15 +19,14 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "ws2tcpip.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winhttp.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "winhttp_private.h"
|
||||
|
||||
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 object_header_t **handles;
|
||||
static struct object_header **handles;
|
||||
static ULONG_PTR next_handle;
|
||||
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 );
|
||||
TRACE("%p -> refcount = %d\n", hdr, refs);
|
||||
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;
|
||||
|
||||
EnterCriticalSection( &handle_cs );
|
||||
|
@ -70,13 +69,13 @@ object_header_t *grab_object( HINTERNET hinternet )
|
|||
return hdr;
|
||||
}
|
||||
|
||||
void release_object( object_header_t *hdr )
|
||||
void release_object( struct object_header *hdr )
|
||||
{
|
||||
ULONG refs = InterlockedDecrement( &hdr->refs );
|
||||
TRACE("object %p refcount = %d\n", hdr, 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) );
|
||||
|
||||
|
@ -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;
|
||||
|
||||
list_init( &hdr->children );
|
||||
|
@ -125,7 +124,7 @@ BOOL free_handle( HINTERNET hinternet )
|
|||
{
|
||||
BOOL ret = FALSE;
|
||||
ULONG_PTR handle = (ULONG_PTR)hinternet;
|
||||
object_header_t *hdr = NULL, *child, *next;
|
||||
struct object_header *hdr = NULL, *child, *next;
|
||||
|
||||
EnterCriticalSection( &handle_cs );
|
||||
|
||||
|
@ -145,7 +144,7 @@ BOOL free_handle( HINTERNET hinternet )
|
|||
|
||||
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);
|
||||
free_handle( child->handle );
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#define COBJMACROS
|
||||
#include "config.h"
|
||||
#include "ws2tcpip.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
|
|
|
@ -18,145 +18,31 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#define NONAMELESSUNION
|
||||
#include "ws2tcpip.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.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 "winbase.h"
|
||||
#include "winhttp.h"
|
||||
#include "wincrypt.h"
|
||||
#include "schannel.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/library.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() */
|
||||
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)
|
||||
{
|
||||
int ret;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -165,13 +51,13 @@ static int sock_recv(int fd, void *msg, size_t len, int flags)
|
|||
int ret;
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
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 ));
|
||||
chainPara.RequestedUsage.Usage.cUsageIdentifier = 1;
|
||||
chainPara.RequestedUsage.Usage.rgpszUsageIdentifier = server_auth;
|
||||
if ((ret = CertGetCertificateChain( NULL, cert, NULL, store, &chainPara,
|
||||
CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT,
|
||||
NULL, &chain )))
|
||||
ret = CertGetCertificateChain( NULL, cert, NULL, store, &chainPara,
|
||||
check_revocation ? CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT : 0,
|
||||
NULL, &chain );
|
||||
if (ret)
|
||||
{
|
||||
if (chain->TrustStatus.dwErrorStatus)
|
||||
{
|
||||
|
@ -264,46 +151,41 @@ static DWORD netconn_verify_cert( PCCERT_CONTEXT cert, WCHAR *server, DWORD secu
|
|||
return err;
|
||||
}
|
||||
|
||||
#ifdef __REACTOS__
|
||||
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
|
||||
static BOOL winsock_loaded;
|
||||
|
||||
void netconn_unload( void )
|
||||
{
|
||||
#ifndef HAVE_GETADDRINFO
|
||||
DeleteCriticalSection(&cs_gethostbyname);
|
||||
#endif
|
||||
#ifdef __REACTOS__
|
||||
if(winsock_initialized)
|
||||
WSACleanup();
|
||||
#endif
|
||||
if (winsock_loaded) WSACleanup();
|
||||
}
|
||||
|
||||
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;
|
||||
BOOL ret = FALSE;
|
||||
int res;
|
||||
ULONG state;
|
||||
|
||||
winsock_init();
|
||||
|
||||
conn = heap_alloc_zero(sizeof(*conn));
|
||||
if (!conn) return NULL;
|
||||
|
@ -311,8 +193,7 @@ netconn_t *netconn_create( hostdata_t *host, const struct sockaddr_storage *sock
|
|||
conn->sockaddr = *sockaddr;
|
||||
if ((conn->socket = socket( sockaddr->ss_family, SOCK_STREAM, 0 )) == -1)
|
||||
{
|
||||
WARN("unable to create socket (%s)\n", strerror(errno));
|
||||
set_last_error( sock_get_error( errno ) );
|
||||
WARN("unable to create socket (%u)\n", WSAGetLastError());
|
||||
heap_free(conn);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -329,83 +210,39 @@ netconn_t *netconn_create( hostdata_t *host, const struct sockaddr_storage *sock
|
|||
assert(0);
|
||||
}
|
||||
|
||||
if (timeout > 0)
|
||||
if (timeout > 0) set_blocking( conn, FALSE );
|
||||
|
||||
if (!connect( conn->socket, (const struct sockaddr *)&conn->sockaddr, addr_len )) ret = TRUE;
|
||||
else
|
||||
{
|
||||
state = 1;
|
||||
ioctlsocket( conn->socket, FIONBIO, &state );
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
res = 0;
|
||||
if (connect( conn->socket, (const struct sockaddr *)&conn->sockaddr, addr_len ) < 0)
|
||||
DWORD err = WSAGetLastError();
|
||||
if (err == WSAEWOULDBLOCK || err == WSAEINPROGRESS)
|
||||
{
|
||||
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_SET set;
|
||||
TIMEVAL timeval = { 0, timeout * 1000 };
|
||||
int res;
|
||||
|
||||
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
|
||||
{
|
||||
res = sock_get_error( errno );
|
||||
if (res != WSAEINTR) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (res != WSAEINTR) break;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = TRUE;
|
||||
break;
|
||||
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)
|
||||
{
|
||||
state = 0;
|
||||
ioctlsocket( conn->socket, FIONBIO, &state );
|
||||
}
|
||||
|
||||
if (timeout > 0) set_blocking( conn, TRUE );
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
WARN("unable to connect to host (%d)\n", res);
|
||||
set_last_error( res );
|
||||
netconn_close( conn );
|
||||
WARN("unable to connect to host (%u)\n", GetLastError());
|
||||
closesocket( conn->socket );
|
||||
heap_free( conn );
|
||||
return NULL;
|
||||
}
|
||||
return conn;
|
||||
}
|
||||
|
||||
BOOL netconn_close( netconn_t *conn )
|
||||
void netconn_close( struct netconn *conn )
|
||||
{
|
||||
int res;
|
||||
|
||||
if (conn->secure)
|
||||
{
|
||||
heap_free( conn->peek_msg_mem );
|
||||
|
@ -413,18 +250,13 @@ BOOL netconn_close( netconn_t *conn )
|
|||
heap_free(conn->extra_buf);
|
||||
DeleteSecurityContext(&conn->ssl_ctx);
|
||||
}
|
||||
res = closesocket( conn->socket );
|
||||
closesocket( conn->socket );
|
||||
release_host( conn->host );
|
||||
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}};
|
||||
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);
|
||||
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);
|
||||
if(res != ERROR_SUCCESS) {
|
||||
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);
|
||||
conn->ssl_buf = NULL;
|
||||
DeleteSecurityContext(&ctx);
|
||||
set_last_error(res ? res : ERROR_WINHTTP_SECURE_CHANNEL_ERROR);
|
||||
SetLastError(res ? res : ERROR_WINHTTP_SECURE_CHANNEL_ERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -557,7 +389,7 @@ BOOL netconn_secure_connect( netconn_t *conn, WCHAR *hostname, DWORD security_fl
|
|||
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] = {
|
||||
{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},
|
||||
{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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -604,19 +436,14 @@ BOOL netconn_send( netconn_t *conn, const void *msg, size_t len, int *sent )
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
if ((*sent = sock_send( conn->socket, msg, len, 0 )) == -1)
|
||||
{
|
||||
set_last_error( sock_get_error( errno ) );
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
return ((*sent = sock_send( conn->socket, msg, len, 0 )) != -1);
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
unsigned int i;
|
||||
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);
|
||||
|
||||
for(i=0; i < sizeof(bufs)/sizeof(*bufs); i++) {
|
||||
for(i = 0; i < ARRAY_SIZE(bufs); i++) {
|
||||
if(bufs[i].BufferType == SECBUFFER_DATA) {
|
||||
size = min(buf_size, bufs[i].cbBuffer);
|
||||
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) {
|
||||
conn->extra_buf = heap_alloc(bufs[i].cbBuffer);
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
return TRUE;
|
||||
}
|
||||
if ((*recvd = sock_recv( conn->socket, buf, len, flags )) == -1)
|
||||
{
|
||||
set_last_error( sock_get_error( errno ) );
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
return ((*recvd = sock_recv( conn->socket, buf, len, flags )) != -1);
|
||||
}
|
||||
|
||||
ULONG netconn_query_data_available( netconn_t *conn )
|
||||
ULONG netconn_query_data_available( struct netconn *conn )
|
||||
{
|
||||
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;
|
||||
|
||||
/* 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)
|
||||
int opt = send ? SO_SNDTIMEO : SO_RCVTIMEO;
|
||||
if (setsockopt( netconn->socket, SOL_SOCKET, opt, (void *)&value, sizeof(value) ) == -1)
|
||||
{
|
||||
WARN("setsockopt failed (%s)\n", strerror( errno ));
|
||||
return sock_get_error( errno );
|
||||
DWORD err = WSAGetLastError();
|
||||
WARN("setsockopt failed (%u)\n", err );
|
||||
return err;
|
||||
}
|
||||
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;
|
||||
char b;
|
||||
DWORD err;
|
||||
|
||||
mode = 1;
|
||||
if(!ioctlsocket(netconn->socket, FIONBIO, &mode))
|
||||
return FALSE;
|
||||
set_blocking( netconn, FALSE );
|
||||
len = sock_recv( netconn->socket, &b, 1, MSG_PEEK );
|
||||
err = WSAGetLastError();
|
||||
set_blocking( netconn, TRUE );
|
||||
|
||||
len = recv(netconn->socket, &b, 1, MSG_PEEK);
|
||||
|
||||
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
|
||||
return len == 1 || (len == -1 && err == WSAEWOULDBLOCK);
|
||||
}
|
||||
|
||||
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;
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
struct addrinfo *res, hints;
|
||||
ADDRINFOW *res, hints;
|
||||
int ret;
|
||||
#else
|
||||
struct hostent *he;
|
||||
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
|
||||
#endif
|
||||
|
||||
if (!(hostname = strdupWA( hostnameW ))) return ERROR_OUTOFMEMORY;
|
||||
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
memset( &hints, 0, sizeof(struct addrinfo) );
|
||||
memset( &hints, 0, sizeof(hints) );
|
||||
/* 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.
|
||||
*/
|
||||
hints.ai_family = AF_INET;
|
||||
|
||||
ret = getaddrinfo( hostname, NULL, &hints, &res );
|
||||
ret = GetAddrInfoW( name, NULL, &hints, &res );
|
||||
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;
|
||||
ret = getaddrinfo( hostname, NULL, &hints, &res );
|
||||
ret = GetAddrInfoW( name, NULL, &hints, &res );
|
||||
if (ret != 0)
|
||||
{
|
||||
TRACE("failed to get address of %s (%s)\n", debugstr_w(hostnameW), gai_strerror(ret));
|
||||
heap_free( hostname );
|
||||
TRACE("failed to get address of %s\n", debugstr_w(name));
|
||||
return ERROR_WINHTTP_NAME_NOT_RESOLVED;
|
||||
}
|
||||
}
|
||||
heap_free( hostname );
|
||||
memcpy( sa, res->ai_addr, res->ai_addrlen );
|
||||
/* Copy port */
|
||||
switch (res->ai_family)
|
||||
{
|
||||
case AF_INET:
|
||||
|
@ -857,29 +647,12 @@ static DWORD resolve_hostname( const WCHAR *hostnameW, INTERNET_PORT port, struc
|
|||
break;
|
||||
}
|
||||
|
||||
freeaddrinfo( res );
|
||||
FreeAddrInfoW( res );
|
||||
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 );
|
||||
return ERROR_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __REACTOS__
|
||||
|
||||
struct resolve_args
|
||||
{
|
||||
const WCHAR *hostname;
|
||||
|
@ -919,13 +692,64 @@ BOOL netconn_resolve( WCHAR *hostname, INTERNET_PORT port, struct sockaddr_stora
|
|||
|
||||
if (ret)
|
||||
{
|
||||
set_last_error( ret );
|
||||
SetLastError( ret );
|
||||
return FALSE;
|
||||
}
|
||||
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;
|
||||
SECURITY_STATUS res;
|
||||
|
@ -935,7 +759,7 @@ const void *netconn_get_certificate( netconn_t *conn )
|
|||
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;
|
||||
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 "ws2tcpip.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winreg.h"
|
||||
#include "winhttp.h"
|
||||
#include "shlwapi.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "winhttp_private.h"
|
||||
|
||||
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_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;
|
||||
if (!*str_len) return ERROR_SUCCESS;
|
||||
if (!*str)
|
||||
WCHAR **str;
|
||||
DWORD *len;
|
||||
};
|
||||
|
||||
static DWORD set_component( struct url_component *comp, WCHAR *value, DWORD len, DWORD flags, BOOL *overflow )
|
||||
{
|
||||
if (*comp->str && !*comp->len) return ERROR_INVALID_PARAMETER;
|
||||
if (!*comp->len) return ERROR_SUCCESS;
|
||||
if (!*comp->str)
|
||||
{
|
||||
if (len && *str_len && (flags & (ICU_DECODE|ICU_ESCAPE))) return ERROR_INVALID_PARAMETER;
|
||||
*str = value;
|
||||
*str_len = len;
|
||||
if (len && *comp->len && (flags & (ICU_DECODE|ICU_ESCAPE))) return ERROR_INVALID_PARAMETER;
|
||||
*comp->str = value;
|
||||
*comp->len = len;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (len >= *str_len)
|
||||
if (len >= *comp->len)
|
||||
{
|
||||
*str_len = len+1;
|
||||
*comp->len = len + 1;
|
||||
*overflow = TRUE;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
memcpy( *str, value, len * sizeof(WCHAR) );
|
||||
(*str)[len] = 0;
|
||||
*str_len = len;
|
||||
memcpy( *comp->str, value, len * sizeof(WCHAR) );
|
||||
(*comp->str)[len] = 0;
|
||||
*comp->len = len;
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
@ -87,81 +93,71 @@ static WCHAR *decode_url( LPCWSTR url, DWORD *len )
|
|||
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;
|
||||
else
|
||||
if (ch <= 31 || ch >= 127) return TRUE;
|
||||
while (*p)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case ' ':
|
||||
case '"':
|
||||
case '#':
|
||||
case '%':
|
||||
case '<':
|
||||
case '>':
|
||||
case ']':
|
||||
case '\\':
|
||||
case '[':
|
||||
case '^':
|
||||
case '`':
|
||||
case '{':
|
||||
case '|':
|
||||
case '}':
|
||||
case '~':
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
if (ch == *p++) return TRUE;
|
||||
}
|
||||
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'};
|
||||
DWORD ret = len;
|
||||
unsigned int i;
|
||||
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] ))
|
||||
{
|
||||
p[0] = '%';
|
||||
p[1] = hex[(src[i] >> 4) & 0xf];
|
||||
p[2] = hex[src[i] & 0xf];
|
||||
ret += 2;
|
||||
p += 2;
|
||||
if (dst)
|
||||
{
|
||||
p[0] = '%';
|
||||
p[1] = hex[(src[i] >> 4) & 0xf];
|
||||
p[2] = hex[src[i] & 0xf];
|
||||
p += 3;
|
||||
}
|
||||
*dst_len += 2;
|
||||
}
|
||||
else *p = src[i];
|
||||
else if (dst) *p++ = src[i];
|
||||
}
|
||||
dst[ret] = 0;
|
||||
return ret;
|
||||
|
||||
if (dst) dst[*dst_len] = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static WCHAR *escape_url( LPCWSTR url, DWORD *len )
|
||||
static DWORD escape_url( const WCHAR *url, DWORD *len, WCHAR **ret )
|
||||
{
|
||||
WCHAR *ret;
|
||||
const WCHAR *p, *q;
|
||||
const WCHAR *p;
|
||||
DWORD len_base, len_path;
|
||||
|
||||
if ((p = q = strrchrW( url, '/' )))
|
||||
if ((p = strrchrW( url, '/' )))
|
||||
{
|
||||
while (*q)
|
||||
{
|
||||
if (need_escape( *q )) *len += 2;
|
||||
q++;
|
||||
}
|
||||
len_base = p - url;
|
||||
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
|
||||
{
|
||||
memcpy( ret, url, (p - url) * sizeof(WCHAR) );
|
||||
copy_escape( ret + (p - url), p, q - p );
|
||||
len_base = *len;
|
||||
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 )
|
||||
|
@ -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 )
|
||||
{
|
||||
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;
|
||||
DWORD err;
|
||||
|
||||
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;
|
||||
}
|
||||
if (!len) len = strlenW( url );
|
||||
|
||||
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;
|
||||
}
|
||||
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 )))
|
||||
{
|
||||
set_last_error( ERROR_OUTOFMEMORY );
|
||||
SetLastError( ERROR_OUTOFMEMORY );
|
||||
return FALSE;
|
||||
}
|
||||
url = url_decoded;
|
||||
}
|
||||
if (!(p = strchrW( url, ':' )))
|
||||
{
|
||||
set_last_error( ERROR_WINHTTP_UNRECOGNIZED_SCHEME );
|
||||
SetLastError( ERROR_WINHTTP_UNRECOGNIZED_SCHEME );
|
||||
return FALSE;
|
||||
}
|
||||
if (p - url == 4 && !strncmpiW( url, scheme_http, 4 )) scheme = INTERNET_SCHEME_HTTP;
|
||||
else if (p - url == 5 && !strncmpiW( url, scheme_https, 5 )) scheme = INTERNET_SCHEME_HTTPS;
|
||||
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_number = INTERNET_SCHEME_HTTPS;
|
||||
else
|
||||
{
|
||||
err = ERROR_WINHTTP_UNRECOGNIZED_SCHEME;
|
||||
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 ':' */
|
||||
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;
|
||||
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 ((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++;
|
||||
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
|
||||
{
|
||||
if ((err = set_component( &uc->lpszUserName, &uc->dwUserNameLength, 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( &username, p, q - p, flags, &overflow ))) goto exit;
|
||||
if ((err = set_component( &password, NULL, 0, flags, &overflow ))) goto exit;
|
||||
}
|
||||
p = q + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((err = set_component( &uc->lpszUserName, &uc->dwUserNameLength, NULL, 0, flags, &overflow ))) goto exit;
|
||||
if ((err = set_component( &uc->lpszPassword, &uc->dwPasswordLength, NULL, 0, flags, &overflow ))) goto exit;
|
||||
if ((err = set_component( &username, 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 ((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++;
|
||||
if ((err = parse_port( r, q - r, &uc->nPort ))) goto exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((err = set_component( &uc->lpszHostName, &uc->dwHostNameLength, p, q - p, flags, &overflow ))) goto exit;
|
||||
if (scheme == INTERNET_SCHEME_HTTP) uc->nPort = INTERNET_DEFAULT_HTTP_PORT;
|
||||
if (scheme == INTERNET_SCHEME_HTTPS) uc->nPort = INTERNET_DEFAULT_HTTPS_PORT;
|
||||
if ((err = set_component( &hostname, p, q - p, flags, &overflow ))) goto exit;
|
||||
if (scheme_number == INTERNET_SCHEME_HTTP) uc->nPort = INTERNET_DEFAULT_HTTP_PORT;
|
||||
if (scheme_number == INTERNET_SCHEME_HTTPS) uc->nPort = INTERNET_DEFAULT_HTTPS_PORT;
|
||||
}
|
||||
|
||||
if ((r = memchrW( q, '?', len - (q - url) )))
|
||||
{
|
||||
if ((err = set_component( &uc->lpszUrlPath, &uc->dwUrlPathLength, q, r - q, flags, &overflow ))) goto exit;
|
||||
if ((err = set_component( &uc->lpszExtraInfo, &uc->dwExtraInfoLength, r, len - (r - url), flags, &overflow ))) goto exit;
|
||||
if (*extra.len)
|
||||
{
|
||||
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
|
||||
{
|
||||
if ((err = set_component( &uc->lpszUrlPath, &uc->dwUrlPathLength, 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( &path, q, len - (q - url), flags, &overflow ))) goto exit;
|
||||
if ((err = set_component( &extra, (WCHAR *)url + len, 0, flags, &overflow ))) goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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++;
|
||||
if ((err = parse_port( r, len - (r - url), &uc->nPort ))) goto exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((err = set_component( &uc->lpszHostName, &uc->dwHostNameLength, p, len - (p - url), flags, &overflow ))) goto exit;
|
||||
if (scheme == INTERNET_SCHEME_HTTP) uc->nPort = INTERNET_DEFAULT_HTTP_PORT;
|
||||
if (scheme == INTERNET_SCHEME_HTTPS) uc->nPort = INTERNET_DEFAULT_HTTPS_PORT;
|
||||
if ((err = set_component( &hostname, p, len - (p - url), flags, &overflow ))) goto exit;
|
||||
if (scheme_number == INTERNET_SCHEME_HTTP) uc->nPort = INTERNET_DEFAULT_HTTP_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( &uc->lpszExtraInfo, &uc->dwExtraInfoLength, (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( &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 ),
|
||||
debugstr_wn( uc->lpszHostName, uc->dwHostNameLength ), uc->nPort, debugstr_wn( uc->lpszUrlPath, uc->dwUrlPathLength ),
|
||||
debugstr_wn( uc->lpszExtraInfo, uc->dwExtraInfoLength ));
|
||||
TRACE("scheme(%s) host(%s) port(%d) path(%s) extra(%s)\n", debugstr_wn(*scheme.str, *scheme.len),
|
||||
debugstr_wn(*hostname.str, *hostname.len ), uc->nPort, debugstr_wn(*path.str, *path.len),
|
||||
debugstr_wn(*extra.str, *extra.len));
|
||||
|
||||
exit:
|
||||
if (!err)
|
||||
{
|
||||
if (overflow) err = ERROR_INSUFFICIENT_BUFFER;
|
||||
uc->nScheme = scheme;
|
||||
uc->nScheme = scheme_number;
|
||||
}
|
||||
heap_free( url_decoded );
|
||||
heap_free( url_escaped );
|
||||
set_last_error( err );
|
||||
SetLastError( err );
|
||||
return !err;
|
||||
}
|
||||
|
||||
|
@ -342,7 +364,7 @@ static BOOL uses_default_port( INTERNET_SCHEME scheme, INTERNET_PORT port )
|
|||
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;
|
||||
unsigned int i;
|
||||
|
@ -353,7 +375,7 @@ static DWORD comp_length( DWORD len, DWORD flags, WCHAR *comp )
|
|||
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};
|
||||
INTERNET_SCHEME scheme;
|
||||
|
@ -361,7 +383,7 @@ static BOOL calc_length( URL_COMPONENTS *uc, DWORD flags, LPDWORD len )
|
|||
*len = 0;
|
||||
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;
|
||||
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;
|
||||
*len += strlenW( get_scheme_string( scheme ) );
|
||||
}
|
||||
*len += 1; /* ':' */
|
||||
if (uc->lpszHostName) *len += 2; /* "//" */
|
||||
*len += 3; /* "://" */
|
||||
|
||||
if (uc->lpszUserName)
|
||||
{
|
||||
*len += comp_length( uc->dwUserNameLength, 0, uc->lpszUserName );
|
||||
*len += get_comp_length( uc->dwUserNameLength, 0, uc->lpszUserName );
|
||||
*len += 1; /* "@" */
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uc->lpszPassword)
|
||||
{
|
||||
set_last_error( ERROR_INVALID_PARAMETER );
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if (uc->lpszPassword)
|
||||
{
|
||||
*len += 1; /* ":" */
|
||||
*len += comp_length( uc->dwPasswordLength, 0, uc->lpszPassword );
|
||||
*len += get_comp_length( uc->dwPasswordLength, 0, uc->lpszPassword );
|
||||
}
|
||||
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 ))
|
||||
{
|
||||
|
@ -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) *len += comp_length( uc->dwUrlPathLength, flags, uc->lpszUrlPath );
|
||||
if (uc->lpszExtraInfo) *len += comp_length( uc->dwExtraInfoLength, flags, uc->lpszExtraInfo );
|
||||
if (uc->lpszUrlPath) *len += get_comp_length( uc->dwUrlPathLength, flags, uc->lpszUrlPath );
|
||||
if (uc->lpszExtraInfo) *len += get_comp_length( uc->dwExtraInfoLength, flags, uc->lpszExtraInfo );
|
||||
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 )
|
||||
{
|
||||
static const WCHAR formatW[] = {'%','u',0};
|
||||
static const WCHAR twoslashW[] = {'/','/'};
|
||||
DWORD len;
|
||||
DWORD len, len_escaped;
|
||||
INTERNET_SCHEME scheme;
|
||||
|
||||
TRACE("%p, 0x%08x, %p, %p\n", uc, flags, url, required);
|
||||
|
||||
if (!uc || uc->dwStructSize != sizeof(URL_COMPONENTS) || !required)
|
||||
{
|
||||
set_last_error( ERROR_INVALID_PARAMETER );
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!calc_length( uc, flags, &len )) return FALSE;
|
||||
if (!get_url_length( uc, flags, &len )) return FALSE;
|
||||
|
||||
if (*required < len)
|
||||
{
|
||||
*required = len + 1;
|
||||
set_last_error( ERROR_INSUFFICIENT_BUFFER );
|
||||
SetLastError( ERROR_INSUFFICIENT_BUFFER );
|
||||
return FALSE;
|
||||
}
|
||||
if (!url)
|
||||
{
|
||||
set_last_error( ERROR_INVALID_PARAMETER );
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -446,7 +466,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
|
|||
*required = len;
|
||||
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) );
|
||||
url += len;
|
||||
|
||||
|
@ -465,58 +485,55 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
|
|||
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)
|
||||
{
|
||||
len = comp_length( uc->dwUserNameLength, 0, uc->lpszUserName );
|
||||
len = get_comp_length( uc->dwUserNameLength, 0, uc->lpszUserName );
|
||||
memcpy( url, uc->lpszUserName, len * sizeof(WCHAR) );
|
||||
url += len;
|
||||
|
||||
if (uc->lpszPassword)
|
||||
{
|
||||
*url = ':';
|
||||
url++;
|
||||
|
||||
len = comp_length( uc->dwPasswordLength, 0, uc->lpszPassword );
|
||||
*url++ = ':';
|
||||
len = get_comp_length( uc->dwPasswordLength, 0, uc->lpszPassword );
|
||||
memcpy( url, uc->lpszPassword, len * sizeof(WCHAR) );
|
||||
url += len;
|
||||
}
|
||||
*url = '@';
|
||||
url++;
|
||||
*url++ = '@';
|
||||
}
|
||||
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) );
|
||||
url += len;
|
||||
|
||||
if (!uses_default_port( scheme, uc->nPort ))
|
||||
{
|
||||
*url = ':';
|
||||
url++;
|
||||
|
||||
*url++ = ':';
|
||||
url += sprintfW( url, formatW, uc->nPort );
|
||||
}
|
||||
|
||||
/* add slash between hostname and path if necessary */
|
||||
if (uc->lpszUrlPath && *uc->lpszUrlPath != '/')
|
||||
{
|
||||
*url = '/';
|
||||
url++;
|
||||
*url++ = '/';
|
||||
}
|
||||
}
|
||||
if (uc->lpszUrlPath)
|
||||
{
|
||||
len = comp_length( uc->dwUrlPathLength, 0, uc->lpszUrlPath );
|
||||
if (flags & ICU_ESCAPE) url += copy_escape( url, uc->lpszUrlPath, len );
|
||||
len = get_comp_length( uc->dwUrlPathLength, 0, uc->lpszUrlPath );
|
||||
if (flags & ICU_ESCAPE)
|
||||
{
|
||||
if (!escape_string( uc->lpszUrlPath, len, url, &len_escaped ))
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
url += len_escaped;
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
len = comp_length( uc->dwExtraInfoLength, 0, uc->lpszExtraInfo );
|
||||
if (flags & ICU_ESCAPE) url += copy_escape( url, uc->lpszExtraInfo, len );
|
||||
len = get_comp_length( uc->dwExtraInfoLength, 0, uc->lpszExtraInfo );
|
||||
if (flags & ICU_ESCAPE)
|
||||
{
|
||||
if (!escape_string( uc->lpszExtraInfo, len, url, &len_escaped ))
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
url += len_escaped;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( url, uc->lpszExtraInfo, len * sizeof(WCHAR) );
|
||||
|
@ -534,6 +559,6 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
|
|||
}
|
||||
}
|
||||
*url = 0;
|
||||
set_last_error( ERROR_SUCCESS );
|
||||
SetLastError( ERROR_SUCCESS );
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -27,25 +27,9 @@
|
|||
#include "wine/list.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 "sspi.h"
|
||||
#include "wincrypt.h"
|
||||
|
||||
static const WCHAR getW[] = {'G','E','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 chunkedW[] = {'c','h','u','n','k','e','d',0};
|
||||
|
||||
typedef struct _object_header_t object_header_t;
|
||||
|
||||
typedef struct
|
||||
struct object_header;
|
||||
struct object_vtbl
|
||||
{
|
||||
void (*destroy)( object_header_t * );
|
||||
BOOL (*query_option)( object_header_t *, DWORD, void *, DWORD * );
|
||||
BOOL (*set_option)( object_header_t *, DWORD, void *, DWORD );
|
||||
} object_vtbl_t;
|
||||
void (*destroy)( struct object_header * );
|
||||
BOOL (*query_option)( struct object_header *, DWORD, void *, DWORD * );
|
||||
BOOL (*set_option)( struct object_header *, DWORD, void *, DWORD );
|
||||
};
|
||||
|
||||
struct _object_header_t
|
||||
struct object_header
|
||||
{
|
||||
DWORD type;
|
||||
HINTERNET handle;
|
||||
const object_vtbl_t *vtbl;
|
||||
const struct object_vtbl *vtbl;
|
||||
DWORD flags;
|
||||
DWORD disable_flags;
|
||||
DWORD logon_policy;
|
||||
|
@ -82,71 +65,58 @@ struct _object_header_t
|
|||
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;
|
||||
LONG ref;
|
||||
WCHAR *hostname;
|
||||
INTERNET_PORT port;
|
||||
BOOL secure;
|
||||
struct list connections;
|
||||
} hostdata_t;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct session
|
||||
{
|
||||
object_header_t hdr;
|
||||
LPWSTR agent;
|
||||
struct object_header hdr;
|
||||
CRITICAL_SECTION cs;
|
||||
WCHAR *agent;
|
||||
DWORD access;
|
||||
int resolve_timeout;
|
||||
int connect_timeout;
|
||||
int send_timeout;
|
||||
int recv_timeout;
|
||||
LPWSTR proxy_server;
|
||||
LPWSTR proxy_bypass;
|
||||
LPWSTR proxy_username;
|
||||
LPWSTR proxy_password;
|
||||
int receive_timeout;
|
||||
int receive_response_timeout;
|
||||
WCHAR *proxy_server;
|
||||
WCHAR *proxy_bypass;
|
||||
WCHAR *proxy_username;
|
||||
WCHAR *proxy_password;
|
||||
struct list cookie_cache;
|
||||
HANDLE unload_event;
|
||||
CredHandle cred_handle;
|
||||
BOOL cred_handle_initialized;
|
||||
DWORD secure_protocols;
|
||||
} session_t;
|
||||
DWORD passport_flags;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct connect
|
||||
{
|
||||
object_header_t hdr;
|
||||
session_t *session;
|
||||
LPWSTR hostname; /* final destination of the request */
|
||||
LPWSTR servername; /* name of the server we directly connect to */
|
||||
LPWSTR username;
|
||||
LPWSTR password;
|
||||
struct object_header hdr;
|
||||
struct session *session;
|
||||
WCHAR *hostname; /* final destination of the request */
|
||||
WCHAR *servername; /* name of the server we directly connect to */
|
||||
WCHAR *username;
|
||||
WCHAR *password;
|
||||
INTERNET_PORT hostport;
|
||||
INTERNET_PORT serverport;
|
||||
struct sockaddr_storage sockaddr;
|
||||
BOOL resolved;
|
||||
} connect_t;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct netconn
|
||||
{
|
||||
struct list entry;
|
||||
int socket;
|
||||
struct sockaddr_storage sockaddr;
|
||||
BOOL secure; /* SSL active on connection? */
|
||||
hostdata_t *host;
|
||||
struct hostdata *host;
|
||||
ULONGLONG keep_until;
|
||||
CtxtHandle ssl_ctx;
|
||||
SecPkgContext_StreamSizes ssl_sizes;
|
||||
|
@ -156,14 +126,14 @@ typedef struct
|
|||
char *peek_msg;
|
||||
char *peek_msg_mem;
|
||||
size_t peek_len;
|
||||
} netconn_t;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct header
|
||||
{
|
||||
LPWSTR field;
|
||||
LPWSTR value;
|
||||
WCHAR *field;
|
||||
WCHAR *value;
|
||||
BOOL is_request; /* part of request headers? */
|
||||
} header_t;
|
||||
};
|
||||
|
||||
enum auth_target
|
||||
{
|
||||
|
@ -197,23 +167,29 @@ struct authinfo
|
|||
BOOL finished; /* finished authenticating */
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct request
|
||||
{
|
||||
object_header_t hdr;
|
||||
connect_t *connect;
|
||||
LPWSTR verb;
|
||||
LPWSTR path;
|
||||
LPWSTR version;
|
||||
LPWSTR raw_headers;
|
||||
struct object_header hdr;
|
||||
struct connect *connect;
|
||||
WCHAR *verb;
|
||||
WCHAR *path;
|
||||
WCHAR *version;
|
||||
WCHAR *raw_headers;
|
||||
void *optional;
|
||||
DWORD optional_len;
|
||||
netconn_t *netconn;
|
||||
struct netconn *netconn;
|
||||
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 connect_timeout;
|
||||
int send_timeout;
|
||||
int recv_timeout;
|
||||
LPWSTR status_text;
|
||||
int receive_timeout;
|
||||
int receive_response_timeout;
|
||||
WCHAR *status_text;
|
||||
DWORD content_length; /* total number of bytes to be read */
|
||||
DWORD content_read; /* bytes read so far */
|
||||
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_size; /* valid data size in read_buf */
|
||||
char read_buf[8192]; /* buffer for already read but not returned data */
|
||||
header_t *headers;
|
||||
struct header *headers;
|
||||
DWORD num_headers;
|
||||
struct authinfo *authinfo;
|
||||
struct authinfo *proxy_authinfo;
|
||||
HANDLE task_wait;
|
||||
HANDLE task_cancel;
|
||||
#ifdef __REACTOS__
|
||||
HANDLE task_thread;
|
||||
#else
|
||||
BOOL task_proc_running;
|
||||
#endif
|
||||
struct list task_queue;
|
||||
CRITICAL_SECTION task_cs;
|
||||
struct
|
||||
|
@ -236,89 +216,84 @@ typedef struct
|
|||
WCHAR *username;
|
||||
WCHAR *password;
|
||||
} 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;
|
||||
LPWSTR headers;
|
||||
struct list entry;
|
||||
struct request *request;
|
||||
void (*proc)( struct task_header * );
|
||||
};
|
||||
|
||||
struct send_request
|
||||
{
|
||||
struct task_header hdr;
|
||||
WCHAR *headers;
|
||||
DWORD headers_len;
|
||||
LPVOID optional;
|
||||
void *optional;
|
||||
DWORD optional_len;
|
||||
DWORD total_len;
|
||||
DWORD_PTR context;
|
||||
} send_request_t;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct receive_response
|
||||
{
|
||||
task_header_t hdr;
|
||||
} receive_response_t;
|
||||
struct task_header hdr;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct query_data
|
||||
{
|
||||
task_header_t hdr;
|
||||
LPDWORD available;
|
||||
} query_data_t;
|
||||
struct task_header hdr;
|
||||
DWORD *available;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct read_data
|
||||
{
|
||||
task_header_t hdr;
|
||||
LPVOID buffer;
|
||||
struct task_header hdr;
|
||||
void *buffer;
|
||||
DWORD to_read;
|
||||
LPDWORD read;
|
||||
} read_data_t;
|
||||
DWORD *read;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
struct write_data
|
||||
{
|
||||
task_header_t hdr;
|
||||
LPCVOID buffer;
|
||||
struct task_header hdr;
|
||||
const void *buffer;
|
||||
DWORD to_write;
|
||||
LPDWORD written;
|
||||
} write_data_t;
|
||||
DWORD *written;
|
||||
};
|
||||
|
||||
object_header_t *addref_object( object_header_t * ) DECLSPEC_HIDDEN;
|
||||
object_header_t *grab_object( HINTERNET ) DECLSPEC_HIDDEN;
|
||||
void release_object( object_header_t * ) DECLSPEC_HIDDEN;
|
||||
HINTERNET alloc_handle( object_header_t * ) DECLSPEC_HIDDEN;
|
||||
struct object_header *addref_object( struct object_header * ) DECLSPEC_HIDDEN;
|
||||
struct object_header *grab_object( HINTERNET ) DECLSPEC_HIDDEN;
|
||||
void release_object( struct object_header * ) DECLSPEC_HIDDEN;
|
||||
HINTERNET alloc_handle( struct object_header * ) DECLSPEC_HIDDEN;
|
||||
BOOL free_handle( HINTERNET ) DECLSPEC_HIDDEN;
|
||||
|
||||
void set_last_error( DWORD ) DECLSPEC_HIDDEN;
|
||||
DWORD get_last_error( void ) DECLSPEC_HIDDEN;
|
||||
void send_callback( object_header_t *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN;
|
||||
void close_connection( request_t * ) DECLSPEC_HIDDEN;
|
||||
void send_callback( struct object_header *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN;
|
||||
void close_connection( struct request * ) DECLSPEC_HIDDEN;
|
||||
|
||||
BOOL netconn_close( netconn_t * ) DECLSPEC_HIDDEN;
|
||||
netconn_t *netconn_create( hostdata_t *, const struct sockaddr_storage *, int ) DECLSPEC_HIDDEN;
|
||||
void netconn_close( struct netconn * ) DECLSPEC_HIDDEN;
|
||||
struct netconn *netconn_create( struct hostdata *, const struct sockaddr_storage *, int ) DECLSPEC_HIDDEN;
|
||||
void netconn_unload( void ) DECLSPEC_HIDDEN;
|
||||
ULONG netconn_query_data_available( netconn_t * ) DECLSPEC_HIDDEN;
|
||||
BOOL netconn_recv( netconn_t *, void *, size_t, int, int * ) DECLSPEC_HIDDEN;
|
||||
ULONG netconn_query_data_available( struct netconn * ) 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_secure_connect( netconn_t *, WCHAR *, DWORD, CredHandle * ) DECLSPEC_HIDDEN;
|
||||
BOOL netconn_send( netconn_t *, const void *, size_t, int * ) DECLSPEC_HIDDEN;
|
||||
DWORD netconn_set_timeout( netconn_t *, BOOL, int ) DECLSPEC_HIDDEN;
|
||||
BOOL netconn_is_alive( netconn_t * ) DECLSPEC_HIDDEN;
|
||||
const void *netconn_get_certificate( netconn_t * ) DECLSPEC_HIDDEN;
|
||||
int netconn_get_cipher_strength( netconn_t * ) DECLSPEC_HIDDEN;
|
||||
BOOL netconn_secure_connect( struct netconn *, WCHAR *, DWORD, CredHandle *, BOOL ) DECLSPEC_HIDDEN;
|
||||
BOOL netconn_send( struct netconn *, const void *, size_t, int * ) DECLSPEC_HIDDEN;
|
||||
DWORD netconn_set_timeout( struct netconn *, BOOL, int ) DECLSPEC_HIDDEN;
|
||||
BOOL netconn_is_alive( struct netconn * ) DECLSPEC_HIDDEN;
|
||||
const void *netconn_get_certificate( struct netconn * ) DECLSPEC_HIDDEN;
|
||||
int netconn_get_cipher_strength( struct netconn * ) DECLSPEC_HIDDEN;
|
||||
|
||||
BOOL set_cookies( request_t *, const WCHAR * ) DECLSPEC_HIDDEN;
|
||||
BOOL add_cookie_headers( request_t * ) DECLSPEC_HIDDEN;
|
||||
BOOL add_request_headers( request_t *, LPCWSTR, DWORD, DWORD ) DECLSPEC_HIDDEN;
|
||||
void delete_domain( domain_t * ) DECLSPEC_HIDDEN;
|
||||
BOOL set_server_for_hostname( connect_t *, LPCWSTR, INTERNET_PORT ) DECLSPEC_HIDDEN;
|
||||
BOOL set_cookies( struct request *, const WCHAR * ) DECLSPEC_HIDDEN;
|
||||
BOOL add_cookie_headers( struct request * ) DECLSPEC_HIDDEN;
|
||||
BOOL add_request_headers( struct request *, const WCHAR *, DWORD, DWORD ) DECLSPEC_HIDDEN;
|
||||
void destroy_cookies( struct session * ) DECLSPEC_HIDDEN;
|
||||
BOOL set_server_for_hostname( struct connect *, const WCHAR *, INTERNET_PORT ) DECLSPEC_HIDDEN;
|
||||
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;
|
||||
void release_host( struct hostdata * ) DECLSPEC_HIDDEN;
|
||||
BOOL process_header( struct request *, const WCHAR *, const WCHAR *, DWORD, BOOL ) DECLSPEC_HIDDEN;
|
||||
|
||||
extern HRESULT WinHttpRequest_create( 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/winemp3.acm # Synced to WineStaging-4.18
|
||||
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/winmm # Forked at Wine-20050628
|
||||
dll/win32/winmm/midimap # Forked at Wine-20050628
|
||||
|
|
Loading…
Reference in a new issue