ReactOS  0.4.14-dev-604-gcfdd483
http.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include "windef.h"
#include "winbase.h"
#include "wininet.h"
#include "winineti.h"
#include "winsock2.h"
#include "wine/test.h"
Include dependency graph for http.c:

Go to the source code of this file.

Classes

struct  test_data_t
 
struct  test_request_t
 
struct  server_info
 
struct  http_status_test_t
 
struct  large_test
 
struct  cert_struct_test_t
 
struct  context
 
struct  notification
 
struct  info
 
struct  notification_data
 

Macros

#define _SECURITY_FLAG_CERT_REV_FAILED   0x00800000
 
#define _SECURITY_FLAG_CERT_INVALID_CA   0x01000000
 
#define _SECURITY_FLAG_CERT_INVALID_CN   0x02000000
 
#define _SECURITY_FLAG_CERT_INVALID_DATE   0x04000000
 
#define TEST_URL   "http://test.winehq.org/tests/hello.html"
 
#define SET_EXPECT2(status, num)   expect[status] = num
 
#define SET_EXPECT(status)   SET_EXPECT2(status, 1)
 
#define SET_OPTIONAL2(status, num)   optional[status] = num
 
#define SET_OPTIONAL(status)   SET_OPTIONAL2(status, 1)
 
#define SET_WINE_ALLOW2(status, num)   wine_allow[status] = num
 
#define SET_WINE_ALLOW(status)   SET_WINE_ALLOW2(status, 1)
 
#define CHECK_EXPECT(status)
 
#define CLEAR_NOTIFIED(status)   expect[status] = optional[status] = wine_allow[status] = notified[status] = 0;
 
#define CHECK_NOTIFIED2(status, num)
 
#define CHECK_NOTIFIED(status)   CHECK_NOTIFIED2(status, 1)
 
#define CHECK_NOT_NOTIFIED(status)   CHECK_NOTIFIED2(status, 0)
 
#define MAX_INTERNET_STATUS   (INTERNET_STATUS_COOKIE_HISTORY+1)
 
#define TESTF_REDIRECT   0x01
 
#define TESTF_COMPRESSED   0x02
 
#define TESTF_CHUNKED   0x04
 
#define test_status_code(a, b)   _test_status_code(__LINE__,a,b, FALSE)
 
#define test_status_code_todo(a, b)   _test_status_code(__LINE__,a,b, TRUE)
 
#define test_request_flags(a, b)   _test_request_flags(__LINE__,a,b,FALSE)
 
#define test_request_flags_todo(a, b)   _test_request_flags(__LINE__,a,b,TRUE)
 
#define test_request_url(a, b)   _test_request_url(__LINE__,a,b)
 
#define test_http_version(a)   _test_http_version(__LINE__,a)
 
#define open_simple_request(a, b, c, d, e)   _open_simple_request(__LINE__,a,b,c,d,e)
 
#define close_request(a)   _close_request(__LINE__,a)
 
#define receive_simple_request(a, b, c)   _receive_simple_request(__LINE__,a,b,c)
 
#define server_read_request(a)   _server_read_request(__LINE__,a)
 
#define readex_expect_sync_data_len(a, b, c, d, e, f, g)   _readex_expect_sync_data_len(__LINE__,a,b,c,d,e,f,g)
 
#define readex_expect_sync_data(a, b, c, d, e, f)   _readex_expect_sync_data(__LINE__,a,b,c,d,e,f)
 
#define read_expect_sync_data_len(a, b, c, d, e)   _read_expect_sync_data_len(__LINE__,a,b,c,d,e)
 
#define read_expect_sync_data(a, b, c, d)   _read_expect_sync_data(__LINE__,a,b,c,d)
 
#define send_response_and_wait(a, b, c, d, e, f, g, h)   _send_response_and_wait(__LINE__,a,b,c,d,e,f,g,h)
 
#define send_response_ex_and_wait(a, b, c, d, e, f)   _send_response_ex_and_wait(__LINE__,a,b,c,d,e,f)
 
#define readex_expect_async(a, b, c, d, e)   _readex_expect_async(__LINE__,a,b,c,d,e)
 
#define expect_data_available(a, b)   _expect_data_available(__LINE__,a,b)
 
#define async_query_data_available(a, b)   _async_query_data_available(__LINE__,a,b)
 
#define test_security_info(a, b, c)   _test_security_info(__LINE__,a,b,c)
 
#define test_secflags_option(a, b, c)   _test_secflags_option(__LINE__,a,b,c)
 
#define set_secflags(a, b, c)   _set_secflags(__LINE__,a,b,c)
 
#define STATUS_STRING(status)   status_string[status] = #status
 

Enumerations

enum  api {
  winhttp_connect = 1, winhttp_open_request, winhttp_send_request, winhttp_receive_response,
  winhttp_query_data, winhttp_read_data, winhttp_write_data, winhttp_close_handle,
  internet_connect = 1, http_open_request, http_send_request_ex, internet_writefile,
  http_end_request, internet_close_handle
}
 

Functions

static INTERNET_STATUS_CALLBACK (WINAPI *pInternetSetStatusCallbackA)(HINTERNET
 
static BOOL (WINAPI *pInternetGetSecurityInfoByURLA)(LPSTR
 
static PCCERT_CHAIN_CONTEXT DWORD *static int strcmp_wa (LPCWSTR strw, const char *stra)
 
static BOOL proxy_active (void)
 
static void init_events (void)
 
static void free_events (void)
 
static void reset_events (void)
 
static void _test_status_code (unsigned line, HINTERNET req, DWORD excode, BOOL is_todo)
 
static void _test_request_flags (unsigned line, HINTERNET req, DWORD exflags, BOOL is_todo)
 
static void _test_request_url (unsigned line, HINTERNET req, const char *expected_url)
 
static void _test_http_version (unsigned line, HINTERNET req)
 
static VOID WINAPI callback (HINTERNET hInternet, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength)
 
static void _open_simple_request (unsigned line, test_request_t *req, const char *host, int port, const char *verb, const char *url)
 
static void _close_request (unsigned line, test_request_t *req)
 
static DWORD _receive_simple_request (unsigned line, HINTERNET req, char *buf, size_t buf_size)
 
static void close_async_handle (HINTERNET handle, int handle_cnt)
 
static void InternetReadFile_test (int flags, const test_data_t *test)
 
static void InternetReadFile_chunked_test (void)
 
static void InternetReadFileExA_test (int flags)
 
static void InternetOpenUrlA_test (void)
 
static void HttpSendRequestEx_test (void)
 
static void InternetOpenRequest_test (void)
 
static void test_cache_read (void)
 
static void test_http_cache (void)
 
static void InternetLockRequestFile_test (void)
 
static void HttpHeaders_test (void)
 
static DWORD CALLBACK server_thread (LPVOID param)
 
static void test_basic_request (int port, const char *verb, const char *url)
 
static void test_proxy_indirect (int port)
 
static void test_proxy_direct (int port)
 
static void test_header_handling_order (int port)
 
static void test_connection_header (int port)
 
static void test_header_override (int port)
 
static void test_connection_closing (int port)
 
static void test_successive_HttpSendRequest (int port)
 
static void test_no_content (int port)
 
static void test_conn_close (int port)
 
static void test_no_cache (int port)
 
static void test_cache_read_gzipped (int port)
 
static void test_HttpSendRequestW (int port)
 
static void test_cookie_header (int port)
 
static void test_basic_authentication (int port)
 
static void test_premature_disconnect (int port)
 
static void test_invalid_response_headers (int port)
 
static void test_response_without_headers (int port)
 
static void test_head_request (int port)
 
static void test_HttpQueryInfo (int port)
 
static void test_options (int port)
 
static void test_http_status (int port)
 
static void test_cache_control_verb (int port)
 
static void test_request_content_length (int port)
 
static void test_accept_encoding (int port)
 
static void test_basic_auth_credentials_reuse (int port)
 
static void test_basic_auth_credentials_end_session (int port)
 
static void test_basic_auth_credentials_different (int port)
 
static void test_basic_auth_credentials_manual (int port)
 
static void test_basic_auth_credentials_cached_manual (int port)
 
static void test_async_read (int port)
 
static void server_send_string (const char *msg)
 
static size_t server_read_data (char *buf, size_t buf_size)
 
static void _server_read_request (unsigned line, const char *expected_request)
 
static void WINAPI readex_callback (HINTERNET handle, DWORD_PTR context, DWORD status, void *info, DWORD info_size)
 
static void send_socket_request (test_request_t *req, BOOL new_connection)
 
static void open_socket_request (int port, test_request_t *req, const char *verb)
 
static void open_read_test_request (int port, test_request_t *req, const char *response)
 
static void _readex_expect_sync_data_len (unsigned line, HINTERNET req, DWORD flags, INTERNET_BUFFERSW *buf, DWORD buf_size, const char *exdata, DWORD len, DWORD expect_receive)
 
static void _readex_expect_sync_data (unsigned line, HINTERNET req, DWORD flags, INTERNET_BUFFERSW *buf, DWORD buf_size, const char *exdata, DWORD expect_receive)
 
static void _read_expect_sync_data_len (unsigned line, HINTERNET req, void *buf, DWORD buf_size, const char *exdata, DWORD len)
 
static void _read_expect_sync_data (unsigned line, HINTERNET req, void *buf, DWORD buf_size, const char *exdata)
 
static void close_connection (void)
 
static void _send_response_and_wait (unsigned line, const char *response, BOOL do_close_connection, void *buf, DWORD *ret_size, const char *exdata, DWORD expected_size, DWORD expected_req_error, DWORD expected_receive_size)
 
static void _send_response_ex_and_wait (unsigned line, const char *response, BOOL close_connection, INTERNET_BUFFERSW *buf, const char *exdata, DWORD expected_req_error, DWORD expected_receive_size)
 
static void send_response_len_and_wait (unsigned len, BOOL close_connection, INTERNET_BUFFERSW *buf)
 
static void _readex_expect_async (unsigned line, HINTERNET req, DWORD flags, INTERNET_BUFFERSW *buf, DWORD buf_size, const char *exdata)
 
static void read_expect_async (HINTERNET req, void *buf, DWORD buf_size, DWORD *ret_size, const char *exdata)
 
static DWORD _expect_data_available (unsigned line, HINTERNET req, int exsize)
 
static void _async_query_data_available (unsigned line, HINTERNET req, DWORD *size)
 
static void test_http_read (int port)
 
static void test_connection_break (int port)
 
static void test_long_url (int port)
 
static void test_persistent_connection (int port)
 
static void test_redirect (int port)
 
static void test_remove_dot_segments (int port)
 
static void test_large_content (int port)
 
static void test_http_connection (void)
 
static void release_cert_info (INTERNET_CERTIFICATE_INFOA *info)
 
static void test_cert_struct (HINTERNET req, const cert_struct_test_t *test)
 
static void _test_security_info (unsigned line, const char *urlc, DWORD error, DWORD ex_flags)
 
static void _test_secflags_option (unsigned line, HINTERNET req, DWORD ex_flags, DWORD opt_flags)
 
static void _set_secflags (unsigned line, HINTERNET req, BOOL use_undoc, DWORD flags)
 
static void test_security_flags (void)
 
static void test_secure_connection (void)
 
static void test_user_agent_header (void)
 
static void test_bogus_accept_types_array (void)
 
static void WINAPI cb (HINTERNET handle, DWORD_PTR context, DWORD status, LPVOID info, DWORD size)
 
static void test_open_url_async (void)
 
static void CALLBACK check_notification (HINTERNET handle, DWORD_PTR context, DWORD status, LPVOID buffer, DWORD buflen)
 
static void setup_test (struct info *info, enum api function, unsigned int line, DWORD expect_result)
 
static void test_async_HttpSendRequestEx (const struct notification_data *nd)
 
static void WINAPI closetest_callback (HINTERNET hInternet, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength)
 
static void test_InternetCloseHandle (void)
 
static void test_connection_failure (void)
 
static void test_default_service_port (void)
 
static void init_status_tests (void)
 
static void WINAPI header_cb (HINTERNET handle, DWORD_PTR ctx, DWORD status, LPVOID info, DWORD len)
 
static void test_concurrent_header_access (void)
 
 START_TEST (http)
 

Variables

static BOOL first_connection_to_test_url = TRUE
 
static int expect [MAX_INTERNET_STATUS]
 
static int optional [MAX_INTERNET_STATUS]
 
static int wine_allow [MAX_INTERNET_STATUS]
 
static int notified [MAX_INTERNET_STATUS]
 
static const charstatus_string [MAX_INTERNET_STATUS]
 
static HANDLE complete_event
 
static HANDLE conn_close_event
 
static HANDLE conn_wait_event
 
static HANDLE server_req_rec_event
 
static HANDLE request_sent_event
 
static DWORD req_error
 
static BOOL is_ie7plus = TRUE
 
static const test_data_t test_data []
 
static INTERNET_STATUS_CALLBACK
 
static int close_handle_cnt
 
static const char garbagemsg []
 
static const char contmsg []
 
static const char expandcontmsg []
 
static const char okmsg []
 
static const char okmsg201 []
 
static const char okmsg2 []
 
static DWORD64 content_length
 
static const char largemsg []
 
static const char okmsg_cookie_path []
 
static const char okmsg_cookie []
 
static const char notokmsg []
 
static const char noauthmsg []
 
static const char noauthmsg2 []
 
static const char proxymsg []
 
static const char page1 []
 
static const char ok_with_length []
 
static const char ok_with_length2 []
 
static int test_cache_gzip
 
static const charsend_buffer
 
static int server_socket
 
static const http_status_test_t http_status_tests []
 
static BOOL skip_receive_notification_tests
 
static DWORD received_response_size
 
static const cert_struct_test_t test_winehq_org_cert
 
static const cert_struct_test_t test_winehq_com_cert
 
static CRITICAL_SECTION notification_cs
 
static const struct notification async_send_request_ex_test []
 
static const struct notification async_send_request_ex_test2 []
 
static const struct notification async_send_request_ex_resolve_failure_test []
 
static const struct notification async_send_request_ex_chunked_test []
 
static const struct notification_data notification_data []
 
static HINTERNET closetest_session
 
static HINTERNET closetest_req
 
static HINTERNET closetest_conn
 
static BOOL closetest_closed
 

Macro Definition Documentation

◆ _SECURITY_FLAG_CERT_INVALID_CA

#define _SECURITY_FLAG_CERT_INVALID_CA   0x01000000

Definition at line 38 of file http.c.

◆ _SECURITY_FLAG_CERT_INVALID_CN

#define _SECURITY_FLAG_CERT_INVALID_CN   0x02000000

Definition at line 39 of file http.c.

◆ _SECURITY_FLAG_CERT_INVALID_DATE

#define _SECURITY_FLAG_CERT_INVALID_DATE   0x04000000

Definition at line 40 of file http.c.

◆ _SECURITY_FLAG_CERT_REV_FAILED

#define _SECURITY_FLAG_CERT_REV_FAILED   0x00800000

Definition at line 37 of file http.c.

◆ async_query_data_available

#define async_query_data_available (   a,
  b 
)    _async_query_data_available(__LINE__,a,b)

Definition at line 5651 of file http.c.

◆ CHECK_EXPECT

#define CHECK_EXPECT (   status)
Value:
do { \
{ \
todo_wine ok(expect[status], "unexpected status %d (%s)\n", status, \
status_string[status] : "unknown"); \
wine_allow[status]--; \
} \
else \
{ \
ok(expect[status] || optional[status], "unexpected status %d (%s)\n", status, \
status_string[status] : "unknown"); \
if (expect[status]) expect[status]--; \
else if(optional[status]) optional[status]--; \
} \
notified[status]++; \
}while(0)
static int expect[MAX_INTERNET_STATUS]
Definition: http.c:109
static const char * status_string[MAX_INTERNET_STATUS]
Definition: http.c:111
static int wine_allow[MAX_INTERNET_STATUS]
Definition: http.c:109
#define ok(value,...)
Definition: atltest.h:57
#define MAX_INTERNET_STATUS
Definition: http.c:108
static int optional[MAX_INTERNET_STATUS]
Definition: http.c:109
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Definition at line 68 of file http.c.

◆ CHECK_NOT_NOTIFIED

#define CHECK_NOT_NOTIFIED (   status)    CHECK_NOTIFIED2(status, 0)

Definition at line 105 of file http.c.

◆ CHECK_NOTIFIED

#define CHECK_NOTIFIED (   status)    CHECK_NOTIFIED2(status, 1)

Definition at line 102 of file http.c.

◆ CHECK_NOTIFIED2

#define CHECK_NOTIFIED2 (   status,
  num 
)
Value:
do { \
"expected status %d (%s) %d times, received %d times\n", \
status_string[status] : "unknown", (num), notified[status]); \
CLEAR_NOTIFIED(status); \
}while(0)
static const char * status_string[MAX_INTERNET_STATUS]
Definition: http.c:111
static int notified[MAX_INTERNET_STATUS]
Definition: http.c:109
GLuint GLuint num
Definition: glext.h:9618
#define MAX_INTERNET_STATUS
Definition: http.c:108
static int optional[MAX_INTERNET_STATUS]
Definition: http.c:109
Definition: ps.c:97

