winhttp: Get rid of netconn_t.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
dad2439d01
commit
4607d5ba59
|
@ -173,15 +173,15 @@ static void winsock_init(void)
|
||||||
InitOnceExecuteOnce( &once, winsock_startup, NULL, NULL );
|
InitOnceExecuteOnce( &once, winsock_startup, NULL, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_blocking( netconn_t *conn, BOOL blocking )
|
static void set_blocking( struct netconn *conn, BOOL blocking )
|
||||||
{
|
{
|
||||||
ULONG state = !blocking;
|
ULONG state = !blocking;
|
||||||
ioctlsocket( conn->socket, FIONBIO, &state );
|
ioctlsocket( conn->socket, FIONBIO, &state );
|
||||||
}
|
}
|
||||||
|
|
||||||
netconn_t *netconn_create( struct hostdata *host, const struct sockaddr_storage *sockaddr, int timeout )
|
struct netconn *netconn_create( struct hostdata *host, const struct sockaddr_storage *sockaddr, int timeout )
|
||||||
{
|
{
|
||||||
netconn_t *conn;
|
struct netconn *conn;
|
||||||
unsigned int addr_len;
|
unsigned int addr_len;
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ netconn_t *netconn_create( struct hostdata *host, const struct sockaddr_storage
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void netconn_close( netconn_t *conn )
|
void netconn_close( struct netconn *conn )
|
||||||
{
|
{
|
||||||
if (conn->secure)
|
if (conn->secure)
|
||||||
{
|
{
|
||||||
|
@ -255,7 +255,7 @@ void netconn_close( netconn_t *conn )
|
||||||
heap_free(conn);
|
heap_free(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
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}};
|
||||||
|
@ -389,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},
|
||||||
|
@ -415,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)
|
||||||
{
|
{
|
||||||
|
@ -439,7 +439,7 @@ BOOL netconn_send( netconn_t *conn, const void *msg, size_t len, int *sent )
|
||||||
return ((*sent = sock_send( conn->socket, msg, len, 0 )) != -1);
|
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;
|
const SIZE_T ssl_buf_size = conn->ssl_sizes.cbHeader+conn->ssl_sizes.cbMaximumMessage+conn->ssl_sizes.cbTrailer;
|
||||||
SecBuffer bufs[4];
|
SecBuffer bufs[4];
|
||||||
|
@ -530,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;
|
||||||
|
@ -582,12 +582,12 @@ BOOL netconn_recv( netconn_t *conn, void *buf, size_t len, int flags, int *recvd
|
||||||
return ((*recvd = sock_recv( conn->socket, buf, len, flags )) != -1);
|
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;
|
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 )
|
||||||
{
|
{
|
||||||
int opt = send ? SO_SNDTIMEO : SO_RCVTIMEO;
|
int opt = send ? SO_SNDTIMEO : SO_RCVTIMEO;
|
||||||
if (setsockopt( netconn->socket, SOL_SOCKET, opt, (void *)&value, sizeof(value) ) == -1)
|
if (setsockopt( netconn->socket, SOL_SOCKET, opt, (void *)&value, sizeof(value) ) == -1)
|
||||||
|
@ -599,7 +599,7 @@ DWORD netconn_set_timeout( netconn_t *netconn, BOOL send, int value )
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL netconn_is_alive( netconn_t *netconn )
|
BOOL netconn_is_alive( struct netconn *netconn )
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
char b;
|
char b;
|
||||||
|
@ -696,7 +696,7 @@ BOOL netconn_resolve( WCHAR *hostname, INTERNET_PORT port, struct sockaddr_stora
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const void *netconn_get_certificate( netconn_t *conn )
|
const void *netconn_get_certificate( struct netconn *conn )
|
||||||
{
|
{
|
||||||
const CERT_CONTEXT *ret;
|
const CERT_CONTEXT *ret;
|
||||||
SECURITY_STATUS res;
|
SECURITY_STATUS res;
|
||||||
|
@ -706,7 +706,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;
|
||||||
|
|
|
@ -1458,7 +1458,7 @@ static BOOL connection_collector_running;
|
||||||
static DWORD WINAPI connection_collector(void *arg)
|
static DWORD WINAPI connection_collector(void *arg)
|
||||||
{
|
{
|
||||||
unsigned int remaining_connections;
|
unsigned int remaining_connections;
|
||||||
netconn_t *netconn, *next_netconn;
|
struct netconn *netconn, *next_netconn;
|
||||||
struct hostdata *host, *next_host;
|
struct hostdata *host, *next_host;
|
||||||
ULONGLONG now;
|
ULONGLONG now;
|
||||||
|
|
||||||
|
@ -1473,7 +1473,7 @@ static DWORD WINAPI connection_collector(void *arg)
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY_SAFE(host, next_host, &connection_pool, struct hostdata, entry)
|
LIST_FOR_EACH_ENTRY_SAFE(host, next_host, &connection_pool, struct hostdata, entry)
|
||||||
{
|
{
|
||||||
LIST_FOR_EACH_ENTRY_SAFE(netconn, next_netconn, &host->connections, netconn_t, entry)
|
LIST_FOR_EACH_ENTRY_SAFE(netconn, next_netconn, &host->connections, struct netconn, entry)
|
||||||
{
|
{
|
||||||
if (netconn->keep_until < now)
|
if (netconn->keep_until < now)
|
||||||
{
|
{
|
||||||
|
@ -1496,7 +1496,7 @@ static DWORD WINAPI connection_collector(void *arg)
|
||||||
FreeLibraryAndExitThread( winhttp_instance, 0 );
|
FreeLibraryAndExitThread( winhttp_instance, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cache_connection( netconn_t *netconn )
|
static void cache_connection( struct netconn *netconn )
|
||||||
{
|
{
|
||||||
TRACE( "caching connection %p\n", netconn );
|
TRACE( "caching connection %p\n", netconn );
|
||||||
|
|
||||||
|
@ -1570,7 +1570,7 @@ static BOOL open_connection( request_t *request )
|
||||||
{
|
{
|
||||||
BOOL is_secure = request->hdr.flags & WINHTTP_FLAG_SECURE;
|
BOOL is_secure = request->hdr.flags & WINHTTP_FLAG_SECURE;
|
||||||
struct hostdata *host = NULL, *iter;
|
struct hostdata *host = NULL, *iter;
|
||||||
netconn_t *netconn = NULL;
|
struct netconn *netconn = NULL;
|
||||||
struct connect *connect;
|
struct connect *connect;
|
||||||
WCHAR *addressW = NULL;
|
WCHAR *addressW = NULL;
|
||||||
INTERNET_PORT port;
|
INTERNET_PORT port;
|
||||||
|
@ -1622,7 +1622,7 @@ static BOOL open_connection( request_t *request )
|
||||||
EnterCriticalSection( &connection_pool_cs );
|
EnterCriticalSection( &connection_pool_cs );
|
||||||
if (!list_empty( &host->connections ))
|
if (!list_empty( &host->connections ))
|
||||||
{
|
{
|
||||||
netconn = LIST_ENTRY( list_head( &host->connections ), netconn_t, entry );
|
netconn = LIST_ENTRY( list_head( &host->connections ), struct netconn, entry );
|
||||||
list_remove( &netconn->entry );
|
list_remove( &netconn->entry );
|
||||||
}
|
}
|
||||||
LeaveCriticalSection( &connection_pool_cs );
|
LeaveCriticalSection( &connection_pool_cs );
|
||||||
|
|
|
@ -111,7 +111,7 @@ struct connect
|
||||||
BOOL resolved;
|
BOOL resolved;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
struct netconn
|
||||||
{
|
{
|
||||||
struct list entry;
|
struct list entry;
|
||||||
int socket;
|
int socket;
|
||||||
|
@ -127,7 +127,7 @@ 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;
|
};
|
||||||
|
|
||||||
struct header
|
struct header
|
||||||
{
|
{
|
||||||
|
@ -178,7 +178,7 @@ typedef struct
|
||||||
LPWSTR raw_headers;
|
LPWSTR 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;
|
BOOL check_revocation;
|
||||||
const CERT_CONTEXT *server_cert;
|
const CERT_CONTEXT *server_cert;
|
||||||
|
@ -270,18 +270,18 @@ DWORD get_last_error( void ) DECLSPEC_HIDDEN;
|
||||||
void send_callback( struct object_header *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN;
|
void send_callback( struct object_header *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN;
|
||||||
void close_connection( request_t * ) DECLSPEC_HIDDEN;
|
void close_connection( request_t * ) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
void netconn_close( netconn_t * ) DECLSPEC_HIDDEN;
|
void netconn_close( struct netconn * ) DECLSPEC_HIDDEN;
|
||||||
netconn_t *netconn_create( struct hostdata *, 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 *, BOOL ) 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( request_t *, const WCHAR * ) DECLSPEC_HIDDEN;
|
||||||
BOOL add_cookie_headers( request_t * ) DECLSPEC_HIDDEN;
|
BOOL add_cookie_headers( request_t * ) DECLSPEC_HIDDEN;
|
||||||
|
|
Loading…
Reference in New Issue