winhttp: Get rid of connect_t.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2018-11-22 21:15:52 +01:00 committed by Alexandre Julliard
parent a1cee8920a
commit dad2439d01
3 changed files with 21 additions and 21 deletions

View File

@ -1571,7 +1571,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; netconn_t *netconn = NULL;
connect_t *connect; struct connect *connect;
WCHAR *addressW = NULL; WCHAR *addressW = NULL;
INTERNET_PORT port; INTERNET_PORT port;
DWORD len; DWORD len;
@ -1751,7 +1751,7 @@ static BOOL add_host_header( request_t *request, DWORD modifier )
DWORD len; DWORD len;
WCHAR *host; WCHAR *host;
static const WCHAR fmt[] = {'%','s',':','%','u',0}; static const WCHAR fmt[] = {'%','s',':','%','u',0};
connect_t *connect = request->connect; struct connect *connect = request->connect;
INTERNET_PORT port; INTERNET_PORT port;
port = connect->hostport ? connect->hostport : (request->hdr.flags & WINHTTP_FLAG_SECURE ? 443 : 80); port = connect->hostport ? connect->hostport : (request->hdr.flags & WINHTTP_FLAG_SECURE ? 443 : 80);
@ -2175,7 +2175,7 @@ static BOOL send_request( request_t *request, LPCWSTR headers, DWORD headers_len
static const WCHAR length_fmt[] = {'%','l','d',0}; static const WCHAR length_fmt[] = {'%','l','d',0};
BOOL ret = FALSE; BOOL ret = FALSE;
connect_t *connect = request->connect; struct connect *connect = request->connect;
struct session *session = connect->session; struct session *session = connect->session;
char *wire_req; char *wire_req;
int bytes_sent; int bytes_sent;
@ -2623,7 +2623,7 @@ static BOOL handle_redirect( request_t *request, DWORD status )
BOOL ret = FALSE; BOOL ret = FALSE;
DWORD len, len_loc; DWORD len, len_loc;
URL_COMPONENTS uc; URL_COMPONENTS uc;
connect_t *connect = request->connect; struct connect *connect = request->connect;
INTERNET_PORT port; INTERNET_PORT port;
WCHAR *hostname = NULL, *location; WCHAR *hostname = NULL, *location;
int index; int index;

View File

@ -322,7 +322,7 @@ end:
*/ */
static void connect_destroy( struct object_header *hdr ) static void connect_destroy( struct object_header *hdr )
{ {
connect_t *connect = (connect_t *)hdr; struct connect *connect = (struct connect *)hdr;
TRACE("%p\n", connect); TRACE("%p\n", connect);
@ -337,7 +337,7 @@ static void connect_destroy( struct object_header *hdr )
static BOOL connect_query_option( struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen ) static BOOL connect_query_option( struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen )
{ {
connect_t *connect = (connect_t *)hdr; struct connect *connect = (struct connect *)hdr;
switch (option) switch (option)
{ {
@ -478,7 +478,7 @@ static BOOL should_bypass_proxy(struct session *session, LPCWSTR server)
return ret; return ret;
} }
BOOL set_server_for_hostname( connect_t *connect, LPCWSTR server, INTERNET_PORT port ) BOOL set_server_for_hostname( struct connect *connect, const WCHAR *server, INTERNET_PORT port )
{ {
struct session *session = connect->session; struct session *session = connect->session;
BOOL ret = TRUE; BOOL ret = TRUE;
@ -545,7 +545,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; struct connect *connect;
struct session *session; struct session *session;
HINTERNET hconnect = NULL; HINTERNET hconnect = NULL;
@ -567,7 +567,7 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PO
set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE );
return NULL; return NULL;
} }
if (!(connect = heap_alloc_zero( sizeof(connect_t) ))) if (!(connect = heap_alloc_zero( sizeof(struct connect) )))
{ {
release_object( &session->hdr ); release_object( &session->hdr );
return NULL; return NULL;
@ -987,7 +987,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b
case WINHTTP_OPTION_USERNAME: case WINHTTP_OPTION_USERNAME:
{ {
connect_t *connect = request->connect; struct connect *connect = request->connect;
heap_free( connect->username ); heap_free( connect->username );
if (!(connect->username = buffer_to_str( buffer, buflen ))) return FALSE; if (!(connect->username = buffer_to_str( buffer, buflen ))) return FALSE;
@ -995,7 +995,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b
} }
case WINHTTP_OPTION_PASSWORD: case WINHTTP_OPTION_PASSWORD:
{ {
connect_t *connect = request->connect; struct connect *connect = request->connect;
heap_free( connect->password ); heap_free( connect->password );
if (!(connect->password = buffer_to_str( buffer, buflen ))) return FALSE; if (!(connect->password = buffer_to_str( buffer, buflen ))) return FALSE;
@ -1110,7 +1110,7 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o
LPCWSTR referrer, LPCWSTR *types, DWORD flags ) LPCWSTR referrer, LPCWSTR *types, DWORD flags )
{ {
request_t *request; request_t *request;
connect_t *connect; struct connect *connect;
HINTERNET hrequest = NULL; HINTERNET hrequest = NULL;
TRACE("%p, %s, %s, %s, %s, %p, 0x%08x\n", hconnect, debugstr_w(verb), debugstr_w(object), TRACE("%p, %s, %s, %s, %s, %p, 0x%08x\n", hconnect, debugstr_w(verb), debugstr_w(object),
@ -1123,7 +1123,7 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o
for (iter = types; *iter; iter++) TRACE(" %s\n", debugstr_w(*iter)); for (iter = types; *iter; iter++) TRACE(" %s\n", debugstr_w(*iter));
} }
if (!(connect = (connect_t *)grab_object( hconnect ))) if (!(connect = (struct connect *)grab_object( hconnect )))
{ {
set_last_error( ERROR_INVALID_HANDLE ); set_last_error( ERROR_INVALID_HANDLE );
return NULL; return NULL;

View File

@ -97,19 +97,19 @@ struct session
DWORD secure_protocols; DWORD secure_protocols;
}; };
typedef struct struct connect
{ {
struct object_header hdr; struct object_header hdr;
struct session *session; struct session *session;
LPWSTR hostname; /* final destination of the request */ WCHAR *hostname; /* final destination of the request */
LPWSTR servername; /* name of the server we directly connect to */ WCHAR *servername; /* name of the server we directly connect to */
LPWSTR username; WCHAR *username;
LPWSTR password; WCHAR *password;
INTERNET_PORT hostport; INTERNET_PORT hostport;
INTERNET_PORT serverport; INTERNET_PORT serverport;
struct sockaddr_storage sockaddr; struct sockaddr_storage sockaddr;
BOOL resolved; BOOL resolved;
} connect_t; };
typedef struct typedef struct
{ {
@ -171,7 +171,7 @@ struct authinfo
typedef struct typedef struct
{ {
struct object_header hdr; struct object_header hdr;
connect_t *connect; struct connect *connect;
LPWSTR verb; LPWSTR verb;
LPWSTR path; LPWSTR path;
LPWSTR version; LPWSTR version;
@ -287,7 +287,7 @@ 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( struct session * ) DECLSPEC_HIDDEN; void destroy_cookies( struct session * ) DECLSPEC_HIDDEN;
BOOL set_server_for_hostname( connect_t *, LPCWSTR, INTERNET_PORT ) DECLSPEC_HIDDEN; BOOL set_server_for_hostname( struct connect *, const WCHAR *, INTERNET_PORT ) DECLSPEC_HIDDEN;
void destroy_authinfo( struct authinfo * ) DECLSPEC_HIDDEN; void destroy_authinfo( struct authinfo * ) DECLSPEC_HIDDEN;
void release_host( struct hostdata *host ) DECLSPEC_HIDDEN; void release_host( struct hostdata *host ) DECLSPEC_HIDDEN;