Definition at line 93 of file http.c.

◆ CLEAR_NOTIFIED

#define CLEAR_NOTIFIED (   status)    expect[status] = optional[status] = wine_allow[status] = notified[status] = 0;

Definition at line 90 of file http.c.

◆ close_request

#define close_request (   a)    _close_request(__LINE__,a)

Definition at line 526 of file http.c.

◆ expect_data_available

#define expect_data_available (   a,
  b 
)    _expect_data_available(__LINE__,a,b)

Definition at line 5637 of file http.c.

◆ MAX_INTERNET_STATUS

#define MAX_INTERNET_STATUS   (INTERNET_STATUS_COOKIE_HISTORY+1)

Definition at line 108 of file http.c.

◆ open_simple_request

#define open_simple_request (   a,
  b,
  c,
  d,
  e 
)    _open_simple_request(__LINE__,a,b,c,d,e)

Definition at line 512 of file http.c.

◆ read_expect_sync_data

#define read_expect_sync_data (   a,
  b,
  c,
  d 
)    _read_expect_sync_data(__LINE__,a,b,c,d)

Definition at line 5517 of file http.c.

◆ read_expect_sync_data_len

#define read_expect_sync_data_len (   a,
  b,
  c,
  d,
  e 
)    _read_expect_sync_data_len(__LINE__,a,b,c,d,e)

Definition at line 5491 of file http.c.

◆ readex_expect_async

#define readex_expect_async (   a,
  b,
  c,
  d,
  e 
)    _readex_expect_async(__LINE__,a,b,c,d,e)

Definition at line 5586 of file http.c.

◆ readex_expect_sync_data

#define readex_expect_sync_data (   a,
  b,
  c,
  d,
  e,
  f 
)    _readex_expect_sync_data(__LINE__,a,b,c,d,e,f)

Definition at line 5484 of file http.c.

◆ readex_expect_sync_data_len

#define readex_expect_sync_data_len (   a,
  b,
  c,
  d,
  e,
  f,
  g 
)    _readex_expect_sync_data_len(__LINE__,a,b,c,d,e,f,g)

Definition at line 5457 of file http.c.

◆ receive_simple_request

#define receive_simple_request (   a,
  b,
  c 
)    _receive_simple_request(__LINE__,a,b,c)

Definition at line 539 of file http.c.

◆ send_response_and_wait

#define send_response_and_wait (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)    _send_response_and_wait(__LINE__,a,b,c,d,e,f,g,h)

Definition at line 5531 of file http.c.

◆ send_response_ex_and_wait

#define send_response_ex_and_wait (   a,
  b,
  c,
  d,
  e,
  f 
)    _send_response_ex_and_wait(__LINE__,a,b,c,d,e,f)

Definition at line 5565 of file http.c.

◆ server_read_request

#define server_read_request (   a)    _server_read_request(__LINE__,a)

Definition at line 5336 of file http.c.

◆ SET_EXPECT

#define SET_EXPECT (   status)    SET_EXPECT2(status, 1)

Definition at line 51 of file http.c.

◆ SET_EXPECT2

#define SET_EXPECT2 (   status,
  num 
)    expect[status] = num

Definition at line 48 of file http.c.

◆ SET_OPTIONAL

#define SET_OPTIONAL (   status)    SET_OPTIONAL2(status, 1)

Definition at line 57 of file http.c.

◆ SET_OPTIONAL2

#define SET_OPTIONAL2 (   status,
  num 
)    optional[status] = num

Definition at line 54 of file http.c.

◆ set_secflags

#define set_secflags (   a,
  b,
  c 
)    _set_secflags(__LINE__,a,b,c)

Definition at line 6504 of file http.c.

◆ SET_WINE_ALLOW

#define SET_WINE_ALLOW (   status)    SET_WINE_ALLOW2(status, 1)

Definition at line 65 of file http.c.

◆ SET_WINE_ALLOW2

#define SET_WINE_ALLOW2 (   status,
  num 
)    wine_allow[status] = num

Definition at line 62 of file http.c.

◆ STATUS_STRING

#define STATUS_STRING (   status)    status_string[status] = #status

◆ test_http_version

#define test_http_version (   a)    _test_http_version(__LINE__,a)

Definition at line 331 of file http.c.

◆ test_request_flags

#define test_request_flags (   a,
  b 
)    _test_request_flags(__LINE__,a,b,FALSE)

Definition at line 300 of file http.c.

◆ test_request_flags_todo

#define test_request_flags_todo (   a,
  b 
)    _test_request_flags(__LINE__,a,b,TRUE)

Definition at line 301 of file http.c.

◆ test_request_url

#define test_request_url (   a,
  b 
)    _test_request_url(__LINE__,a,b)

Definition at line 318 of file http.c.

◆ test_secflags_option

#define test_secflags_option (   a,
  b,
  c 
)    _test_secflags_option(__LINE__,a,b,c)

Definition at line 6482 of file http.c.

◆ test_security_info

#define test_security_info (   a,
  b,
  c 
)    _test_security_info(__LINE__,a,b,c)

Definition at line 6442 of file http.c.

◆ test_status_code

#define test_status_code (   a,
  b 
)    _test_status_code(__LINE__,a,b, FALSE)

Definition at line 226 of file http.c.

◆ test_status_code_todo

#define test_status_code_todo (   a,
  b 
)    _test_status_code(__LINE__,a,b, TRUE)

Definition at line 227 of file http.c.

◆ TEST_URL

#define TEST_URL   "http://test.winehq.org/tests/hello.html"

Definition at line 42 of file http.c.

◆ TESTF_CHUNKED

#define TESTF_CHUNKED   0x04

Definition at line 119 of file http.c.

◆ TESTF_COMPRESSED

#define TESTF_COMPRESSED   0x02

Definition at line 118 of file http.c.

◆ TESTF_REDIRECT

#define TESTF_REDIRECT   0x01

Definition at line 117 of file http.c.

Enumeration Type Documentation

◆ api

Enumerator
winhttp_connect 
winhttp_open_request 
winhttp_send_request 
winhttp_receive_response 
winhttp_query_data 
winhttp_read_data 
winhttp_write_data 
winhttp_close_handle 
internet_connect 
http_open_request 
http_send_request_ex 
internet_writefile 
http_end_request 
internet_close_handle 

Definition at line 7201 of file http.c.

Function Documentation

◆ _async_query_data_available()

static void _async_query_data_available ( unsigned  line,
HINTERNET  req,
DWORD size 
)
static

Definition at line 5652 of file http.c.

