Commit a1cee892 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Get rid of session_t.

parent 8d567bc9
...@@ -45,7 +45,7 @@ struct domain ...@@ -45,7 +45,7 @@ struct domain
struct list cookies; struct list cookies;
}; };
static struct domain *add_domain( session_t *session, WCHAR *name ) static struct domain *add_domain( struct session *session, WCHAR *name )
{ {
struct domain *domain; struct domain *domain;
...@@ -117,7 +117,7 @@ static void delete_domain( struct domain *domain ) ...@@ -117,7 +117,7 @@ static void delete_domain( struct domain *domain )
heap_free( domain ); heap_free( domain );
} }
void destroy_cookies( session_t *session ) void destroy_cookies( struct session *session )
{ {
struct list *item, *next; struct list *item, *next;
struct domain *domain; struct domain *domain;
...@@ -129,7 +129,7 @@ void destroy_cookies( session_t *session ) ...@@ -129,7 +129,7 @@ void destroy_cookies( session_t *session )
} }
} }
static BOOL add_cookie( session_t *session, struct cookie *cookie, WCHAR *domain_name, WCHAR *path ) static BOOL add_cookie( struct session *session, struct cookie *cookie, WCHAR *domain_name, WCHAR *path )
{ {
struct domain *domain = NULL; struct domain *domain = NULL;
struct cookie *old_cookie; struct cookie *old_cookie;
...@@ -268,7 +268,7 @@ BOOL set_cookies( request_t *request, const WCHAR *cookies ) ...@@ -268,7 +268,7 @@ 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;
struct cookie *cookie; struct cookie *cookie;
int len, used; int len, used;
...@@ -324,7 +324,7 @@ end: ...@@ -324,7 +324,7 @@ end:
BOOL add_cookie_headers( request_t *request ) BOOL add_cookie_headers( request_t *request )
{ {
struct list *domain_cursor; struct list *domain_cursor;
session_t *session = request->connect->session; struct session *session = request->connect->session;
EnterCriticalSection( &session->cs ); EnterCriticalSection( &session->cs );
......
...@@ -1538,7 +1538,7 @@ static DWORD map_secure_protocols( DWORD mask ) ...@@ -1538,7 +1538,7 @@ static DWORD map_secure_protocols( DWORD mask )
return ret; return ret;
} }
static BOOL ensure_cred_handle( session_t *session ) static BOOL ensure_cred_handle( struct session *session )
{ {
SECURITY_STATUS status = SEC_E_OK; SECURITY_STATUS status = SEC_E_OK;
...@@ -2176,7 +2176,7 @@ static BOOL send_request( request_t *request, LPCWSTR headers, DWORD headers_len ...@@ -2176,7 +2176,7 @@ static BOOL send_request( request_t *request, LPCWSTR headers, DWORD headers_len
BOOL ret = FALSE; BOOL ret = FALSE;
connect_t *connect = request->connect; connect_t *connect = request->connect;
session_t *session = connect->session; struct session *session = connect->session;
char *wire_req; char *wire_req;
int bytes_sent; int bytes_sent;
DWORD len, i, flags; DWORD len, i, flags;
......
...@@ -88,7 +88,7 @@ BOOL WINAPI WinHttpCheckPlatform( void ) ...@@ -88,7 +88,7 @@ BOOL WINAPI WinHttpCheckPlatform( void )
*/ */
static void session_destroy( struct object_header *hdr ) static void session_destroy( struct object_header *hdr )
{ {
session_t *session = (session_t *)hdr; struct session *session = (struct session *)hdr;
TRACE("%p\n", session); TRACE("%p\n", session);
...@@ -108,7 +108,7 @@ static void session_destroy( struct object_header *hdr ) ...@@ -108,7 +108,7 @@ static void session_destroy( struct object_header *hdr )
static BOOL session_query_option( struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen ) static BOOL session_query_option( struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen )
{ {
session_t *session = (session_t *)hdr; struct session *session = (struct session *)hdr;
switch (option) switch (option)
{ {
...@@ -159,7 +159,7 @@ static BOOL session_query_option( struct object_header *hdr, DWORD option, void ...@@ -159,7 +159,7 @@ static BOOL session_query_option( struct object_header *hdr, DWORD option, void
static BOOL session_set_option( struct object_header *hdr, DWORD option, void *buffer, DWORD buflen ) static BOOL session_set_option( struct object_header *hdr, DWORD option, void *buffer, DWORD buflen )
{ {
session_t *session = (session_t *)hdr; struct session *session = (struct session *)hdr;
switch (option) switch (option)
{ {
...@@ -258,12 +258,12 @@ static const struct object_vtbl session_vtbl = ...@@ -258,12 +258,12 @@ static const struct object_vtbl session_vtbl =
*/ */
HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWSTR bypass, DWORD flags ) HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWSTR bypass, DWORD flags )
{ {
session_t *session; struct session *session;
HINTERNET handle = NULL; HINTERNET handle = NULL;
TRACE("%s, %u, %s, %s, 0x%08x\n", debugstr_w(agent), access, debugstr_w(proxy), debugstr_w(bypass), flags); TRACE("%s, %u, %s, %s, 0x%08x\n", debugstr_w(agent), access, debugstr_w(proxy), debugstr_w(bypass), flags);
if (!(session = heap_alloc_zero( sizeof(session_t) ))) return NULL; if (!(session = heap_alloc_zero( sizeof(struct session) ))) return NULL;
session->hdr.type = WINHTTP_HANDLE_TYPE_SESSION; session->hdr.type = WINHTTP_HANDLE_TYPE_SESSION;
session->hdr.vtbl = &session_vtbl; session->hdr.vtbl = &session_vtbl;
...@@ -447,7 +447,7 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain) ...@@ -447,7 +447,7 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
/* Matches INTERNET_MAX_HOST_NAME_LENGTH in wininet.h, also RFC 1035 */ /* Matches INTERNET_MAX_HOST_NAME_LENGTH in wininet.h, also RFC 1035 */
#define MAX_HOST_NAME_LENGTH 256 #define MAX_HOST_NAME_LENGTH 256
static BOOL should_bypass_proxy(session_t *session, LPCWSTR server) static BOOL should_bypass_proxy(struct session *session, LPCWSTR server)
{ {
LPCWSTR ptr; LPCWSTR ptr;
BOOL ret = FALSE; BOOL ret = FALSE;
...@@ -480,7 +480,7 @@ static BOOL should_bypass_proxy(session_t *session, LPCWSTR server) ...@@ -480,7 +480,7 @@ static BOOL should_bypass_proxy(session_t *session, LPCWSTR server)
BOOL set_server_for_hostname( connect_t *connect, LPCWSTR server, INTERNET_PORT port ) BOOL set_server_for_hostname( connect_t *connect, LPCWSTR server, INTERNET_PORT port )
{ {
session_t *session = connect->session; struct session *session = connect->session;
BOOL ret = TRUE; BOOL ret = TRUE;
if (session->proxy_server && !should_bypass_proxy(session, server)) if (session->proxy_server && !should_bypass_proxy(session, server))
...@@ -546,7 +546,7 @@ end: ...@@ -546,7 +546,7 @@ end:
HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PORT port, DWORD reserved ) HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PORT port, DWORD reserved )
{ {
connect_t *connect; connect_t *connect;
session_t *session; struct session *session;
HINTERNET hconnect = NULL; HINTERNET hconnect = NULL;
TRACE("%p, %s, %u, %x\n", hsession, debugstr_w(server), port, reserved); TRACE("%p, %s, %u, %x\n", hsession, debugstr_w(server), port, reserved);
...@@ -556,7 +556,7 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PO ...@@ -556,7 +556,7 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PO
set_last_error( ERROR_INVALID_PARAMETER ); set_last_error( ERROR_INVALID_PARAMETER );
return NULL; return NULL;
} }
if (!(session = (session_t *)grab_object( hsession ))) if (!(session = (struct session *)grab_object( hsession )))
{ {
set_last_error( ERROR_INVALID_HANDLE ); set_last_error( ERROR_INVALID_HANDLE );
return NULL; return NULL;
...@@ -1003,7 +1003,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b ...@@ -1003,7 +1003,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b
} }
case WINHTTP_OPTION_PROXY_USERNAME: case WINHTTP_OPTION_PROXY_USERNAME:
{ {
session_t *session = request->connect->session; struct session *session = request->connect->session;
heap_free( session->proxy_username ); heap_free( session->proxy_username );
if (!(session->proxy_username = buffer_to_str( buffer, buflen ))) return FALSE; if (!(session->proxy_username = buffer_to_str( buffer, buflen ))) return FALSE;
...@@ -1011,7 +1011,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b ...@@ -1011,7 +1011,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b
} }
case WINHTTP_OPTION_PROXY_PASSWORD: case WINHTTP_OPTION_PROXY_PASSWORD:
{ {
session_t *session = request->connect->session; struct session *session = request->connect->session;
heap_free( session->proxy_password ); heap_free( session->proxy_password );
if (!(session->proxy_password = buffer_to_str( buffer, buflen ))) return FALSE; if (!(session->proxy_password = buffer_to_str( buffer, buflen ))) return FALSE;
...@@ -1886,14 +1886,14 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO ...@@ -1886,14 +1886,14 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO
{ {
WCHAR *detected_pac_url = NULL; WCHAR *detected_pac_url = NULL;
const WCHAR *pac_url; const WCHAR *pac_url;
session_t *session; struct session *session;
char *script; char *script;
DWORD size; DWORD size;
BOOL ret = FALSE; BOOL ret = FALSE;
TRACE("%p, %s, %p, %p\n", hsession, debugstr_w(url), options, info); TRACE("%p, %s, %p, %p\n", hsession, debugstr_w(url), options, info);
if (!(session = (session_t *)grab_object( hsession ))) if (!(session = (struct session *)grab_object( hsession )))
{ {
set_last_error( ERROR_INVALID_HANDLE ); set_last_error( ERROR_INVALID_HANDLE );
return FALSE; return FALSE;
...@@ -2114,7 +2114,7 @@ BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int ...@@ -2114,7 +2114,7 @@ BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int
} }
case WINHTTP_HANDLE_TYPE_SESSION: case WINHTTP_HANDLE_TYPE_SESSION:
{ {
session_t *session = (session_t *)hdr; struct session *session = (struct session *)hdr;
session->connect_timeout = connect; session->connect_timeout = connect;
if (resolve < 0) resolve = 0; if (resolve < 0) resolve = 0;
......
...@@ -75,32 +75,32 @@ struct hostdata ...@@ -75,32 +75,32 @@ struct hostdata
struct list connections; struct list connections;
}; };
typedef struct struct session
{ {
struct object_header hdr; struct object_header hdr;
CRITICAL_SECTION cs; CRITICAL_SECTION cs;
LPWSTR agent; 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 receive_timeout; int receive_timeout;
int receive_response_timeout; int receive_response_timeout;
LPWSTR proxy_server; WCHAR *proxy_server;
LPWSTR proxy_bypass; WCHAR *proxy_bypass;
LPWSTR proxy_username; WCHAR *proxy_username;
LPWSTR proxy_password; WCHAR *proxy_password;
struct list cookie_cache; struct list cookie_cache;
HANDLE unload_event; HANDLE unload_event;
CredHandle cred_handle; CredHandle cred_handle;
BOOL cred_handle_initialized; BOOL cred_handle_initialized;
DWORD secure_protocols; DWORD secure_protocols;
} session_t; };
typedef struct typedef struct
{ {
struct object_header hdr; struct object_header hdr;
session_t *session; struct session *session;
LPWSTR hostname; /* final destination of the request */ LPWSTR hostname; /* final destination of the request */
LPWSTR servername; /* name of the server we directly connect to */ LPWSTR servername; /* name of the server we directly connect to */
LPWSTR username; LPWSTR username;
...@@ -286,7 +286,7 @@ int netconn_get_cipher_strength( netconn_t * ) DECLSPEC_HIDDEN; ...@@ -286,7 +286,7 @@ int netconn_get_cipher_strength( netconn_t * ) 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;
BOOL add_request_headers( request_t *, LPCWSTR, DWORD, DWORD ) DECLSPEC_HIDDEN; BOOL add_request_headers( request_t *, LPCWSTR, DWORD, DWORD ) DECLSPEC_HIDDEN;
void destroy_cookies( session_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( connect_t *, LPCWSTR, INTERNET_PORT ) DECLSPEC_HIDDEN;
void destroy_authinfo( struct authinfo * ) DECLSPEC_HIDDEN; void destroy_authinfo( struct authinfo * ) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment