Commit 96bf72f2 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Add status notification tests. Make them pass.

parent a74b52cf
...@@ -674,14 +674,18 @@ static BOOL open_connection( request_t *request ) ...@@ -674,14 +674,18 @@ static BOOL open_connection( request_t *request )
WCHAR *addressW; WCHAR *addressW;
if (netconn_connected( &request->netconn )) return TRUE; if (netconn_connected( &request->netconn )) return TRUE;
connect = request->connect; connect = request->connect;
if (!netconn_resolve( connect->servername, connect->serverport, &connect->sockaddr )) return FALSE;
send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, connect->servername, strlenW(connect->servername) + 1 );
if (!netconn_resolve( connect->servername, connect->serverport, &connect->sockaddr )) return FALSE;
inet_ntop( connect->sockaddr.sin_family, &connect->sockaddr.sin_addr, address, sizeof(address) ); inet_ntop( connect->sockaddr.sin_family, &connect->sockaddr.sin_addr, address, sizeof(address) );
TRACE("connecting to %s:%u\n", address, ntohs(connect->sockaddr.sin_port));
addressW = strdupAW( address ); addressW = strdupAW( address );
send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, addressW, strlenW(addressW) + 1 );
TRACE("connecting to %s:%u\n", address, ntohs(connect->sockaddr.sin_port));
send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, addressW, 0 ); send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, addressW, 0 );
if (!netconn_create( &request->netconn, connect->sockaddr.sin_family, SOCK_STREAM, 0 )) if (!netconn_create( &request->netconn, connect->sockaddr.sin_family, SOCK_STREAM, 0 ))
...@@ -702,7 +706,7 @@ static BOOL open_connection( request_t *request ) ...@@ -702,7 +706,7 @@ static BOOL open_connection( request_t *request )
return FALSE; return FALSE;
} }
send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, addressW, 0 ); send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, addressW, strlenW(addressW) + 1 );
heap_free( addressW ); heap_free( addressW );
return TRUE; return TRUE;
......
...@@ -38,7 +38,7 @@ void set_last_error( DWORD error ) ...@@ -38,7 +38,7 @@ void set_last_error( DWORD error )
void send_callback( object_header_t *hdr, DWORD status, LPVOID info, DWORD buflen ) void send_callback( object_header_t *hdr, DWORD status, LPVOID info, DWORD buflen )
{ {
TRACE("%p, %u, %p, %u\n", hdr, status, info, buflen); TRACE("%p, 0x%08x, %p, %u\n", hdr, status, info, buflen);
if (hdr->notify_mask & status) hdr->callback( hdr->handle, hdr->context, status, info, buflen ); if (hdr->notify_mask & status) hdr->callback( hdr->handle, hdr->context, status, info, buflen );
} }
...@@ -170,6 +170,7 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PO ...@@ -170,6 +170,7 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PO
connect->hdr.flags = session->hdr.flags; connect->hdr.flags = session->hdr.flags;
connect->hdr.callback = session->hdr.callback; connect->hdr.callback = session->hdr.callback;
connect->hdr.notify_mask = session->hdr.notify_mask; connect->hdr.notify_mask = session->hdr.notify_mask;
connect->hdr.context = session->hdr.context;
addref_object( &session->hdr ); addref_object( &session->hdr );
connect->session = session; connect->session = session;
...@@ -261,6 +262,7 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o ...@@ -261,6 +262,7 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o
request->hdr.flags = flags; request->hdr.flags = flags;
request->hdr.callback = connect->hdr.callback; request->hdr.callback = connect->hdr.callback;
request->hdr.notify_mask = connect->hdr.notify_mask; request->hdr.notify_mask = connect->hdr.notify_mask;
request->hdr.context = connect->hdr.context;
addref_object( &connect->hdr ); addref_object( &connect->hdr );
request->connect = connect; request->connect = connect;
......
...@@ -6,6 +6,7 @@ TESTDLL = winhttp.dll ...@@ -6,6 +6,7 @@ TESTDLL = winhttp.dll
IMPORTS = winhttp kernel32 IMPORTS = winhttp kernel32
CTESTS = \ CTESTS = \
notification.c \
winhttp.c winhttp.c
@MAKE_TEST_RULES@ @MAKE_TEST_RULES@
......
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