5653 {
5654  BOOL res;
5655 
5658 
5659  *size = 0xdeadbeef;
5660  res = InternetQueryDataAvailable(req, size, 0, 0);
5661  ok_(__FILE__,line)(!res && GetLastError() == ERROR_IO_PENDING,
5662  "InternetQueryDataAvailable returned: %x(%u)\n", res, GetLastError());
5663  ok_(__FILE__,line)(!*size, "size = %u\n", *size);
5664 
5667 }
static BOOL skip_receive_notification_tests
Definition: http.c:5349
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ERROR_IO_PENDING
Definition: dderror.h:15
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI InternetQueryDataAvailable(HINTERNET hFile, LPDWORD lpdwNumberOfBytesAvailable, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3842
#define INTERNET_STATUS_RECEIVING_RESPONSE
Definition: wininet.h:889
Definition: parser.c:48
#define SET_EXPECT(status)
Definition: http.c:51
GLsizeiptr size
Definition: glext.h:5919
#define CHECK_NOTIFIED(status)
Definition: http.c:102
GLuint res
Definition: glext.h:9613
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _close_request()

static void _close_request ( unsigned  line,
test_request_t req 
)
static

Definition at line 527 of file http.c.

528 {
529  BOOL ret;
530 
532  ok_(__FILE__,line)(ret, "InternetCloseHandle(request) failed: %u\n", GetLastError());
534  ok_(__FILE__,line)(ret, "InternetCloseHandle(connection) failed: %u\n", GetLastError());
536  ok_(__FILE__,line)(ret, "InternetCloseHandle(session) failed: %u\n", GetLastError());
537 }
HINTERNET session
Definition: http.c:507
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1436
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: parser.c:48
HINTERNET request
Definition: http.c:509
int ret
HINTERNET connection
Definition: http.c:508
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _expect_data_available()

static DWORD _expect_data_available ( unsigned  line,
HINTERNET  req,
int  exsize 
)
static

Definition at line 5638 of file http.c.

5639 {
5640  DWORD size = 0;
5641  BOOL res;
5642 
5643  res = InternetQueryDataAvailable(req, &size, 0, 0);
5644  ok_(__FILE__,line)(res, "InternetQueryDataAvailable failed: %u\n", GetLastError());
5645  if(exsize != -1)
5646  ok_(__FILE__,line)(size == exsize, "size = %u, expected %u\n", size, exsize);
5647 
5648  return size;
5649 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI InternetQueryDataAvailable(HINTERNET hFile, LPDWORD lpdwNumberOfBytesAvailable, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3842
Definition: parser.c:48
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _open_simple_request()

static void _open_simple_request ( unsigned  line,
test_request_t req,
const char host,
int  port,
const char verb,
const char url 
)
static

Definition at line 513 of file http.c.

515 {
517  ok_(__FILE__,line)(req->session != NULL, "InternetOpenA failed: %u\n", GetLastError());
518 
520  ok_(__FILE__,line)(req->connection != NULL, "InternetConnectA failed: %u\n", GetLastError());
521 
522  req->request = HttpOpenRequestA(req->connection, verb, url, NULL, NULL, NULL, 0, 0);
523  ok_(__FILE__,line)(req->request != NULL, "HttpOpenRequest failed: %u\n", GetLastError());
524 }
HINTERNET session
Definition: http.c:507
char * host
Definition: whois.c:55
HINTERNET WINAPI InternetConnectA(HINTERNET hInternet, LPCSTR lpszServerName, INTERNET_PORT nServerPort, LPCSTR lpszUserName, LPCSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:1343
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType, LPCSTR lpszProxy, LPCSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1079
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
HINTERNET request
Definition: http.c:509
static const WCHAR url[]
Definition: encode.c:1432
#define INTERNET_OPEN_TYPE_DIRECT
Definition: wininet.h:522
HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession, LPCSTR lpszVerb, LPCSTR lpszObjectName, LPCSTR lpszVersion, LPCSTR lpszReferrer, LPCSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:1509
USHORT port
Definition: uri.c:228
#define INTERNET_SERVICE_HTTP
Definition: wininet.h:562
HINTERNET connection
Definition: http.c:508
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _read_expect_sync_data()

static void _read_expect_sync_data ( unsigned  line,
HINTERNET  req,
void buf,
DWORD  buf_size,
const char exdata 
)
static

Definition at line 5518 of file http.c.

5520 {
5521  _read_expect_sync_data_len(line, req, buf, buf_size, exdata, strlen(exdata));
5522 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static void _read_expect_sync_data_len(unsigned line, HINTERNET req, void *buf, DWORD buf_size, const char *exdata, DWORD len)
Definition: http.c:5492
Definition: parser.c:48

◆ _read_expect_sync_data_len()

static void _read_expect_sync_data_len ( unsigned  line,
HINTERNET  req,
void buf,
DWORD  buf_size,
const char exdata,
DWORD  len 
)
static

Definition at line 5492 of file http.c.

5494 {
5495  DWORD ret_size = 0xdeadbeef;
5496  BOOL ret;
5497 
5501  received_response_size = 0xdeadbeef;
5502 
5503  memset(buf, 0xff, buf_size);
5504  ret = InternetReadFile(req, buf, buf_size, &ret_size);
5505  ok_(__FILE__,line)(ret, "InternetReadFileExW failed: %u\n", GetLastError());
5506  ok_(__FILE__,line)(ret_size == len, "dwBufferLength = %u, expected %u\n", ret_size, len);
5507  if(len && exdata)
5508  ok_(__FILE__,line)(!memcmp(buf, exdata, len), "Unexpected data\n");
5509 
5513  ok_(__FILE__,line)(received_response_size == len, "received_response_size = %u\n", received_response_size);
5514  ok_(__FILE__,line)(!req_error, "req_error = %u\n", req_error);
5515 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
#define INTERNET_STATUS_RECEIVING_RESPONSE
Definition: wininet.h:889
Definition: parser.c:48
#define SET_EXPECT(status)
Definition: http.c:51
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
static DWORD req_error
Definition: http.c:114
#define CHECK_NOTIFIED(status)
Definition: http.c:102
#define INTERNET_STATUS_REQUEST_COMPLETE
Definition: wininet.h:898
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
Definition: internet.c:2174
#define CLEAR_NOTIFIED(status)
Definition: http.c:90
static DWORD received_response_size
Definition: http.c:5350
#define memset(x, y, z)
Definition: compat.h:39
#define INTERNET_STATUS_RESPONSE_RECEIVED
Definition: wininet.h:890
#define ok_(x1, x2)
Definition: atltest.h:61

Referenced by _read_expect_sync_data().

◆ _readex_expect_async()

static void _readex_expect_async ( unsigned  line,
HINTERNET  req,
DWORD  flags,
INTERNET_BUFFERSW buf,
DWORD  buf_size,
const char exdata 
)
static

Definition at line 5587 of file http.c.

5589 {
5590  unsigned len = 0;
5591  BOOL ret;
5592 
5595 
5596  memset(buf->lpvBuffer, 0, max(buf_size, sizeof(DWORD)));
5597  buf->dwBufferLength = buf_size;
5598  ret = InternetReadFileExW(req, buf, flags, 0xdeadbeef);
5599  ok_(__FILE__,line)(!ret && GetLastError() == ERROR_IO_PENDING, "InternetReadFileExW returned %x (%u)\n", ret, GetLastError());
5600  ok_(__FILE__,line)(buf->dwBufferLength == buf_size, "dwBufferLength = %u, expected %u\n", buf->dwBufferLength, buf_size);
5601  if(exdata) {
5602  len = strlen(exdata);
5603  ok_(__FILE__,line)(!memcmp(buf->lpvBuffer, exdata, len), "unexpected buffer data\n");
5604  }else {
5605  ok_(__FILE__,line)(!*(DWORD*)buf->lpvBuffer, "buffer data changed\n");
5606  }
5607 
5610 }
#define max(a, b)
Definition: svc.c:63
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static BOOL skip_receive_notification_tests
Definition: http.c:5349
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ERROR_IO_PENDING
Definition: dderror.h:15
unsigned int BOOL
Definition: ntddk_ex.h:94
#define INTERNET_STATUS_RECEIVING_RESPONSE
Definition: wininet.h:889
Definition: parser.c:48
#define SET_EXPECT(status)
Definition: http.c:51
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
int ret
BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:2268
GLenum GLsizei len
Definition: glext.h:6722
#define CHECK_NOTIFIED(status)
Definition: http.c:102
#define memset(x, y, z)
Definition: compat.h:39
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _readex_expect_sync_data()

static void _readex_expect_sync_data ( unsigned  line,
HINTERNET  req,
DWORD  flags,
INTERNET_BUFFERSW buf,
DWORD  buf_size,
const char exdata,
DWORD  expect_receive 
)
static

Definition at line 5485 of file http.c.

5487 {
5488  _readex_expect_sync_data_len(line, req, flags, buf, buf_size, exdata, strlen(exdata), expect_receive);
5489 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: parser.c:48
static void _readex_expect_sync_data_len(unsigned line, HINTERNET req, DWORD flags, INTERNET_BUFFERSW *buf, DWORD buf_size, const char *exdata, DWORD len, DWORD expect_receive)
Definition: http.c:5458
GLbitfield flags
Definition: glext.h:7161

◆ _readex_expect_sync_data_len()

static void _readex_expect_sync_data_len ( unsigned  line,
HINTERNET  req,
DWORD  flags,
INTERNET_BUFFERSW buf,
DWORD  buf_size,
const char exdata,
DWORD  len,
DWORD  expect_receive 
)
static

Definition at line 5458 of file http.c.

5460 {
5461  BOOL ret;
5462 
5463  if(!skip_receive_notification_tests && expect_receive) {
5466  received_response_size = 0xdeadbeef;
5467  }
5468 
5469  memset(buf->lpvBuffer, 0xff, buf_size);
5470  buf->dwBufferLength = buf_size;
5471  ret = InternetReadFileExW(req, buf, flags, 0xdeadbeef);
5472  ok_(__FILE__,line)(ret, "InternetReadFileExW failed: %u\n", GetLastError());
5473  ok_(__FILE__,line)(buf->dwBufferLength == len, "dwBufferLength = %u, expected %u\n", buf->dwBufferLength, len);
5474  if(len && exdata)
5475  ok_(__FILE__,line)(!memcmp(buf->lpvBuffer, exdata, len), "Unexpected data\n");
5476 
5477  if(!skip_receive_notification_tests && expect_receive) {
5480  ok_(__FILE__,line)(received_response_size == len, "received_response_size = %u\n", received_response_size);
5481  }
5482 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static BOOL skip_receive_notification_tests
Definition: http.c:5349
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
#define INTERNET_STATUS_RECEIVING_RESPONSE
Definition: wininet.h:889
Definition: parser.c:48
#define SET_EXPECT(status)
Definition: http.c:51
GLbitfield flags
Definition: glext.h:7161
int ret
BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:2268
GLenum GLsizei len
Definition: glext.h:6722
#define CHECK_NOTIFIED(status)
Definition: http.c:102
static DWORD received_response_size
Definition: http.c:5350
#define memset(x, y, z)
Definition: compat.h:39
#define INTERNET_STATUS_RESPONSE_RECEIVED
Definition: wininet.h:890
#define ok_(x1, x2)
Definition: atltest.h:61

Referenced by _readex_expect_sync_data().

◆ _receive_simple_request()

static DWORD _receive_simple_request ( unsigned  line,
HINTERNET  req,
char buf,
size_t  buf_size 
)
static

Definition at line 540 of file http.c.

541 {
542  DWORD read = 0;
543  BOOL ret;
544 
545  ret = InternetReadFile(req, buf, buf_size, &read);
546  ok_(__FILE__,line)(ret, "InternetReadFile failed: %u\n", GetLastError());
547 
548  return read;
549 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: parser.c:48
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
Definition: internet.c:2174
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _send_response_and_wait()

static void _send_response_and_wait ( unsigned  line,
const char response,
BOOL  do_close_connection,
void buf,
DWORD ret_size,
const char exdata,
DWORD  expected_size,
DWORD  expected_req_error,
DWORD  expected_receive_size 
)
static

Definition at line 5532 of file http.c.

5535 {
5539 
5540  if(response)
5541  server_send_string(response);
5542 
5543  if(do_close_connection)
5544  close_connection();
5545 
5547 
5551  if(!skip_receive_notification_tests && expected_receive_size != -1)
5552  todo_wine_if(received_response_size != expected_receive_size) /* FIXME! remove when wine is fixed */
5553  ok_(__FILE__,line)(received_response_size == expected_receive_size,
5554  "received_response_size = %u\n", received_response_size);
5555  ok_(__FILE__,line)(req_error == expected_req_error, "req_error = %u, expected %u\n", req_error, expected_req_error);
5556 
5557  /* If IRF_NO_WAIT is used, buffer is not changed. */
5558  ok_(__FILE__,line)(*ret_size == expected_size, "dwBufferLength = %u\n", *ret_size);
5559  if(exdata)
5560  ok_(__FILE__,line)(!memcmp(buf, exdata, strlen(exdata)), "unexpected buffer data\n");
5561  else if(buf)
5562  ok_(__FILE__,line)(!*(DWORD*)buf, "buffer data changed\n");
5563 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static BOOL skip_receive_notification_tests
Definition: http.c:5349
static void close_connection(void)
Definition: http.c:5524
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
static HANDLE complete_event
Definition: http.c:113
Definition: parser.c:48
#define SET_EXPECT(status)
Definition: http.c:51
#define todo_wine_if(is_todo)
Definition: test.h:164
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD req_error
Definition: http.c:114
#define CHECK_NOTIFIED(status)
Definition: http.c:102
#define INTERNET_STATUS_REQUEST_COMPLETE
Definition: wininet.h:898
#define INFINITE
Definition: serial.h:102
static DWORD received_response_size
Definition: http.c:5350
#define INTERNET_STATUS_RESPONSE_RECEIVED
Definition: wininet.h:890
#define ok_(x1, x2)
Definition: atltest.h:61
static void server_send_string(const char *msg)
Definition: http.c:5326

Referenced by _send_response_ex_and_wait().

◆ _send_response_ex_and_wait()

static void _send_response_ex_and_wait ( unsigned  line,
const char response,
BOOL  close_connection,
INTERNET_BUFFERSW buf,
const char exdata,
DWORD  expected_req_error,
DWORD  expected_receive_size 
)
static

Definition at line 5566 of file http.c.

5569 {
5570  _send_response_and_wait(line, response, close_connection, buf->lpvBuffer, &buf->dwBufferLength,
5571  exdata, exdata ? strlen(exdata) : buf->dwBufferLength, expected_req_error,
5572  expected_receive_size);
5573 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static void close_connection(void)
Definition: http.c:5524
Definition: parser.c:48
static void _send_response_and_wait(unsigned line, const char *response, BOOL do_close_connection, void *buf, DWORD *ret_size, const char *exdata, DWORD expected_size, DWORD expected_req_error, DWORD expected_receive_size)
Definition: http.c:5532

◆ _server_read_request()

static void _server_read_request ( unsigned  line,
const char expected_request 
)
static

Definition at line 5337 of file http.c.

5338 {
5339  char buf[4000], *p;
5340  size_t size;
5341 
5342  size = server_read_data(buf, sizeof(buf) - 1);
5343  buf[size] = 0;
5344  p = strstr(buf, "\r\n");
5345  if(p) *p = 0;
5346  ok_(__FILE__,line)(p && !strcmp(buf, expected_request), "unexpected request %s\n", buf);
5347 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
Definition: parser.c:48
GLsizeiptr size
Definition: glext.h:5919
static size_t server_read_data(char *buf, size_t buf_size)
Definition: http.c:5331
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GLfloat GLfloat p
Definition: glext.h:8902
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _set_secflags()

static void _set_secflags ( unsigned  line,
HINTERNET  req,
BOOL  use_undoc,
DWORD  flags 
)
static

Definition at line 6505 of file http.c.

6506 {
6507  BOOL res;
6508 
6509  res = InternetSetOptionW(req, use_undoc ? 99 : INTERNET_OPTION_SECURITY_FLAGS, &flags, sizeof(flags));
6510  ok_(__FILE__,line)(res, "InternetSetOption(INTERNET_OPTION_SECURITY_FLAGS) failed: %u\n", GetLastError());
6511 }
BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
Definition: internet.c:2714
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: parser.c:48
GLbitfield flags
Definition: glext.h:7161
#define INTERNET_OPTION_SECURITY_FLAGS
Definition: wininet.h:725
GLuint res
Definition: glext.h:9613
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _test_http_version()

static void _test_http_version ( unsigned  line,
HINTERNET  req 
)
static

Definition at line 332 of file http.c.

333 {
334  HTTP_VERSION_INFO v = {0xdeadbeef, 0xdeadbeef};
335  DWORD size;
336  BOOL res;
337 
338  size = sizeof(v);
340  ok_(__FILE__,line)(res, "InternetQueryOptionW(INTERNET_OPTION_HTTP_VERSION) failed: %u\n", GetLastError());
341  ok_(__FILE__,line)(v.dwMajorVersion == 1, "dwMajorVersion = %d\n", v.dwMajorVersion);
342  ok_(__FILE__,line)(v.dwMinorVersion == 1, "dwMinorVersion = %d\n", v.dwMinorVersion);
343 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: parser.c:48
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
const GLdouble * v
Definition: gl.h:2040
#define INTERNET_OPTION_HTTP_VERSION
Definition: wininet.h:753
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2574
GLuint res
Definition: glext.h:9613
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _test_request_flags()

static void _test_request_flags ( unsigned  line,
HINTERNET  req,
DWORD  exflags,
BOOL  is_todo 
)
static

Definition at line 302 of file http.c.

303 {
304  DWORD flags, size;
305  BOOL res;
306 
307  flags = 0xdeadbeef;
308  size = sizeof(flags);
310  ok_(__FILE__,line)(res, "InternetQueryOptionW(INTERNET_OPTION_REQUEST_FLAGS) failed: %u\n", GetLastError());
311 
312  /* FIXME: Remove once we have INTERNET_REQFLAG_CACHE_WRITE_DISABLED implementation */
314  todo_wine_if (is_todo)
315  ok_(__FILE__,line)(flags == exflags, "flags = %x, expected %x\n", flags, exflags);
316 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: parser.c:48
#define todo_wine_if(is_todo)
Definition: test.h:164
#define INTERNET_OPTION_REQUEST_FLAGS
Definition: wininet.h:718
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
#define INTERNET_REQFLAG_CACHE_WRITE_DISABLED
Definition: wininet.h:60
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2574
GLuint res
Definition: glext.h:9613
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _test_request_url()

static void _test_request_url ( unsigned  line,
HINTERNET  req,
const char expected_url 
)
static

Definition at line 319 of file http.c.

320 {
322  DWORD size = sizeof(buf);
323  BOOL res;
324 
326  ok_(__FILE__,line)(res, "InternetQueryOptionA(INTERNET_OPTION_URL) failed: %u\n", GetLastError());
327  ok_(__FILE__,line)(size == strlen(expected_url), "size = %u\n", size);
328  ok_(__FILE__,line)(!strcmp(buf, expected_url), "unexpected URL %s, expected %s\n", buf, expected_url);
329 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1410
Definition: parser.c:48
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2607
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define ok_(x1, x2)
Definition: atltest.h:61
#define INTERNET_OPTION_URL
Definition: wininet.h:728

◆ _test_secflags_option()

static void _test_secflags_option ( unsigned  line,
HINTERNET  req,
DWORD  ex_flags,
DWORD  opt_flags 
)
static

Definition at line 6483 of file http.c.

6484 {
6485  DWORD flags, size;
6486  BOOL res;
6487 
6488  flags = 0xdeadbeef;
6489  size = sizeof(flags);
6491  ok_(__FILE__,line)(res, "InternetQueryOptionW(INTERNET_OPTION_SECURITY_FLAGS) failed: %u\n", GetLastError());
6492  ok_(__FILE__,line)((flags & ~opt_flags) == ex_flags, "INTERNET_OPTION_SECURITY_FLAGS flags = %x, expected %x\n",
6493  flags, ex_flags);
6494 
6495  /* Option 98 is undocumented and seems to be the same as INTERNET_OPTION_SECURITY_FLAGS */
6496  flags = 0xdeadbeef;
6497  size = sizeof(flags);
6498  res = InternetQueryOptionW(req, 98, &flags, &size);
6499  ok_(__FILE__,line)(res, "InternetQueryOptionW(98) failed: %u\n", GetLastError());
6500  ok_(__FILE__,line)((flags & ~opt_flags) == ex_flags, "INTERNET_OPTION_SECURITY_FLAGS(98) flags = %x, expected %x\n",
6501  flags, ex_flags);
6502 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: parser.c:48
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
#define INTERNET_OPTION_SECURITY_FLAGS
Definition: wininet.h:725
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2574
GLuint res
Definition: glext.h:9613
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _test_security_info()

static void _test_security_info ( unsigned  line,
const char urlc,
DWORD  error,
DWORD  ex_flags 
)
static

Definition at line 6443 of file http.c.

6444 {
6446  const CERT_CHAIN_CONTEXT *chain;
6447  DWORD flags;
6448  BOOL res;
6449 
6450  if(!pInternetGetSecurityInfoByURLA) {
6451  win_skip("pInternetGetSecurityInfoByURLA not available\n");
6452  return;
6453  }
6454 
6455  strcpy(url, urlc);
6456  chain = (void*)0xdeadbeef;
6457  flags = 0xdeadbeef;
6458  res = pInternetGetSecurityInfoByURLA(url, &chain, &flags);
6459  if(error == ERROR_SUCCESS) {
6460  ok_(__FILE__,line)(res, "InternetGetSecurityInfoByURLA failed: %u\n", GetLastError());
6461  ok_(__FILE__,line)(chain != NULL, "chain = NULL\n");
6462  ok_(__FILE__,line)(flags == ex_flags, "flags = %x\n", flags);
6464 
6465  SetLastError(0xdeadbeef);
6466  res = pInternetGetSecurityInfoByURLA(url, NULL, NULL);
6467  ok_(__FILE__,line)(!res && GetLastError() == ERROR_INVALID_PARAMETER,
6468  "InternetGetSecurityInfoByURLA returned: %x(%u)\n", res, GetLastError());
6469 
6470  res = pInternetGetSecurityInfoByURLA(url, &chain, NULL);
6471  ok_(__FILE__,line)(res, "InternetGetSecurityInfoByURLA failed: %u\n", GetLastError());
6473 
6474  res = pInternetGetSecurityInfoByURLA(url, NULL, &flags);
6475  ok_(__FILE__,line)(res, "InternetGetSecurityInfoByURLA failed: %u\n", GetLastError());
6476  }else {
6477  ok_(__FILE__,line)(!res && GetLastError() == error,
6478  "InternetGetSecurityInfoByURLA returned: %x(%u), expected %u\n", res, GetLastError(), error);
6479  }
6480 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
VOID WINAPI CertFreeCertificateChain(PCCERT_CHAIN_CONTEXT pChainContext)
Definition: chain.c:2960
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1410
Definition: parser.c:48
struct sock * chain
Definition: tcpcore.h:1164
static const WCHAR url[]
Definition: encode.c:1432
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
GLbitfield flags
Definition: glext.h:7161
GLuint res
Definition: glext.h:9613
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define win_skip
Definition: test.h:150
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _test_status_code()

static void _test_status_code ( unsigned  line,
HINTERNET  req,
DWORD  excode,
BOOL  is_todo 
)
static

Definition at line 228 of file http.c.

229 {
230  DWORD code, size, index;
231  char exbuf[12], bufa[10];
232  WCHAR bufw[10];
233  BOOL res;
234 
235  code = 0xdeadbeef;
236  size = sizeof(code);
238  ok_(__FILE__,line)(res, "[1] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE|number) failed: %u\n", GetLastError());
239  todo_wine_if (is_todo)
240  ok_(__FILE__,line)(code == excode, "code = %d, expected %d\n", code, excode);
241  ok_(__FILE__,line)(size == sizeof(code), "size = %u\n", size);
242 
243  code = 0xdeadbeef;
244  index = 0;
245  size = sizeof(code);
247  ok_(__FILE__,line)(res, "[2] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE|number index) failed: %u\n", GetLastError());
248  ok_(__FILE__,line)(!index, "index = %d, expected 0\n", index);
249  ok_(__FILE__,line)(size == sizeof(code), "size = %u\n", size);
250 
251  sprintf(exbuf, "%u", excode);
252 
253  size = sizeof(bufa);
255  ok_(__FILE__,line)(res, "[3] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
256  todo_wine_if (is_todo)
257  ok_(__FILE__,line)(!strcmp(bufa, exbuf), "unexpected status code %s, expected %s\n", bufa, exbuf);
258  ok_(__FILE__,line)(size == strlen(exbuf), "unexpected size %d for \"%s\"\n", size, exbuf);
259 
260  size = 0;
263  "[4] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
264  ok_(__FILE__,line)(size == strlen(exbuf)+1, "unexpected size %d for \"%s\"\n", size, exbuf);
265 
266  size = sizeof(bufw);
268  ok_(__FILE__,line)(res, "[5] HttpQueryInfoW(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
269  todo_wine_if (is_todo)
270  ok_(__FILE__,line)(!strcmp_wa(bufw, exbuf), "unexpected status code %s, expected %s\n", bufa, exbuf);
271  ok_(__FILE__,line)(size == strlen(exbuf)*sizeof(WCHAR), "unexpected size %d for \"%s\"\n", size, exbuf);
272 
273  size = 0;
276  "[6] HttpQueryInfoW(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
277  ok_(__FILE__,line)(size == (strlen(exbuf)+1)*sizeof(WCHAR), "unexpected size %d for \"%s\"\n", size, exbuf);
278 
279  if(0) {
280  size = sizeof(bufw);
282  ok(!res && GetLastError() == ERROR_INVALID_PARAMETER, "HttpQueryInfo(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
283  ok(size == sizeof(bufw), "unexpected size %d\n", size);
284  }
285 
286  code = 0xdeadbeef;
287  index = 1;
288  size = sizeof(code);
291  "[7] HttpQueryInfoA failed: %x(%d)\n", res, GetLastError());
292 
293  code = 0xdeadbeef;
294  size = sizeof(code);
297  "[8] HttpQueryInfoA failed: %x(%d)\n", res, GetLastError());
298 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ERROR_HTTP_INVALID_QUERY_REQUEST
Definition: wininet.h:2062
#define sprintf(buf, format,...)
Definition: sprintf.c:55
unsigned int BOOL
Definition: ntddk_ex.h:94
#define HTTP_QUERY_FLAG_REQUEST_HEADERS
Definition: wininet.h:1604
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
GLuint index
Definition: glext.h:6031
#define todo_wine_if(is_todo)
Definition: test.h:164
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
static PCCERT_CHAIN_CONTEXT DWORD *static int strcmp_wa(LPCWSTR strw, const char *stra)
Definition: http.c:173
#define ERROR_HTTP_HEADER_NOT_FOUND
Definition: wininet.h:2058
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:3883
#define index(s, c)
Definition: various.h:29
int code
Definition: i386-dis.c:3591
#define HTTP_QUERY_STATUS_CODE
Definition: wininet.h:1542
#define ok(value,...)
Definition: atltest.h:57
#define HTTP_QUERY_FLAG_NUMBER
Definition: wininet.h:1606
GLuint res
Definition: glext.h:9613
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define ok_(x1, x2)
Definition: atltest.h:61
BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:4031
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

◆ BOOL()

static BOOL ( WINAPI pInternetGetSecurityInfoByURLA)
static

◆ callback()

static VOID WINAPI callback ( HINTERNET  hInternet,
DWORD_PTR  dwContext,
DWORD  dwInternetStatus,
LPVOID  lpvStatusInformation,
DWORD  dwStatusInformationLength 
)
static

Definition at line 347 of file http.c.

354 {
356  CHECK_EXPECT(dwInternetStatus);
357  switch (dwInternetStatus)
358  {
360  if(winetest_debug > 1)
361  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_RESOLVING_NAME \"%s\" %d\n",
362  GetCurrentThreadId(), hInternet, dwContext,
363  (LPCSTR)lpvStatusInformation,dwStatusInformationLength);
364  *(LPSTR)lpvStatusInformation = '\0';
365  break;
367  if(winetest_debug > 1)
368  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_NAME_RESOLVED \"%s\" %d\n",
369  GetCurrentThreadId(), hInternet, dwContext,
370  (LPCSTR)lpvStatusInformation,dwStatusInformationLength);
371  *(LPSTR)lpvStatusInformation = '\0';
372  break;
374  if(winetest_debug > 1)
375  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CONNECTING_TO_SERVER \"%s\" %d\n",
376  GetCurrentThreadId(), hInternet, dwContext,
377  (LPCSTR)lpvStatusInformation,dwStatusInformationLength);
378  ok(dwStatusInformationLength == strlen(lpvStatusInformation)+1, "unexpected size %u\n",
379  dwStatusInformationLength);
380  *(LPSTR)lpvStatusInformation = '\0';
381  break;
383  if(winetest_debug > 1)
384  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CONNECTED_TO_SERVER \"%s\" %d\n",
385  GetCurrentThreadId(), hInternet, dwContext,
386  (LPCSTR)lpvStatusInformation,dwStatusInformationLength);
387  ok(dwStatusInformationLength == strlen(lpvStatusInformation)+1, "unexpected size %u\n",
388  dwStatusInformationLength);
389  *(LPSTR)lpvStatusInformation = '\0';
390  break;
392  if(winetest_debug > 1)
393  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_SENDING_REQUEST %p %d\n",
394  GetCurrentThreadId(), hInternet, dwContext,
395  lpvStatusInformation,dwStatusInformationLength);
396  break;
398  ok(dwStatusInformationLength == sizeof(DWORD),
399  "info length should be sizeof(DWORD) instead of %d\n",
400  dwStatusInformationLength);
401  if(winetest_debug > 1)
402  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_REQUEST_SENT 0x%x %d\n",
403  GetCurrentThreadId(), hInternet, dwContext,
404  *(DWORD *)lpvStatusInformation,dwStatusInformationLength);
405  break;
407  if(winetest_debug > 1)
408  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_RECEIVING_RESPONSE %p %d\n",
409  GetCurrentThreadId(), hInternet, dwContext,
410  lpvStatusInformation,dwStatusInformationLength);
411  break;
413  ok(dwStatusInformationLength == sizeof(DWORD),
414  "info length should be sizeof(DWORD) instead of %d\n",
415  dwStatusInformationLength);
416  if(winetest_debug > 1)
417  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_RESPONSE_RECEIVED 0x%x %d\n",
418  GetCurrentThreadId(), hInternet, dwContext,
419  *(DWORD *)lpvStatusInformation,dwStatusInformationLength);
420  break;
422  if(winetest_debug > 1)
423  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CTL_RESPONSE_RECEIVED %p %d\n",
424  GetCurrentThreadId(), hInternet,dwContext,
425  lpvStatusInformation,dwStatusInformationLength);
426  break;
428  if(winetest_debug > 1)
429  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_PREFETCH %p %d\n",
430  GetCurrentThreadId(), hInternet, dwContext,
431  lpvStatusInformation,dwStatusInformationLength);
432  break;
434  if(winetest_debug > 1)
435  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CLOSING_CONNECTION %p %d\n",
436  GetCurrentThreadId(), hInternet, dwContext,
437  lpvStatusInformation,dwStatusInformationLength);
438  break;
440  if(winetest_debug > 1)
441  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CONNECTION_CLOSED %p %d\n",
442  GetCurrentThreadId(), hInternet, dwContext,
443  lpvStatusInformation,dwStatusInformationLength);
444  break;
446  ok(dwStatusInformationLength == sizeof(HINTERNET),
447  "info length should be sizeof(HINTERNET) instead of %d\n",
448  dwStatusInformationLength);
449  if(winetest_debug > 1)
450  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_HANDLE_CREATED %p %d\n",
451  GetCurrentThreadId(), hInternet, dwContext,
452  *(HINTERNET *)lpvStatusInformation,dwStatusInformationLength);
455  break;
457  ok(dwStatusInformationLength == sizeof(HINTERNET),
458  "info length should be sizeof(HINTERNET) instead of %d\n",
459  dwStatusInformationLength);
460  if(winetest_debug > 1)
461  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_HANDLE_CLOSING %p %d\n",
462  GetCurrentThreadId(), hInternet, dwContext,
463  *(HINTERNET *)lpvStatusInformation, dwStatusInformationLength);
466  break;
468  {
469  INTERNET_ASYNC_RESULT *iar = (INTERNET_ASYNC_RESULT *)lpvStatusInformation;
470  ok(dwStatusInformationLength == sizeof(INTERNET_ASYNC_RESULT),
471  "info length should be sizeof(INTERNET_ASYNC_RESULT) instead of %d\n",
472  dwStatusInformationLength);
473  ok(iar->dwResult == 1 || iar->dwResult == 0, "iar->dwResult = %ld\n", iar->dwResult);
474  if(winetest_debug > 1)
475  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_REQUEST_COMPLETE {%ld,%d} %d\n",
476  GetCurrentThreadId(), hInternet, dwContext,
477  iar->dwResult,iar->dwError,dwStatusInformationLength);
478  req_error = iar->dwError;
479  if(!close_handle_cnt)
481  break;
482  }
484  if(winetest_debug > 1)
485  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_REDIRECT \"%s\" %d\n",
486  GetCurrentThreadId(), hInternet, dwContext,
487  (LPCSTR)lpvStatusInformation, dwStatusInformationLength);
488  *(LPSTR)lpvStatusInformation = '\0';
491  break;
493  if(winetest_debug > 1)
494  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_INTERMEDIATE_RESPONSE %p %d\n",
495  GetCurrentThreadId(), hInternet, dwContext,
496  lpvStatusInformation, dwStatusInformationLength);
497  break;
498  default:
499  if(winetest_debug > 1)
500  trace("%04x:Callback %p 0x%lx %d %p %d\n",
501  GetCurrentThreadId(), hInternet, dwContext, dwInternetStatus,
502  lpvStatusInformation, dwStatusInformationLength);
503  }
504 }
#define INTERNET_STATUS_HANDLE_CLOSING
Definition: wininet.h:896
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define INTERNET_STATUS_REQUEST_SENT
Definition: wininet.h:888
#define INTERNET_STATUS_CONNECTING_TO_SERVER
Definition: wininet.h:885
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
char * LPSTR
Definition: xmlstorage.h:182
#define INTERNET_STATUS_PREFETCH
Definition: wininet.h:892
int winetest_debug
#define INTERNET_STATUS_CONNECTION_CLOSED
Definition: wininet.h:894
#define INTERNET_STATUS_CLOSING_CONNECTION
Definition: wininet.h:893
static HANDLE complete_event
Definition: http.c:113
#define INTERNET_STATUS_RECEIVING_RESPONSE
Definition: wininet.h:889
const char * LPCSTR
Definition: xmlstorage.h:183
#define CHECK_EXPECT(status)
Definition: http.c:68
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
#define INTERNET_STATUS_NAME_RESOLVED
Definition: wininet.h:884
#define INTERNET_STATUS_CTL_RESPONSE_RECEIVED
Definition: wininet.h:891
#define SET_EXPECT(status)
Definition: http.c:51
#define trace
Definition: atltest.h:70
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INTERNET_STATUS_REDIRECT
Definition: wininet.h:899
DWORD_PTR dwResult
Definition: wininet.h:155
#define InterlockedDecrement
Definition: armddk.h:52
#define INTERNET_STATUS_SENDING_REQUEST
Definition: wininet.h:887
#define INTERNET_STATUS_RESOLVING_NAME
Definition: wininet.h:883
static DWORD req_error
Definition: http.c:114
#define INTERNET_STATUS_REQUEST_COMPLETE
Definition: wininet.h:898
#define ros_skip_flaky
Definition: test.h:167
#define ok(value,...)
Definition: atltest.h:57
#define INTERNET_STATUS_CONNECTED_TO_SERVER
Definition: wininet.h:886
#define INTERNET_STATUS_DETECTING_PROXY
Definition: wininet.h:897
#define INTERNET_STATUS_HANDLE_CREATED
Definition: wininet.h:895
#define CLEAR_NOTIFIED(status)
Definition: http.c:90
static int close_handle_cnt
Definition: http.c:345
#define INTERNET_STATUS_INTERMEDIATE_RESPONSE
Definition: wininet.h:900
#define INTERNET_STATUS_RESPONSE_RECEIVED
Definition: wininet.h:890

Referenced by InternetReadFile_test(), InternetReadFileExA_test(), readex_callback(), test_async_read(), test_cache_read(), test_conn_close(), test_connection_closing(), test_no_content(), test_security_flags(), and test_successive_HttpSendRequest().

◆ cb()

static void WINAPI cb ( HINTERNET  handle,
DWORD_PTR  context,
DWORD  status,
LPVOID  info,
DWORD  size 
)
static

Definition at line 7104 of file http.c.

7105 {
7107  struct context *ctx = (struct context *)context;
7108 
7109  if(winetest_debug > 1)
7110  trace("%p 0x%08lx %u %p 0x%08x\n", handle, context, status, info, size);
7111 
7112  switch(status) {
7114  trace("request handle: 0x%08lx\n", result->dwResult);
7115  ctx->req = (HINTERNET)result->dwResult;
7116  SetEvent(ctx->event);
7117  break;
7120 
7122  ok(type != INTERNET_HANDLE_TYPE_CONNECT_HTTP, "unexpected callback\n");
7123  SetEvent(ctx->event);
7124  break;
7125  }
7129  char *str = info;
7130  ok(str[0] && str[1], "Got string: %s\n", str);
7131  ok(size == strlen(str)+1, "unexpected size %u\n", size);
7132  }
7133  }
7134 }
LPVOID HINTERNET
Definition: winhttp.h:32
HINTERNET req
Definition: http.c:7101
#define INTERNET_STATUS_HANDLE_CLOSING
Definition: wininet.h:896
Definition: http.c:7098
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define INTERNET_STATUS_CONNECTING_TO_SERVER
Definition: wininet.h:885
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
int winetest_debug
struct _test_info info[]
Definition: SetCursorPos.c:19
HANDLE event
Definition: http.c:7100
const WCHAR * str
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2607
#define INTERNET_STATUS_NAME_RESOLVED
Definition: wininet.h:884
GLsizeiptr size
Definition: glext.h:5919
#define INTERNET_OPTION_HANDLE_TYPE
Definition: wininet.h:710
#define trace
Definition: atltest.h:70
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INTERNET_STATUS_REQUEST_COMPLETE
Definition: wininet.h:898
#define ok(value,...)
Definition: atltest.h:57
#define INTERNET_STATUS_CONNECTED_TO_SERVER
Definition: wininet.h:886
GLuint64EXT * result
Definition: glext.h:11304
#define INTERNET_HANDLE_TYPE_CONNECT_HTTP
Definition: wininet.h:805
Definition: ps.c:97

Referenced by HttpProtocol_Read(), and test_open_url_async().

◆ check_notification()

static void CALLBACK check_notification ( HINTERNET  handle,
DWORD_PTR  context,
DWORD  status,
LPVOID  buffer,
DWORD  buflen 
)
static

Definition at line 7235 of file http.c.

7236 {
7237  BOOL status_ok, function_ok;
7238  struct info *info = (struct info *)context;
7239  unsigned int i;
7240 
7242 
7243  if(info->is_aborted) {
7245  return;
7246  }
7247 
7249  {
7250  DWORD size = sizeof(struct info *);
7254 
7255  ok(buflen == sizeof(*ar), "unexpected buflen = %d\n", buflen);
7256  if(info->expect_result == ERROR_SUCCESS) {
7257  ok(ar->dwResult == 1, "ar->dwResult = %ld, expected 1\n", ar->dwResult);
7258  }else {
7259  ok(!ar->dwResult, "ar->dwResult = %ld, expected 1\n", ar->dwResult);
7260  ok(ar->dwError == info->expect_result, "ar->dwError = %d, expected %d\n", ar->dwError, info->expect_result);
7261  }
7262  }
7263 
7264  i = info->index;
7265  if (i >= info->count)
7266  {
7268  return;
7269  }
7270 
7271  while (info->test[i].status != status &&
7272  (info->test[i].optional || info->test[i].todo) &&
7273  i < info->count - 1 &&
7274  info->test[i].function == info->test[i + 1].function)
7275  {
7276  i++;
7277  }
7278 
7279  status_ok = (info->test[i].status == status);
7280  function_ok = (info->test[i].function == info->function);
7281 
7282  if (!info->test[i].todo)
7283  {
7284  ok( status_ok, "%u: expected status %u got %u\n", info->line, info->test[i].status, status );
7285  ok( function_ok, "%u: expected function %u got %u\n", info->line, info->test[i].function, info->function );
7286 
7287  if (info->test[i].async)
7288  ok(info->thread != GetCurrentThreadId(), "%u: expected thread %u got %u\n",
7290  }
7291  else
7292  {
7293  todo_wine ok( status_ok, "%u: expected status %u got %u\n", info->line, info->test[i].status, status );
7294  if (status_ok)
7295  todo_wine ok( function_ok, "%u: expected function %u got %u\n", info->line, info->test[i].function, info->function );
7296  }
7297  if (i == info->count - 1 || info->test[i].function != info->test[i + 1].function) SetEvent( info->wait );
7298  info->index = i+1;
7299 
7301 }
#define ERROR_SUCCESS
Definition: deptool.c:10
const struct notification * test
Definition: notification.c:63
Definition: http.c:7098
GLuint GLuint GLsizei count
Definition: gl.h:1545
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
GLuint buffer
Definition: glext.h:5915
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
unsigned int count
Definition: notification.c:64
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL is_aborted
Definition: http.c:7230
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE wait
Definition: notification.c:66
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
GLsizeiptr size
Definition: glext.h:5919
DWORD expect_result
Definition: http.c:7229
static CRITICAL_SECTION notification_cs
Definition: http.c:7233
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD_PTR dwResult
Definition: wininet.h:155
#define todo_wine
Definition: test.h:163
DWORD thread
Definition: http.c:7227
#define INTERNET_STATUS_REQUEST_COMPLETE
Definition: wininet.h:898
#define ok(value,...)
Definition: atltest.h:57
enum api function
Definition: notification.c:62
#define INTERNET_STATUS_HANDLE_CREATED
Definition: wininet.h:895
unsigned int line
Definition: notification.c:67
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define INTERNET_OPTION_CONTEXT_VALUE
Definition: wininet.h:739
static SERVICE_STATUS status
Definition: service.c:31
unsigned int index
Definition: notification.c:65
BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:4031
Definition: ps.c:97

Referenced by test_async_HttpSendRequestEx().

◆ close_async_handle()

static void close_async_handle ( HINTERNET  handle,
int  handle_cnt 
)
static

Definition at line 551 of file http.c.

552 {
553  BOOL res;
554 
555  close_handle_cnt = handle_cnt;
556 
559  ok(res, "InternetCloseHandle failed: %u\n", GetLastError());
562 }
#define INTERNET_STATUS_HANDLE_CLOSING
Definition: wininet.h:896
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1436
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
unsigned int BOOL
Definition: ntddk_ex.h:94
static HANDLE complete_event
Definition: http.c:113
#define CHECK_NOTIFIED2(status, num)
Definition: http.c:93
#define SET_EXPECT2(status, num)
Definition: http.c:48
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
#define INFINITE
Definition: serial.h:102
static int close_handle_cnt
Definition: http.c:345

Referenced by InternetReadFile_test(), InternetReadFileExA_test(), test_async_read(), test_cache_read(), test_conn_close(), test_connection_break(), test_connection_closing(), test_http_read(), test_large_content(), test_no_content(), test_persistent_connection(), test_redirect(), test_security_flags(), and test_successive_HttpSendRequest().

◆ close_connection()

static void close_connection ( void  )
static

Definition at line 5524 of file http.c.

5525 {
5526  char c;
5528  recv(server_socket, &c, 1, 0);
5529 }
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
static int server_socket
Definition: http.c:2143
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
Definition: recv.c:23
static HANDLE conn_wait_event
Definition: http.c:113

Referenced by _send_response_and_wait(), _send_response_ex_and_wait(), send_response_len_and_wait(), test_connection_break(), test_large_content(), test_persistent_connection(), and test_redirect().

◆ closetest_callback()

static void WINAPI closetest_callback ( HINTERNET  hInternet,
DWORD_PTR  dwContext,
DWORD  dwInternetStatus,
LPVOID  lpvStatusInformation,
DWORD  dwStatusInformationLength 
)
static

Definition at line 7552 of file http.c.

7554 {
7555  DWORD len, type;
7556  BOOL res;
7557 
7558  if(winetest_debug > 1)
7559  trace("closetest_callback %p: %d\n", hInternet, dwInternetStatus);
7560 
7561  ok(hInternet == closetest_session || hInternet == closetest_conn || hInternet == closetest_req,
7562  "Unexpected hInternet %p\n", hInternet);
7563  if(!closetest_closed)
7564  return;
7565 
7566  len = sizeof(type);
7569  "InternetQueryOptionA(%p INTERNET_OPTION_HANDLE_TYPE) failed: %x %u, expected TRUE ERROR_INVALID_HANDLE\n",
7571 }
static HINTERNET closetest_session
Definition: http.c:7549
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int winetest_debug
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL closetest_closed
Definition: http.c:7550
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2607
#define INTERNET_OPTION_HANDLE_TYPE
Definition: wininet.h:710
#define trace
Definition: atltest.h:70
static HINTERNET closetest_conn
Definition: http.c:7549
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
static HINTERNET closetest_req
Definition: http.c:7549
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613

Referenced by test_InternetCloseHandle().

◆ free_events()

static void free_events ( void  )
static

Definition at line 208 of file http.c.

209 {
215 }
#define CloseHandle
Definition: compat.h:406
static HANDLE complete_event
Definition: http.c:113
static HANDLE server_req_rec_event
Definition: http.c:113
static HANDLE conn_close_event
Definition: http.c:113
static HANDLE request_sent_event
Definition: http.c:113
static HANDLE conn_wait_event
Definition: http.c:113

Referenced by START_TEST().

◆ header_cb()

static void WINAPI header_cb ( HINTERNET  handle,
DWORD_PTR  ctx,
DWORD  status,
LPVOID  info,
DWORD  len 
)
static

Definition at line 7747 of file http.c.

7748 {
7749  BOOL ret;
7750  DWORD index, size;
7751  char buf[256];
7752 
7754  {
7755  ret = HttpAddRequestHeadersA( handle, "winetest: winetest", ~0u, HTTP_ADDREQ_FLAG_ADD );
7756  ok( ret, "HttpAddRequestHeadersA failed %u\n", GetLastError() );
7757  SetEvent( (HANDLE)ctx );
7758  }
7760  {
7761  index = 0;
7762  size = sizeof(buf);
7764  buf, &size, &index );
7765  ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
7766  ok( strstr( buf, "winetest: winetest" ) != NULL, "header missing\n" );
7767  SetEvent( (HANDLE)ctx );
7768  }
7769 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define HTTP_QUERY_RAW_HEADERS_CRLF
Definition: wininet.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define INTERNET_STATUS_REQUEST_SENT
Definition: wininet.h:888
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
#define HTTP_QUERY_FLAG_REQUEST_HEADERS
Definition: wininet.h:1604
#define HTTP_ADDREQ_FLAG_ADD
Definition: wininet.h:1707
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hHttpRequest, LPCSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier)
Definition: http.c:1428
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define index(s, c)
Definition: various.h:29
#define INTERNET_STATUS_SENDING_REQUEST
Definition: wininet.h:887
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:4031
Definition: ps.c:97

Referenced by test_concurrent_header_access().

◆ HttpHeaders_test()

static void HttpHeaders_test ( void  )
static

Definition at line 1710 of file http.c.

1711 {
1712  HINTERNET hSession;
1713  HINTERNET hConnect;
1714  HINTERNET hRequest;
1715  CHAR buffer[256];
1716  WCHAR wbuffer[256];
1717  DWORD len = 256;
1718  DWORD oldlen;
1719  DWORD index = 0;
1720  BOOL ret;
1721 
1722  hSession = InternetOpenA("Wine Regression Test",
1724  ok( hSession != NULL ,"Unable to open Internet session\n");
1725  hConnect = InternetConnectA(hSession, "test.winehq.org",
1727  0);
1728  ok( hConnect != NULL, "Unable to connect to http://test.winehq.org\n");
1729  hRequest = HttpOpenRequestA(hConnect, "POST", "/tests/post.php",
1731  if (!hRequest && GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED)
1732  {
1733  skip( "Network unreachable, skipping test\n" );
1734  goto done;
1735  }
1736  ok( hRequest != NULL, "Failed to open request handle\n");
1737 
1738  index = 0;
1739  len = sizeof(buffer);
1740  strcpy(buffer,"Warning");
1742  buffer,&len,&index)==0,"Warning hearder reported as Existing\n");
1743 
1744  ok(HttpAddRequestHeadersA(hRequest,"Warning:test1",-1,HTTP_ADDREQ_FLAG_ADD),
1745  "Failed to add new header\n");
1746 
1747  index = 0;
1748  len = sizeof(buffer);
1749  strcpy(buffer,"Warning");
1751  buffer,&len,&index),"Unable to query header\n");
1752  ok(index == 1, "Index was not incremented\n");
1753  ok(strcmp(buffer,"test1")==0, "incorrect string was returned(%s)\n",buffer);
1754  ok(len == 5, "Invalid length (exp. 5, got %d)\n", len);
1755  ok((len < sizeof(buffer)) && (buffer[len] == 0), "Buffer not NULL-terminated\n"); /* len show only 5 characters but the buffer is NULL-terminated*/
1756  len = sizeof(buffer);
1757  strcpy(buffer,"Warning");
1759  buffer,&len,&index)==0,"Second Index Should Not Exist\n");
1760 
1761  index = 0;
1762  len = 5; /* could store the string but not the NULL terminator */
1763  strcpy(buffer,"Warning");
1765  buffer,&len,&index) == FALSE,"Query succeeded on a too small buffer\n");
1766  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
1767  ok(index == 0, "Index was incremented\n");
1768  ok(strcmp(buffer,"Warning")==0, "incorrect string was returned(%s)\n",buffer); /* string not touched */
1769  ok(len == 6, "Invalid length (exp. 6, got %d)\n", len); /* unlike success, the length includes the NULL-terminator */
1770 
1771  /* a call with NULL will fail but will return the length */
1772  index = 0;
1773  len = sizeof(buffer);
1774  SetLastError(0xdeadbeef);
1776  NULL,&len,&index) == FALSE,"Query worked\n");
1777  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
1778  ok(len > 40, "Invalid length (exp. more than 40, got %d)\n", len);
1779  ok(index == 0, "Index was incremented\n");
1780 
1781  /* even for a len that is too small */
1782  index = 0;
1783  len = 15;
1784  SetLastError(0xdeadbeef);
1786  NULL,&len,&index) == FALSE,"Query worked\n");
1787  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
1788  ok(len > 40, "Invalid length (exp. more than 40, got %d)\n", len);
1789  ok(index == 0, "Index was incremented\n");
1790 
1791  index = 0;
1792  len = 0;
1793  SetLastError(0xdeadbeef);
1795  NULL,&len,&index) == FALSE,"Query worked\n");
1796  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
1797  ok(len > 40, "Invalid length (exp. more than 40, got %d)\n", len);
1798  ok(index == 0, "Index was incremented\n");
1799  oldlen = len; /* bytes; at least long enough to hold buffer & nul */
1800 
1801 
1802  /* a working query */
1803  index = 0;
1804  len = sizeof(buffer);
1805  memset(buffer, 'x', sizeof(buffer));
1807  buffer,&len,&index),"Unable to query header\n");
1808  ok(len + sizeof(CHAR) <= oldlen, "Result longer than advertised\n");
1809  ok((len < sizeof(buffer)-sizeof(CHAR)) && (buffer[len/sizeof(CHAR)] == 0),"No NUL at end\n");
1810  ok(len == strlen(buffer) * sizeof(CHAR), "Length wrong\n");
1811  /* what's in the middle differs between Wine and Windows so currently we check only the beginning and the end */
1812  ok(strncmp(buffer, "POST /tests/post.php HTTP/1", 25)==0, "Invalid beginning of headers string\n");
1813  ok(strcmp(buffer + strlen(buffer) - 4, "\r\n\r\n")==0, "Invalid end of headers string\n");
1814  ok(index == 0, "Index was incremented\n");
1815 
1816  /* Like above two tests, but for W version */
1817 
1818  index = 0;
1819  len = 0;
1820  SetLastError(0xdeadbeef);
1822  NULL,&len,&index) == FALSE,"Query worked\n");
1823  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
1824  ok(len > 80, "Invalid length (exp. more than 80, got %d)\n", len);
1825  ok(index == 0, "Index was incremented\n");
1826  oldlen = len; /* bytes; at least long enough to hold buffer & nul */
1827 
1828  /* a working query */
1829  index = 0;
1830  len = sizeof(wbuffer);
1831  memset(wbuffer, 'x', sizeof(wbuffer));
1833  wbuffer,&len,&index),"Unable to query header\n");
1834  ok(len + sizeof(WCHAR) <= oldlen, "Result longer than advertised\n");
1835  ok(len == lstrlenW(wbuffer) * sizeof(WCHAR), "Length wrong\n");
1836  ok((len < sizeof(wbuffer)-sizeof(WCHAR)) && (wbuffer[len/sizeof(WCHAR)] == 0),"No NUL at end\n");
1837  ok(index == 0, "Index was incremented\n");
1838 
1839  /* end of W version tests */
1840 
1841  /* Without HTTP_QUERY_FLAG_REQUEST_HEADERS */
1842  index = 0;
1843  len = sizeof(buffer);
1844  memset(buffer, 'x', sizeof(buffer));
1846  buffer,&len,&index) == TRUE,"Query failed\n");
1847  ok(len == 2 || len == 4 /* win10 */, "Expected 2 or 4, got %d\n", len);
1848  ok(memcmp(buffer, "\r\n\r\n", len) == 0, "Expected CRLF, got '%s'\n", buffer);
1849  ok(index == 0, "Index was incremented\n");
1850 
1851  ok(HttpAddRequestHeadersA(hRequest,"Warning:test2",-1,HTTP_ADDREQ_FLAG_ADD),
1852  "Failed to add duplicate header using HTTP_ADDREQ_FLAG_ADD\n");
1853 
1854  index = 0;
1855  len = sizeof(buffer);
1856  strcpy(buffer,"Warning");
1858  buffer,&len,&index),"Unable to query header\n");
1859  ok(index == 1, "Index was not incremented\n");
1860  ok(strcmp(buffer,"test1")==0, "incorrect string was returned(%s)\n",buffer);
1861  len = sizeof(buffer);
1862  strcpy(buffer,"Warning");
1864  buffer,&len,&index),"Failed to get second header\n");
1865  ok(index == 2, "Index was not incremented\n");
1866  ok(strcmp(buffer,"test2")==0, "incorrect string was returned(%s)\n",buffer);
1867  len = sizeof(buffer);
1868  strcpy(buffer,"Warning");
1870  buffer,&len,&index)==0,"Third Header Should Not Exist\n");
1871 
1872  ok(HttpAddRequestHeadersA(hRequest,"Warning:test3",-1,HTTP_ADDREQ_FLAG_REPLACE), "Failed to replace header using HTTP_ADDREQ_FLAG_REPLACE\n");
1873 
1874  index = 0;
1875  len = sizeof(buffer);
1876  strcpy(buffer,"Warning");
1878  buffer,&len,&index),"Unable to query header\n");
1879  ok(index == 1, "Index was not incremented\n");
1880  ok(strcmp(buffer,"test2")==0, "incorrect string was returned(%s)\n",buffer);
1881  len = sizeof(buffer);
1882  strcpy(buffer,"Warning");
1884  buffer,&len,&index),"Failed to get second header\n");
1885  ok(index == 2, "Index was not incremented\n");
1886  ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
1887  len = sizeof(buffer);
1888  strcpy(buffer,"Warning");
1890  buffer,&len,&index)==0,"Third Header Should Not Exist\n");
1891 
1892  ok(HttpAddRequestHeadersA(hRequest,"Warning:test4",-1,HTTP_ADDREQ_FLAG_ADD_IF_NEW)==0, "HTTP_ADDREQ_FLAG_ADD_IF_NEW replaced existing header\n");
1893 
1894  index = 0;
1895  len = sizeof(buffer);
1896  strcpy(buffer,"Warning");
1898  buffer,&len,&index),"Unable to query header\n");
1899  ok(index == 1, "Index was not incremented\n");
1900  ok(strcmp(buffer,"test2")==0, "incorrect string was returned(%s)\n",buffer);
1901  len = sizeof(buffer);
1902  strcpy(buffer,"Warning");
1904  buffer,&len,&index),"Failed to get second header\n");
1905  ok(index == 2, "Index was not incremented\n");
1906  ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
1907  len = sizeof(buffer);
1908  strcpy(buffer,"Warning");
1910  buffer,&len,&index)==0,"Third Header Should Not Exist\n");
1911 
1912  ok(HttpAddRequestHeadersA(hRequest,"Warning:test4",-1, HTTP_ADDREQ_FLAG_COALESCE), "HTTP_ADDREQ_FLAG_COALESCE Did not work\n");
1913 
1914  index = 0;
1915  len = sizeof(buffer);
1916  strcpy(buffer,"Warning");
1918  buffer,&len,&index),"Unable to query header\n");
1919  ok(index == 1, "Index was not incremented\n");
1920  ok(strcmp(buffer,"test2, test4")==0, "incorrect string was returned(%s)\n", buffer);
1921  len = sizeof(buffer);
1922  strcpy(buffer,"Warning");
1923  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
1924  ok(index == 2, "Index was not incremented\n");
1925  ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
1926  len = sizeof(buffer);
1927  strcpy(buffer,"Warning");
1928  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
1929 
1930  ok(HttpAddRequestHeadersA(hRequest,"Warning:test5",-1, HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA), "HTTP_ADDREQ_FLAG_COALESCE Did not work\n");
1931 
1932  index = 0;
1933  len = sizeof(buffer);
1934  strcpy(buffer,"Warning");
1935  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
1936  ok(index == 1, "Index was not incremented\n");
1937  ok(strcmp(buffer,"test2, test4, test5")==0, "incorrect string was returned(%s)\n",buffer);
1938  len = sizeof(buffer);
1939  strcpy(buffer,"Warning");
1940  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
1941  ok(index == 2, "Index was not incremented\n");
1942  ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
1943  len = sizeof(buffer);
1944  strcpy(buffer,"Warning");
1945  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
1946 
1947  ok(HttpAddRequestHeadersA(hRequest,"Warning:test6",-1, HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON), "HTTP_ADDREQ_FLAG_COALESCE Did not work\n");
1948 
1949  index = 0;
1950  len = sizeof(buffer);
1951  strcpy(buffer,"Warning");
1952  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
1953  ok(index == 1, "Index was not incremented\n");
1954  ok(strcmp(buffer,"test2, test4, test5; test6")==0, "incorrect string was returned(%s)\n",buffer);
1955  len = sizeof(buffer);
1956  strcpy(buffer,"Warning");
1957  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
1958  ok(index == 2, "Index was not incremented\n");
1959  ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
1960  len = sizeof(buffer);
1961  strcpy(buffer,"Warning");
1962  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
1963 
1964  ok(HttpAddRequestHeadersA(hRequest,"Warning:test7",-1, HTTP_ADDREQ_FLAG_ADD|HTTP_ADDREQ_FLAG_REPLACE), "HTTP_ADDREQ_FLAG_ADD with HTTP_ADDREQ_FLAG_REPALCE Did not work\n");
1965 
1966  index = 0;
1967  len = sizeof(buffer);
1968  strcpy(buffer,"Warning");
1969  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
1970  ok(index == 1, "Index was not incremented\n");
1971  ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
1972  len = sizeof(buffer);
1973  strcpy(buffer,"Warning");
1974  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
1975  ok(index == 2, "Index was not incremented\n");
1976  ok(strcmp(buffer,"test7")==0, "incorrect string was returned(%s)\n",buffer);
1977  len = sizeof(buffer);
1978  strcpy(buffer,"Warning");
1979  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
1980 
1981  /* Ensure that blank headers are ignored and don't cause a failure */
1982  ok(HttpAddRequestHeadersA(hRequest,"\r\nBlankTest:value\r\n\r\n",-1, HTTP_ADDREQ_FLAG_ADD_IF_NEW), "Failed to add header with blank entries in list\n");
1983 
1984  index = 0;
1985  len = sizeof(buffer);
1986  strcpy(buffer,"BlankTest");
1987  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
1988  ok(index == 1, "Index was not incremented\n");
1989  ok(strcmp(buffer,"value")==0, "incorrect string was returned(%s)\n",buffer);
1990 
1991  /* Ensure that malformed header separators are ignored and don't cause a failure */
1992  ok(HttpAddRequestHeadersA(hRequest,"\r\rMalformedTest:value\n\nMalformedTestTwo: value2\rMalformedTestThree: value3\n\n\r\r\n",-1, HTTP_ADDREQ_FLAG_ADD|HTTP_ADDREQ_FLAG_REPLACE),
1993  "Failed to add header with malformed entries in list\n");
1994 
1995  index = 0;
1996  len = sizeof(buffer);
1997  strcpy(buffer,"MalformedTest");
1998  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
1999  ok(index == 1, "Index was not incremented\n");
2000  ok(strcmp(buffer,"value")==0, "incorrect string was returned(%s)\n",buffer);
2001  index = 0;
2002  len = sizeof(buffer);
2003  strcpy(buffer,"MalformedTestTwo");
2004  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
2005  ok(index == 1, "Index was not incremented\n");
2006  ok(strcmp(buffer,"value2")==0, "incorrect string was returned(%s)\n",buffer);
2007  index = 0;
2008  len = sizeof(buffer);
2009  strcpy(buffer,"MalformedTestThree");
2010  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
2011  ok(index == 1, "Index was not incremented\n");
2012  ok(strcmp(buffer,"value3")==0, "incorrect string was returned(%s)\n",buffer);
2013 
2014  ret = HttpAddRequestHeadersA(hRequest, "Authorization: Basic\r\n", -1, HTTP_ADDREQ_FLAG_ADD);
2015  ok(ret, "unable to add header %u\n", GetLastError());
2016 
2017  index = 0;
2018  buffer[0] = 0;
2019  len = sizeof(buffer);
2021  ok(ret, "unable to query header %u\n", GetLastError());
2022  ok(index == 1, "index was not incremented\n");
2023  ok(!strcmp(buffer, "Basic"), "incorrect string was returned (%s)\n", buffer);
2024 
2025  ret = HttpAddRequestHeadersA(hRequest, "Authorization:\r\n", -1, HTTP_ADDREQ_FLAG_REPLACE);
2026  ok(ret, "unable to remove header %u\n", GetLastError());
2027 
2028  index = 0;
2029  len = sizeof(buffer);
2030  SetLastError(0xdeadbeef);
2032  "header still present\n");
2034 
2035  ok(InternetCloseHandle(hRequest), "Close request handle failed\n");
2036 done:
2037  ok(InternetCloseHandle(hConnect), "Close connect handle failed\n");
2038  ok(InternetCloseHandle(hSession), "Close session handle failed\n");
2039 }
#define HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA
Definition: wininet.h:1708
#define HTTP_QUERY_CUSTOM
Definition: wininet.h:1603
#define INTERNET_FLAG_NO_CACHE_WRITE
Definition: wininet.h:66
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define HTTP_QUERY_RAW_HEADERS_CRLF
Definition: wininet.h:1545
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char CHAR
Definition: xmlstorage.h:175
HINTERNET WINAPI InternetConnectA(HINTERNET hInternet, LPCSTR lpszServerName, INTERNET_PORT nServerPort, LPCSTR lpszUserName, LPCSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:1343
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1436
#define HTTP_ADDREQ_FLAG_ADD_IF_NEW
Definition: wininet.h:1706
#define lstrlenW
Definition: compat.h:415
#define INTERNET_DEFAULT_HTTP_PORT
Definition: winhttp.h:36
HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType, LPCSTR lpszProxy, LPCSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1079
#define HTTP_ADDREQ_FLAG_REPLACE
Definition: wininet.h:1711
unsigned int BOOL
Definition: ntddk_ex.h:94
#define HTTP_QUERY_FLAG_REQUEST_HEADERS
Definition: wininet.h:1604
#define HTTP_ADDREQ_FLAG_ADD
Definition: wininet.h:1707
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hHttpRequest, LPCSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier)
Definition: http.c:1428
__wchar_t WCHAR
Definition: xmlstorage.h:180
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
#define ERROR_HTTP_HEADER_NOT_FOUND
Definition: wininet.h:2058
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_INTERNET_NAME_NOT_RESOLVED
Definition: wininet.h:1996
#define SetLastError(x)
Definition: compat.h:417
int ret
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:3883
GLenum GLsizei len
Definition: glext.h:6722
#define INTERNET_OPEN_TYPE_PRECONFIG
Definition: wininet.h:521
#define ok(value,...)
Definition: atltest.h:57
HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession, LPCSTR lpszVerb, LPCSTR lpszObjectName, LPCSTR lpszVersion, LPCSTR lpszReferrer, LPCSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:1509
#define skip(...)
Definition: atltest.h:64
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON
Definition: wininet.h:1709
#define memset(x, y, z)
Definition: compat.h:39
#define HTTP_ADDREQ_FLAG_COALESCE
Definition: wininet.h:1710
#define HTTP_QUERY_AUTHORIZATION
Definition: wininet.h:1551
#define INTERNET_SERVICE_HTTP
Definition: wininet.h:562
BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:4031
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by START_TEST().

◆ HttpSendRequestEx_test()

static void HttpSendRequestEx_test ( void  )
static

Definition at line 1297 of file http.c.

1298 {
1299  HINTERNET hSession;
1300  HINTERNET hConnect;
1301  HINTERNET hRequest;
1302 
1303  INTERNET_BUFFERSA BufferIn;
1304  DWORD dwBytesWritten, dwBytesRead, error;
1305  CHAR szBuffer[256];
1306  int i;
1307  BOOL ret;
1308 
1309  static char szPostData[] = "mode=Test";
1310  static const char szContentType[] = "Content-Type: application/x-www-form-urlencoded";
1311 
1312  hSession = InternetOpenA("Wine Regression Test",
1314  ok( hSession != NULL ,"Unable to open Internet session\n");
1315  hConnect = InternetConnectA(hSession, "test.winehq.org",
1317  0);
1318  ok( hConnect != NULL, "Unable to connect to http://test.winehq.org\n");
1319  hRequest = HttpOpenRequestA(hConnect, "POST", "/tests/post.php",
1321  if (!hRequest && GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED)
1322  {
1323  skip( "Network unreachable, skipping test\n" );
1324  goto done;
1325  }
1326  ok( hRequest != NULL, "Failed to open request handle err %u\n", GetLastError());
1327 
1329 
1330  BufferIn.dwStructSize = sizeof(BufferIn);
1331  BufferIn.Next = (INTERNET_BUFFERSA*)0xdeadcab;
1332  BufferIn.lpcszHeader = szContentType;
1333  BufferIn.dwHeadersLength = sizeof(szContentType)-1;
1334  BufferIn.dwHeadersTotal = sizeof(szContentType)-1;
1335  BufferIn.lpvBuffer = szPostData;
1336  BufferIn.dwBufferLength = 3;
1337  BufferIn.dwBufferTotal = sizeof(szPostData)-1;
1338  BufferIn.dwOffsetLow = 0;
1339  BufferIn.dwOffsetHigh = 0;
1340 
1341  SetLastError(0xdeadbeef);
1342  ret = HttpSendRequestExA(hRequest, &BufferIn, NULL, 0 ,0);
1343  error = GetLastError();
1344  ok(ret, "HttpSendRequestEx Failed with error %u\n", error);
1345  ok(error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", error);
1346 
1348 
1349  for (i = 3; szPostData[i]; i++)
1350  ok(InternetWriteFile(hRequest, &szPostData[i], 1, &dwBytesWritten),
1351  "InternetWriteFile failed\n");
1352 
1354 
1355  ok(HttpEndRequestA(hRequest, NULL, 0, 0), "HttpEndRequest Failed\n");
1356 
1357  test_request_flags(hRequest, 0);
1358 
1359  ok(InternetReadFile(hRequest, szBuffer, 255, &dwBytesRead),
1360  "Unable to read response\n");
1361  szBuffer[dwBytesRead] = 0;
1362 
1363  ok(dwBytesRead == 13,"Read %u bytes instead of 13\n",dwBytesRead);
1364  ok(strncmp(szBuffer,"mode => Test\n",dwBytesRead)==0 || broken(proxy_active()),"Got string %s\n",szBuffer);
1365 
1366  ok(InternetCloseHandle(hRequest), "Close request handle failed\n");
1367 done:
1368  ok(InternetCloseHandle(hConnect), "Close connect handle failed\n");
1369  ok(InternetCloseHandle(hSession), "Close session handle failed\n");
1370 }
#define INTERNET_FLAG_NO_CACHE_WRITE
Definition: wininet.h:66
LPCSTR lpcszHeader
Definition: wininet.h:261
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
DWORD dwHeadersTotal
Definition: wininet.h:263
char CHAR
Definition: xmlstorage.h:175
HINTERNET WINAPI InternetConnectA(HINTERNET hInternet, LPCSTR lpszServerName, INTERNET_PORT nServerPort, LPCSTR lpszUserName, LPCSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:1343
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1436
LPVOID lpvBuffer
Definition: wininet.h:264
#define INTERNET_DEFAULT_HTTP_PORT
Definition: winhttp.h:36
HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType, LPCSTR lpszProxy, LPCSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1079
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static BOOL proxy_active(void)
Definition: http.c:180
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define test_request_flags(a, b)
Definition: http.c:300
BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer, DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
Definition: internet.c:2134
DWORD dwStructSize
Definition: wininet.h:259
struct _INTERNET_BUFFERSA * Next
Definition: wininet.h:260
DWORD dwBufferTotal
Definition: wininet.h:266
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_INTERNET_NAME_NOT_RESOLVED
Definition: wininet.h:1996
#define SetLastError(x)
Definition: compat.h:417
int ret
#define broken(x)
Definition: _sntprintf.h:21
#define INTERNET_REQFLAG_NO_HEADERS
Definition: wininet.h:58
#define INTERNET_OPEN_TYPE_PRECONFIG
Definition: wininet.h:521
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
Definition: internet.c:2174
#define ok(value,...)
Definition: atltest.h:57
DWORD dwBufferLength
Definition: wininet.h:265
BOOL WINAPI HttpSendRequestExA(HINTERNET hRequest, LPINTERNET_BUFFERSA lpBuffersIn, LPINTERNET_BUFFERSA lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:5481
HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession, LPCSTR lpszVerb, LPCSTR lpszObjectName, LPCSTR lpszVersion, LPCSTR lpszReferrer, LPCSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:1509
DWORD dwHeadersLength
Definition: wininet.h:262
DWORD dwOffsetHigh
Definition: wininet.h:268
#define skip(...)
Definition: atltest.h:64
BOOL WINAPI HttpEndRequestA(HINTERNET hRequest, LPINTERNET_BUFFERSA lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:5385
#define INTERNET_SERVICE_HTTP
Definition: wininet.h:562

Referenced by START_TEST().

◆ init_events()

static void init_events ( void  )
static

Definition at line 199 of file http.c.

200 {
206 }
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
static HANDLE complete_event
Definition: http.c:113
smooth NULL
Definition: ftsmooth.c:416
static HANDLE server_req_rec_event
Definition: http.c:113
static HANDLE conn_close_event
Definition: http.c:113
static HANDLE request_sent_event
Definition: http.c:113
static HANDLE conn_wait_event
Definition: http.c:113

Referenced by START_TEST().

◆ init_status_tests()

static void init_status_tests ( void  )
static

Definition at line 7709 of file http.c.

7710 {
7711  memset(expect, 0, sizeof(expect));
7712  memset(optional, 0, sizeof(optional));
7713  memset(wine_allow, 0, sizeof(wine_allow));
7714  memset(notified, 0, sizeof(notified));
7715  memset(status_string, 0, sizeof(status_string));
7716 
7717 #define STATUS_STRING(status) status_string[status] = #status
7744 #undef STATUS_STRING
7745 }
#define INTERNET_STATUS_HANDLE_CLOSING
Definition: wininet.h:896
#define INTERNET_STATUS_REQUEST_SENT
Definition: wininet.h:888
#define INTERNET_STATUS_CONNECTING_TO_SERVER
Definition: wininet.h:885
static int expect[MAX_INTERNET_STATUS]
Definition: http.c:109
#define INTERNET_STATUS_PREFETCH
Definition: wininet.h:892
#define INTERNET_STATUS_CONNECTION_CLOSED
Definition: wininet.h:894
#define INTERNET_STATUS_CLOSING_CONNECTION
Definition: wininet.h:893
static const char * status_string[MAX_INTERNET_STATUS]
Definition: http.c:111
#define INTERNET_STATUS_RECEIVING_RESPONSE
Definition: wininet.h:889
#define STATUS_STRING(status)
#define INTERNET_STATUS_NAME_RESOLVED
Definition: wininet.h:884
#define INTERNET_STATUS_CTL_RESPONSE_RECEIVED
Definition: wininet.h:891
#define INTERNET_STATUS_P3P_POLICYREF
Definition: wininet.h:907
#define INTERNET_STATUS_COOKIE_RECEIVED
Definition: wininet.h:904
static int notified[MAX_INTERNET_STATUS]
Definition: http.c:109
#define INTERNET_STATUS_P3P_HEADER
Definition: wininet.h:906
#define INTERNET_STATUS_REDIRECT
Definition: wininet.h:899
static int wine_allow[MAX_INTERNET_STATUS]
Definition: http.c:109
#define INTERNET_STATUS_SENDING_REQUEST
Definition: wininet.h:887
#define INTERNET_STATUS_RESOLVING_NAME
Definition: wininet.h:883
#define INTERNET_STATUS_COOKIE_HISTORY
Definition: wininet.h:908
#define INTERNET_STATUS_REQUEST_COMPLETE
Definition: wininet.h:898
#define INTERNET_STATUS_STATE_CHANGE
Definition: wininet.h:902
#define INTERNET_STATUS_CONNECTED_TO_SERVER
Definition: wininet.h:886
#define INTERNET_STATUS_DETECTING_PROXY
Definition: wininet.h:897
#define INTERNET_STATUS_COOKIE_SENT
Definition: wininet.h:903
#define INTERNET_STATUS_HANDLE_CREATED
Definition: wininet.h:895
#define INTERNET_STATUS_USER_INPUT_REQUIRED
Definition: wininet.h:901
#define memset(x, y, z)
Definition: compat.h:39
static int optional[MAX_INTERNET_STATUS]
Definition: http.c:109
#define INTERNET_STATUS_INTERMEDIATE_RESPONSE
Definition: wininet.h:900
#define INTERNET_STATUS_RESPONSE_RECEIVED
Definition: wininet.h:890
#define INTERNET_STATUS_PRIVACY_IMPACTED
Definition: wininet.h:905

Referenced by START_TEST().

◆ INTERNET_STATUS_CALLBACK()

static INTERNET_STATUS_CALLBACK ( WINAPI pInternetSetStatusCallbackA)
static

◆ InternetLockRequestFile_test()

static void InternetLockRequestFile_test ( void  )
static

Definition at line 1657 of file http.c.

1658 {
1659  char file_name[MAX_PATH];
1660  test_request_t req;
1661  HANDLE lock, lock2;
1662  DWORD size;
1663  BOOL ret;
1664 
1665  open_simple_request(&req, "test.winehq.org", INTERNET_DEFAULT_HTTP_PORT, NULL, "/tests/hello.html");
1666 
1667  size = sizeof(file_name);
1669  ok(!ret, "InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) succeeded\n");
1670  ok(GetLastError() == ERROR_INTERNET_ITEM_NOT_FOUND, "GetLastError()=%u\n", GetLastError());
1671  ok(!size, "size = %d\n", size);
1672 
1673  lock = NULL;
1675  ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError());
1676 
1677  ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
1678  ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
1679 
1680  size = sizeof(file_name);
1682  ok(ret, "InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) failed: %u\n", GetLastError());
1683 
1685  ok(ret, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError());
1686  ok(lock != NULL, "lock == NULL\n");
1687 
1688  ret = InternetLockRequestFile(req.request, &lock2);
1689  ok(ret, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError());
1690  ok(lock == lock2, "lock != lock2\n");
1691 
1692  ret = InternetUnlockRequestFile(lock2);
1693  ok(ret, "InternetUnlockRequestFile failed: %u\n", GetLastError());
1694 
1696  ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%u)\n", ret, GetLastError());
1697 
1698  ok(InternetCloseHandle(req.request), "Close request handle failed\n");
1699 
1701  ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%u)\n", ret, GetLastError());
1702 
1704  ok(ret, "InternetUnlockRequestFile failed: %u\n", GetLastError());
1705 
1707  ok(ret, "Deleting file returned %x(%u)\n", ret, GetLastError());
1708 }
rwlock_t lock
Definition: tcpcore.h:1163
#define ERROR_INTERNET_ITEM_NOT_FOUND
Definition: wininet.h:2017
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1436
BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
Definition: http.c:5713
#define INTERNET_DEFAULT_HTTP_PORT
Definition: winhttp.h:36
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2607
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
HINTERNET request
Definition: http.c:509
BOOL WINAPI InternetLockRequestFile(HINTERNET hInternet, HANDLE *lphLockReqHandle)
Definition: internet.c:3915
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define open_simple_request(a, b, c, d, e)
Definition: http.c:512
#define ERROR_SHARING_VIOLATION
Definition: winerror.h:135
BOOL WINAPI InternetUnlockRequestFile(HANDLE hLockHandle)
Definition: internet.c:3944
#define ok(value,...)
Definition: atltest.h:57
static LPCWSTR file_name
Definition: protocol.c:147
#define INTERNET_OPTION_DATAFILE_NAME
Definition: wininet.h:727

Referenced by START_TEST().

◆ InternetOpenRequest_test()

static void InternetOpenRequest_test ( void  )
static

Definition at line 1372 of file http.c.

1373 {
1375  static const char *types[] = { "*", "", NULL };
1376  static const WCHAR slash[] = {'/', 0}, any[] = {'*', 0}, empty[] = {0};
1377  static const WCHAR *typesW[] = { any, empty, NULL };
1378  BOOL ret;
1379 
1380  session = InternetOpenA("Wine Regression Test", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
1381  ok(session != NULL ,"Unable to open Internet session\n");
1382 
1384  INTERNET_SERVICE_HTTP, 0, 0);
1385  ok(connect == NULL, "InternetConnectA should have failed\n");
1386  ok(GetLastError() == ERROR_INVALID_PARAMETER, "InternetConnectA with NULL server named should have failed with ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
1387 
1389  INTERNET_SERVICE_HTTP, 0, 0);
1390  ok(connect == NULL, "InternetConnectA should have failed\n");
1391  ok(GetLastError() == ERROR_INVALID_PARAMETER, "InternetConnectA with blank server named should have failed with ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
1392 
1394  INTERNET_SERVICE_HTTP, 0, 0);
1395  ok(connect != NULL, "Unable to connect to http://test.winehq.org with error %d\n", GetLastError());
1396 
1399  {
1400  skip( "Network unreachable, skipping test\n" );
1401  goto done;
1402  }
1403  ok(request != NULL, "Failed to open request handle err %u\n", GetLastError());
1404 
1405  ret = HttpSendRequestW(request, NULL, 0, NULL, 0);
1406  ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
1407  ok(InternetCloseHandle(request), "Close request handle failed\n");
1408 
1410  ok(request != NULL, "Failed to open request handle err %u\n", GetLastError());
1411 
1412  ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
1413  ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
1414  ok(InternetCloseHandle(request), "Close request handle failed\n");
1415 
1416 done:
1417  ok(InternetCloseHandle(connect), "Close connect handle failed\n");
1418  ok(InternetCloseHandle(session), "Close session handle failed\n");
1419 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define INTERNET_FLAG_NO_CACHE_WRITE
Definition: wininet.h:66
HINTERNET WINAPI InternetConnectA(HINTERNET hInternet, LPCSTR lpszServerName, INTERNET_PORT nServerPort, LPCSTR lpszUserName, LPCSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:1343
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1436
BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
Definition: http.c:5713
INT WSAAPI connect(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: sockctrl.c:23
#define INTERNET_DEFAULT_HTTP_PORT
Definition: winhttp.h:36
HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType, LPCSTR lpszProxy, LPCSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1079
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
Definition: http.c:5631
Definition: cmds.c:130
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ERROR_INTERNET_NAME_NOT_RESOLVED
Definition: wininet.h:1996
int ret
#define INTERNET_OPEN_TYPE_PRECONFIG
Definition: wininet.h:521
#define ok(value,...)
Definition: atltest.h:57
HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession, LPCSTR lpszVerb, LPCSTR lpszObjectName, LPCSTR lpszVersion, LPCSTR lpszReferrer, LPCSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:1509
BOOL empty
Definition: button.c:170
Definition: tftpd.h:85
#define skip(...)
Definition: atltest.h:64
HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, LPCWSTR lpszReferrer, LPCWSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:3481
#define INTERNET_SERVICE_HTTP
Definition: wininet.h:562

Referenced by START_TEST().

◆ InternetOpenUrlA_test()

static void InternetOpenUrlA_test ( void  )
static

Definition at line 1260 of file http.c.

1261 {
1262  HINTERNET myhinternet, myhttp;
1263  char buffer[0x400];
1264  DWORD size, readbytes, totalbytes=0;
1265  BOOL ret;
1266 
1269  "DeleteUrlCacheEntry returned %x, GetLastError() = %d\n", ret, GetLastError());
1270 
1271  myhinternet = InternetOpenA("Winetest",0,NULL,NULL,INTERNET_FLAG_NO_CACHE_WRITE);
1272  ok((myhinternet != 0), "InternetOpen failed, error %u\n",GetLastError());
1273  size = 0x400;
1275  ok( ret, "InternetCanonicalizeUrl failed, error %u\n",GetLastError());
1276 
1277  SetLastError(0);
1278  myhttp = InternetOpenUrlA(myhinternet, TEST_URL, 0, 0,
1281  return; /* WinXP returns this when not connected to the net */
1282  ok((myhttp != 0),"InternetOpenUrl failed, error %u\n",GetLastError());
1283  ret = InternetReadFile(myhttp, buffer,0x400,&readbytes);
1284  ok( ret, "InternetReadFile failed, error %u\n",GetLastError());
1285  totalbytes += readbytes;
1286  while (readbytes && InternetReadFile(myhttp, buffer,0x400,&readbytes))
1287  totalbytes += readbytes;
1288  trace("read 0x%08x bytes\n",totalbytes);
1289 
1290  InternetCloseHandle(myhttp);
1291  InternetCloseHandle(myhinternet);
1292 
1294  ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, "INTERNET_FLAG_NO_CACHE_WRITE flag doesn't work\n");
1295 }
#define INTERNET_FLAG_NO_CACHE_WRITE
Definition: wininet.h:66
BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName)
Definition: urlcache.c:3310
#define INTERNET_FLAG_TRANSFER_BINARY
Definition: wininet.h:91
BOOL WINAPI InternetCanonicalizeUrlA(LPCSTR lpszUrl, LPSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
Definition: internet.c:2000
#define INTERNET_FLAG_RELOAD
Definition: wininet.h:61
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1436
HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType, LPCSTR lpszProxy, LPCSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1079
#define ICU_BROWSER_MODE
Definition: winhttp.h:294
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
GLsizeiptr size
Definition: glext.h:5919
#define trace
Definition: atltest.h:70
#define TEST_URL
Definition: http.c:42
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_INTERNET_NAME_NOT_RESOLVED
Definition: wininet.h:1996
#define SetLastError(x)
Definition: compat.h:417
int ret
HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl, LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3662
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
Definition: internet.c:2174
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ InternetReadFile_chunked_test()

static void InternetReadFile_chunked_test ( void  )
static

Definition at line 906 of file http.c.

907 {
908  BOOL res;
909  CHAR buffer[4000];
910  DWORD length, got;
911  const char *types[2] = { "*", NULL };
912  HINTERNET hi, hic = 0, hor = 0;
913 
914  trace("Starting InternetReadFile chunked test\n");
915 
916  trace("InternetOpenA <--\n");
918  ok((hi != 0x0),"InternetOpen failed with error %u\n", GetLastError());
919  trace("InternetOpenA -->\n");
920 
921  if (hi == 0x0) goto abort;
922 
923  trace("InternetConnectA <--\n");
924  hic=InternetConnectA(hi, "test.winehq.org", INTERNET_INVALID_PORT_NUMBER,
925  NULL, NULL, INTERNET_SERVICE_HTTP, 0x0, 0xdeadbeef);
926  ok((hic != 0x0),"InternetConnect failed with error %u\n", GetLastError());
927  trace("InternetConnectA -->\n");
928 
929  if (hic == 0x0) goto abort;
930 
931  trace("HttpOpenRequestA <--\n");
932  hor = HttpOpenRequestA(hic, "GET", "/tests/chunked", NULL, NULL, types,
934  0xdeadbead);
935  if (hor == 0x0 && GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED) {
936  /*
937  * If the internet name can't be resolved we are probably behind
938  * a firewall or in some other way not directly connected to the
939  * Internet. Not enough reason to fail the test. Just ignore and
940  * abort.
941  */
942  } else {
943  ok((hor != 0x0),"HttpOpenRequest failed with error %u\n", GetLastError());
944  }
945  trace("HttpOpenRequestA -->\n");
946 
947  if (hor == 0x0) goto abort;
948 
949  trace("HttpSendRequestA -->\n");
950  SetLastError(0xdeadbeef);
951  res = HttpSendRequestA(hor, "", -1, NULL, 0);
953  "Synchronous HttpSendRequest returning 0, error %u\n", GetLastError());
954  trace("HttpSendRequestA <--\n");
955 
956  test_request_flags(hor, 0);
957 
958  length = 100;
960  buffer[length]=0;
961  trace("Option CONTENT_TYPE -> %i %s\n",res,buffer);
962 
963  SetLastError( 0xdeadbeef );
964  length = 100;
966  buffer[length]=0;
967  trace("Option TRANSFER_ENCODING -> %i %s\n",res,buffer);
969  "Failed to get TRANSFER_ENCODING option, error %u\n", GetLastError() );
970  ok( !strcmp( buffer, "chunked" ) || ( ! res && proxy_active() && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND ),
971  "Wrong transfer encoding '%s'\n", buffer );
972 
973  SetLastError( 0xdeadbeef );
974  length = 16;
976  ok( !res, "Found CONTENT_LENGTH option '%s'\n", buffer );
977  ok( GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "Wrong error %u\n", GetLastError() );
978 
979  length = 100;
980  trace("Entering Query loop\n");
981 
982  while (TRUE)
983  {
985  ok(!(!res && length != 0),"InternetQueryDataAvailable failed with non-zero length\n");
986  ok(res, "InternetQueryDataAvailable failed, error %d\n", GetLastError());
987  trace("got %u available\n",length);
988  if (length)
989  {
990  char *buffer = HeapAlloc(GetProcessHeap(),0,length+1);
991 
992  SetLastError(0xdeadbeef);
993  res = InternetReadFile(hor,buffer,length,&got);
994  ok(GetLastError() == 0 ||
995  broken(GetLastError() == 0xdeadbeef /* XP/W2K3 */), "Last Error not reset %u\n", GetLastError());
996 
997  buffer[got]=0;
998  trace("ReadFile -> %i %i\n",res,got);
999  ok( length == got, "only got %u of %u available\n", got, length );
1000  ok( buffer[got-1] == '\n', "received partial line '%s'\n", buffer );
1001 
1003  if (!got) break;
1004  }
1005  if (length == 0)
1006  {
1007  got = 0xdeadbeef;
1008  SetLastError(0xdeadbeef);
1009  res = InternetReadFile( hor, buffer, 1, &got );
1010  ok( res, "InternetReadFile failed: %u\n", GetLastError() );
1011  ok(GetLastError() == 0 ||
1012  broken(GetLastError() == 0xdeadbeef /* XP/W2K3 */), "Last Error not reset %u\n", GetLastError());
1013  ok( !got, "got %u\n", got );
1014  break;
1015  }
1016  }
1017 abort:
1018  trace("aborting\n");
1019  if (hor != 0x0) {
1020  res = InternetCloseHandle(hor);
1021