ReactOS  0.4.14-dev-41-g31d7680
http.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.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  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_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_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 okmsg2 []
 
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 37 of file http.c.

◆ _SECURITY_FLAG_CERT_INVALID_CN

#define _SECURITY_FLAG_CERT_INVALID_CN   0x02000000

Definition at line 38 of file http.c.

◆ _SECURITY_FLAG_CERT_INVALID_DATE

#define _SECURITY_FLAG_CERT_INVALID_DATE   0x04000000

Definition at line 39 of file http.c.

◆ _SECURITY_FLAG_CERT_REV_FAILED

#define _SECURITY_FLAG_CERT_REV_FAILED   0x00800000

Definition at line 36 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 5246 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:108
static const char * status_string[MAX_INTERNET_STATUS]
Definition: http.c:110
static int wine_allow[MAX_INTERNET_STATUS]
Definition: http.c:108
#define ok(value,...)
Definition: atltest.h:57
#define MAX_INTERNET_STATUS
Definition: http.c:107
static int optional[MAX_INTERNET_STATUS]
Definition: http.c:108
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Definition at line 67 of file http.c.

◆ CHECK_NOT_NOTIFIED

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

Definition at line 104 of file http.c.

◆ CHECK_NOTIFIED

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

Definition at line 101 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:110
static int notified[MAX_INTERNET_STATUS]
Definition: http.c:108
GLuint GLuint num
Definition: glext.h:9618
#define MAX_INTERNET_STATUS
Definition: http.c:107
static int optional[MAX_INTERNET_STATUS]
Definition: http.c:108
Definition: ps.c:97

Definition at line 92 of file http.c.

◆ CLEAR_NOTIFIED

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

Definition at line 89 of file http.c.

◆ close_request

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

Definition at line 524 of file http.c.

◆ expect_data_available

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

Definition at line 5232 of file http.c.

◆ MAX_INTERNET_STATUS

#define MAX_INTERNET_STATUS   (INTERNET_STATUS_COOKIE_HISTORY+1)

Definition at line 107 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 510 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 5112 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 5086 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 5181 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 5079 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 5052 of file http.c.

◆ receive_simple_request

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

Definition at line 537 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 5126 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 5160 of file http.c.

◆ server_read_request

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

Definition at line 4931 of file http.c.

◆ SET_EXPECT

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

Definition at line 50 of file http.c.

◆ SET_EXPECT2

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

Definition at line 47 of file http.c.

◆ SET_OPTIONAL

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

Definition at line 56 of file http.c.

◆ SET_OPTIONAL2

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

Definition at line 53 of file http.c.

◆ set_secflags

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

Definition at line 5997 of file http.c.

◆ SET_WINE_ALLOW

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

Definition at line 64 of file http.c.

◆ SET_WINE_ALLOW2

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

Definition at line 61 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 330 of file http.c.

◆ test_request_flags

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

Definition at line 299 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 300 of file http.c.

◆ test_request_url

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

Definition at line 317 of file http.c.

◆ test_secflags_option

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

Definition at line 5975 of file http.c.

◆ test_security_info

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

Definition at line 5935 of file http.c.

◆ test_status_code

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

Definition at line 225 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 226 of file http.c.

◆ TEST_URL

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

Definition at line 41 of file http.c.

◆ TESTF_CHUNKED

#define TESTF_CHUNKED   0x04

Definition at line 118 of file http.c.

◆ TESTF_COMPRESSED

#define TESTF_COMPRESSED   0x02

Definition at line 117 of file http.c.

◆ TESTF_REDIRECT

#define TESTF_REDIRECT   0x01

Definition at line 116 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 6690 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 5247 of file http.c.

5248 {
5249  BOOL res;
5250 
5253 
5254  *size = 0xdeadbeef;
5255  res = InternetQueryDataAvailable(req, size, 0, 0);
5256  ok_(__FILE__,line)(!res && GetLastError() == ERROR_IO_PENDING,
5257  "InternetQueryDataAvailable returned: %x(%u)\n", res, GetLastError());
5258  ok_(__FILE__,line)(!*size, "size = %u\n", *size);
5259 
5262 }
static BOOL skip_receive_notification_tests
Definition: http.c:4944
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:3845
#define INTERNET_STATUS_RECEIVING_RESPONSE
Definition: wininet.h:889
Definition: parser.c:48
#define SET_EXPECT(status)
Definition: http.c:50
GLsizeiptr size
Definition: glext.h:5919
#define CHECK_NOTIFIED(status)
Definition: http.c:101
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 525 of file http.c.

526 {
527  BOOL ret;
528 
530  ok_(__FILE__,line)(ret, "InternetCloseHandle(request) failed: %u\n", GetLastError());
532  ok_(__FILE__,line)(ret, "InternetCloseHandle(connection) failed: %u\n", GetLastError());
534  ok_(__FILE__,line)(ret, "InternetCloseHandle(session) failed: %u\n", GetLastError());
535 }
HINTERNET session
Definition: http.c:505
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1437
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: parser.c:48
HINTERNET request
Definition: http.c:507
int ret
HINTERNET connection
Definition: http.c:506
#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 5233 of file http.c.

5234 {
5235  DWORD size = 0;
5236  BOOL res;
5237 
5238  res = InternetQueryDataAvailable(req, &size, 0, 0);
5239  ok_(__FILE__,line)(res, "InternetQueryDataAvailable failed: %u\n", GetLastError());
5240  if(exsize != -1)
5241  ok_(__FILE__,line)(size == exsize, "size = %u, expected %u\n", size, exsize);
5242 
5243  return size;
5244 }
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:3845
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 511 of file http.c.

513 {
515  ok_(__FILE__,line)(req->session != NULL, "InternetOpenA failed: %u\n", GetLastError());
516 
518  ok_(__FILE__,line)(req->connection != NULL, "InternetConnectA failed: %u\n", GetLastError());
519 
520  req->request = HttpOpenRequestA(req->connection, verb, url, NULL, NULL, NULL, 0, 0);
521  ok_(__FILE__,line)(req->request != NULL, "HttpOpenRequest failed: %u\n", GetLastError());
522 }
HINTERNET session
Definition: http.c:505
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:1344
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType, LPCSTR lpszProxy, LPCSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1080
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
HINTERNET request
Definition: http.c:507
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:1467
USHORT port
Definition: uri.c:227
#define INTERNET_SERVICE_HTTP
Definition: wininet.h:562
HINTERNET connection
Definition: http.c:506
#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 5113 of file http.c.

5115 {
5116  _read_expect_sync_data_len(line, req, buf, buf_size, exdata, strlen(exdata));
5117 }
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:5087
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 5087 of file http.c.

5089 {
5090  DWORD ret_size = 0xdeadbeef;
5091  BOOL ret;
5092 
5096  received_response_size = 0xdeadbeef;
5097 
5098  memset(buf, 0xff, buf_size);
5099  ret = InternetReadFile(req, buf, buf_size, &ret_size);
5100  ok_(__FILE__,line)(ret, "InternetReadFileExW failed: %u\n", GetLastError());
5101  ok_(__FILE__,line)(ret_size == len, "dwBufferLength = %u, expected %u\n", ret_size, len);
5102  if(len && exdata)
5103  ok_(__FILE__,line)(!memcmp(buf, exdata, len), "Unexpected data\n");
5104 
5108  ok_(__FILE__,line)(received_response_size == len, "received_response_size = %u\n", received_response_size);
5109  ok_(__FILE__,line)(!req_error, "req_error = %u\n", req_error);
5110 }
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:50
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
static DWORD req_error
Definition: http.c:113
#define CHECK_NOTIFIED(status)
Definition: http.c:101
#define INTERNET_STATUS_REQUEST_COMPLETE
Definition: wininet.h:898
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
Definition: internet.c:2175
#define CLEAR_NOTIFIED(status)
Definition: http.c:89
static DWORD received_response_size
Definition: http.c:4945
#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 5182 of file http.c.

5184 {
5185  unsigned len = 0;
5186  BOOL ret;
5187 
5190 
5191  memset(buf->lpvBuffer, 0, max(buf_size, sizeof(DWORD)));
5192  buf->dwBufferLength = buf_size;
5193  ret = InternetReadFileExW(req, buf, flags, 0xdeadbeef);
5194  ok_(__FILE__,line)(!ret && GetLastError() == ERROR_IO_PENDING, "InternetReadFileExW returned %x (%u)\n", ret, GetLastError());
5195  ok_(__FILE__,line)(buf->dwBufferLength == buf_size, "dwBufferLength = %u, expected %u\n", buf->dwBufferLength, buf_size);
5196  if(exdata) {
5197  len = strlen(exdata);
5198  ok_(__FILE__,line)(!memcmp(buf->lpvBuffer, exdata, len), "unexpected buffer data\n");
5199  }else {
5200  ok_(__FILE__,line)(!*(DWORD*)buf->lpvBuffer, "buffer data changed\n");
5201  }
5202 
5205 }
#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:4944
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:50
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:2270
GLenum GLsizei len
Definition: glext.h:6722
#define CHECK_NOTIFIED(status)
Definition: http.c:101
#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 5080 of file http.c.

5082 {
5083  _readex_expect_sync_data_len(line, req, flags, buf, buf_size, exdata, strlen(exdata), expect_receive);
5084 }
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:5053
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 5053 of file http.c.

5055 {
5056  BOOL ret;
5057 
5058  if(!skip_receive_notification_tests && expect_receive) {
5061  received_response_size = 0xdeadbeef;
5062  }
5063 
5064  memset(buf->lpvBuffer, 0xff, buf_size);
5065  buf->dwBufferLength = buf_size;
5066  ret = InternetReadFileExW(req, buf, flags, 0xdeadbeef);
5067  ok_(__FILE__,line)(ret, "InternetReadFileExW failed: %u\n", GetLastError());
5068  ok_(__FILE__,line)(buf->dwBufferLength == len, "dwBufferLength = %u, expected %u\n", buf->dwBufferLength, len);
5069  if(len && exdata)
5070  ok_(__FILE__,line)(!memcmp(buf->lpvBuffer, exdata, len), "Unexpected data\n");
5071 
5072  if(!skip_receive_notification_tests && expect_receive) {
5075  ok_(__FILE__,line)(received_response_size == len, "received_response_size = %u\n", received_response_size);
5076  }
5077 }
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:4944
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:50
GLbitfield flags
Definition: glext.h:7161
int ret
BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:2270
GLenum GLsizei len
Definition: glext.h:6722
#define CHECK_NOTIFIED(status)
Definition: http.c:101
static DWORD received_response_size
Definition: http.c:4945
#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 538 of file http.c.

539 {
540  DWORD read = 0;
541  BOOL ret;
542 
543  ret = InternetReadFile(req, buf, buf_size, &read);
544  ok_(__FILE__,line)(ret, "InternetReadFile failed: %u\n", GetLastError());
545 
546  return read;
547 }
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:2175
_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 5127 of file http.c.

5130 {
5134 
5135  if(response)
5136  server_send_string(response);
5137 
5138  if(do_close_connection)
5139  close_connection();
5140 
5142 
5146  if(!skip_receive_notification_tests && expected_receive_size != -1)
5147  todo_wine_if(received_response_size != expected_receive_size) /* FIXME! remove when wine is fixed */
5148  ok_(__FILE__,line)(received_response_size == expected_receive_size,
5149  "received_response_size = %u\n", received_response_size);
5150  ok_(__FILE__,line)(req_error == expected_req_error, "req_error = %u, expected %u\n", req_error, expected_req_error);
5151 
5152  /* If IRF_NO_WAIT is used, buffer is not changed. */
5153  ok_(__FILE__,line)(*ret_size == expected_size, "dwBufferLength = %u\n", *ret_size);
5154  if(exdata)
5155  ok_(__FILE__,line)(!memcmp(buf, exdata, strlen(exdata)), "unexpected buffer data\n");
5156  else if(buf)
5157  ok_(__FILE__,line)(!*(DWORD*)buf, "buffer data changed\n");
5158 }
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:4944
static void close_connection(void)
Definition: http.c:5119
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
static HANDLE complete_event
Definition: http.c:112
Definition: parser.c:48
#define SET_EXPECT(status)
Definition: http.c:50
#define todo_wine_if(is_todo)
Definition: test.h:155
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD req_error
Definition: http.c:113
#define CHECK_NOTIFIED(status)
Definition: http.c:101
#define INTERNET_STATUS_REQUEST_COMPLETE
Definition: wininet.h:898
#define INFINITE
Definition: serial.h:102
static DWORD received_response_size
Definition: http.c:4945
#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:4921

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 5161 of file http.c.

5164 {
5165  _send_response_and_wait(line, response, close_connection, buf->lpvBuffer, &buf->dwBufferLength,
5166  exdata, exdata ? strlen(exdata) : buf->dwBufferLength, expected_req_error,
5167  expected_receive_size);
5168 }
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:5119
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:5127

◆ _server_read_request()

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

Definition at line 4932 of file http.c.

4933 {
4934  char buf[4000], *p;
4935  size_t size;
4936 
4937  size = server_read_data(buf, sizeof(buf) - 1);
4938  buf[size] = 0;
4939  p = strstr(buf, "\r\n");
4940  if(p) *p = 0;
4941  ok_(__FILE__,line)(p && !strcmp(buf, expected_request), "unexpected request %s\n", buf);
4942 }
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:4926
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 5998 of file http.c.

5999 {
6000  BOOL res;
6001 
6002  res = InternetSetOptionW(req, use_undoc ? 99 : INTERNET_OPTION_SECURITY_FLAGS, &flags, sizeof(flags));
6003  ok_(__FILE__,line)(res, "InternetSetOption(INTERNET_OPTION_SECURITY_FLAGS) failed: %u\n", GetLastError());
6004 }
BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
Definition: internet.c:2716
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 331 of file http.c.

332 {
333  HTTP_VERSION_INFO v = {0xdeadbeef, 0xdeadbeef};
334  DWORD size;
335  BOOL res;
336 
337  size = sizeof(v);
339  ok_(__FILE__,line)(res, "InternetQueryOptionW(INTERNET_OPTION_HTTP_VERSION) failed: %u\n", GetLastError());
340  ok_(__FILE__,line)(v.dwMajorVersion == 1, "dwMajorVersion = %d\n", v.dwMajorVersion);
341  ok_(__FILE__,line)(v.dwMinorVersion == 1, "dwMinorVersion = %d\n", v.dwMinorVersion);
342 }
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:2576
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 301 of file http.c.

302 {
303  DWORD flags, size;
304  BOOL res;
305 
306  flags = 0xdeadbeef;
307  size = sizeof(flags);
309  ok_(__FILE__,line)(res, "InternetQueryOptionW(INTERNET_OPTION_REQUEST_FLAGS) failed: %u\n", GetLastError());
310 
311  /* FIXME: Remove once we have INTERNET_REQFLAG_CACHE_WRITE_DISABLED implementation */
313  todo_wine_if (is_todo)
314  ok_(__FILE__,line)(flags == exflags, "flags = %x, expected %x\n", flags, exflags);
315 }
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:155
#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:2576
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 318 of file http.c.

319 {
321  DWORD size = sizeof(buf);
322  BOOL res;
323 
325  ok_(__FILE__,line)(res, "InternetQueryOptionA(INTERNET_OPTION_URL) failed: %u\n", GetLastError());
326  ok_(__FILE__,line)(size == strlen(expected_url), "size = %u\n", size);
327  ok_(__FILE__,line)(!strcmp(buf, expected_url), "unexpected URL %s, expected %s\n", buf, expected_url);
328 }
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:1380
Definition: parser.c:48
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2609
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 5976 of file http.c.

5977 {
5978  DWORD flags, size;
5979  BOOL res;
5980 
5981  flags = 0xdeadbeef;
5982  size = sizeof(flags);
5984  ok_(__FILE__,line)(res, "InternetQueryOptionW(INTERNET_OPTION_SECURITY_FLAGS) failed: %u\n", GetLastError());
5985  ok_(__FILE__,line)((flags & ~opt_flags) == ex_flags, "INTERNET_OPTION_SECURITY_FLAGS flags = %x, expected %x\n",
5986  flags, ex_flags);
5987 
5988  /* Option 98 is undocumented and seems to be the same as INTERNET_OPTION_SECURITY_FLAGS */
5989  flags = 0xdeadbeef;
5990  size = sizeof(flags);
5991  res = InternetQueryOptionW(req, 98, &flags, &size);
5992  ok_(__FILE__,line)(res, "InternetQueryOptionW(98) failed: %u\n", GetLastError());
5993  ok_(__FILE__,line)((flags & ~opt_flags) == ex_flags, "INTERNET_OPTION_SECURITY_FLAGS(98) flags = %x, expected %x\n",
5994  flags, ex_flags);
5995 }
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:2576
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 5936 of file http.c.

5937 {
5939  const CERT_CHAIN_CONTEXT *chain;
5940  DWORD flags;
5941  BOOL res;
5942 
5943  if(!pInternetGetSecurityInfoByURLA) {
5944  win_skip("pInternetGetSecurityInfoByURLA not available\n");
5945  return;
5946  }
5947 
5948  strcpy(url, urlc);
5949  chain = (void*)0xdeadbeef;
5950  flags = 0xdeadbeef;
5951  res = pInternetGetSecurityInfoByURLA(url, &chain, &flags);
5952  if(error == ERROR_SUCCESS) {
5953  ok_(__FILE__,line)(res, "InternetGetSecurityInfoByURLA failed: %u\n", GetLastError());
5954  ok_(__FILE__,line)(chain != NULL, "chain = NULL\n");
5955  ok_(__FILE__,line)(flags == ex_flags, "flags = %x\n", flags);
5957 
5958  SetLastError(0xdeadbeef);
5959  res = pInternetGetSecurityInfoByURLA(url, NULL, NULL);
5960  ok_(__FILE__,line)(!res && GetLastError() == ERROR_INVALID_PARAMETER,
5961  "InternetGetSecurityInfoByURLA returned: %x(%u)\n", res, GetLastError());
5962 
5963  res = pInternetGetSecurityInfoByURLA(url, &chain, NULL);
5964  ok_(__FILE__,line)(res, "InternetGetSecurityInfoByURLA failed: %u\n", GetLastError());
5966 
5967  res = pInternetGetSecurityInfoByURLA(url, NULL, &flags);
5968  ok_(__FILE__,line)(res, "InternetGetSecurityInfoByURLA failed: %u\n", GetLastError());
5969  }else {
5970  ok_(__FILE__,line)(!res && GetLastError() == error,
5971  "InternetGetSecurityInfoByURLA returned: %x(%u), expected %u\n", res, GetLastError(), error);
5972  }
5973 }
#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:1380
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:409
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:141
#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 227 of file http.c.

228 {
229  DWORD code, size, index;
230  char exbuf[12], bufa[10];
231  WCHAR bufw[10];
232  BOOL res;
233 
234  code = 0xdeadbeef;
235  size = sizeof(code);
237  ok_(__FILE__,line)(res, "[1] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE|number) failed: %u\n", GetLastError());
238  todo_wine_if (is_todo)
239  ok_(__FILE__,line)(code == excode, "code = %d, expected %d\n", code, excode);
240  ok_(__FILE__,line)(size == sizeof(code), "size = %u\n", size);
241 
242  code = 0xdeadbeef;
243  index = 0;
244  size = sizeof(code);
246  ok_(__FILE__,line)(res, "[2] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE|number index) failed: %u\n", GetLastError());
247  ok_(__FILE__,line)(!index, "index = %d, expected 0\n", index);
248  ok_(__FILE__,line)(size == sizeof(code), "size = %u\n", size);
249 
250  sprintf(exbuf, "%u", excode);
251 
252  size = sizeof(bufa);
254  ok_(__FILE__,line)(res, "[3] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
255  todo_wine_if (is_todo)
256  ok_(__FILE__,line)(!strcmp(bufa, exbuf), "unexpected status code %s, expected %s\n", bufa, exbuf);
257  ok_(__FILE__,line)(size == strlen(exbuf), "unexpected size %d for \"%s\"\n", size, exbuf);
258 
259  size = 0;
262  "[4] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
263  ok_(__FILE__,line)(size == strlen(exbuf)+1, "unexpected size %d for \"%s\"\n", size, exbuf);
264 
265  size = sizeof(bufw);
267  ok_(__FILE__,line)(res, "[5] HttpQueryInfoW(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
268  todo_wine_if (is_todo)
269  ok_(__FILE__,line)(!strcmp_wa(bufw, exbuf), "unexpected status code %s, expected %s\n", bufa, exbuf);
270  ok_(__FILE__,line)(size == strlen(exbuf)*sizeof(WCHAR), "unexpected size %d for \"%s\"\n", size, exbuf);
271 
272  size = 0;
275  "[6] HttpQueryInfoW(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
276  ok_(__FILE__,line)(size == (strlen(exbuf)+1)*sizeof(WCHAR), "unexpected size %d for \"%s\"\n", size, exbuf);
277 
278  if(0) {
279  size = sizeof(bufw);
281  ok(!res && GetLastError() == ERROR_INVALID_PARAMETER, "HttpQueryInfo(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
282  ok(size == sizeof(bufw), "unexpected size %d\n", size);
283  }
284 
285  code = 0xdeadbeef;
286  index = 1;
287  size = sizeof(code);
290  "[7] HttpQueryInfoA failed: %x(%d)\n", res, GetLastError());
291 
292  code = 0xdeadbeef;
293  size = sizeof(code);
296  "[8] HttpQueryInfoA failed: %x(%d)\n", res, GetLastError());
297 }
#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:2061
#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:155
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:172
#define ERROR_HTTP_HEADER_NOT_FOUND
Definition: wininet.h:2057
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:3807
#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:3955
#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 346 of file http.c.

353 {
354  CHECK_EXPECT(dwInternetStatus);
355  switch (dwInternetStatus)
356  {
358  if(winetest_debug > 1)
359  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_RESOLVING_NAME \"%s\" %d\n",
360  GetCurrentThreadId(), hInternet, dwContext,
361  (LPCSTR)lpvStatusInformation,dwStatusInformationLength);
362  *(LPSTR)lpvStatusInformation = '\0';
363  break;
365  if(winetest_debug > 1)
366  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_NAME_RESOLVED \"%s\" %d\n",
367  GetCurrentThreadId(), hInternet, dwContext,
368  (LPCSTR)lpvStatusInformation,dwStatusInformationLength);
369  *(LPSTR)lpvStatusInformation = '\0';
370  break;
372  if(winetest_debug > 1)
373  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CONNECTING_TO_SERVER \"%s\" %d\n",
374  GetCurrentThreadId(), hInternet, dwContext,
375  (LPCSTR)lpvStatusInformation,dwStatusInformationLength);
376  ok(dwStatusInformationLength == strlen(lpvStatusInformation)+1, "unexpected size %u\n",
377  dwStatusInformationLength);
378  *(LPSTR)lpvStatusInformation = '\0';
379  break;
381  if(winetest_debug > 1)
382  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CONNECTED_TO_SERVER \"%s\" %d\n",
383  GetCurrentThreadId(), hInternet, dwContext,
384  (LPCSTR)lpvStatusInformation,dwStatusInformationLength);
385  ok(dwStatusInformationLength == strlen(lpvStatusInformation)+1, "unexpected size %u\n",
386  dwStatusInformationLength);
387  *(LPSTR)lpvStatusInformation = '\0';
388  break;
390  if(winetest_debug > 1)
391  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_SENDING_REQUEST %p %d\n",
392  GetCurrentThreadId(), hInternet, dwContext,
393  lpvStatusInformation,dwStatusInformationLength);
394  break;
396  ok(dwStatusInformationLength == sizeof(DWORD),
397  "info length should be sizeof(DWORD) instead of %d\n",
398  dwStatusInformationLength);
399  if(winetest_debug > 1)
400  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_REQUEST_SENT 0x%x %d\n",
401  GetCurrentThreadId(), hInternet, dwContext,
402  *(DWORD *)lpvStatusInformation,dwStatusInformationLength);
403  break;
405  if(winetest_debug > 1)
406  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_RECEIVING_RESPONSE %p %d\n",
407  GetCurrentThreadId(), hInternet, dwContext,
408  lpvStatusInformation,dwStatusInformationLength);
409  break;
411  ok(dwStatusInformationLength == sizeof(DWORD),
412  "info length should be sizeof(DWORD) instead of %d\n",
413  dwStatusInformationLength);
414  if(winetest_debug > 1)
415  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_RESPONSE_RECEIVED 0x%x %d\n",
416  GetCurrentThreadId(), hInternet, dwContext,
417  *(DWORD *)lpvStatusInformation,dwStatusInformationLength);
418  break;
420  if(winetest_debug > 1)
421  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CTL_RESPONSE_RECEIVED %p %d\n",
422  GetCurrentThreadId(), hInternet,dwContext,
423  lpvStatusInformation,dwStatusInformationLength);
424  break;
426  if(winetest_debug > 1)
427  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_PREFETCH %p %d\n",
428  GetCurrentThreadId(), hInternet, dwContext,
429  lpvStatusInformation,dwStatusInformationLength);
430  break;
432  if(winetest_debug > 1)
433  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CLOSING_CONNECTION %p %d\n",
434  GetCurrentThreadId(), hInternet, dwContext,
435  lpvStatusInformation,dwStatusInformationLength);
436  break;
438  if(winetest_debug > 1)
439  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CONNECTION_CLOSED %p %d\n",
440  GetCurrentThreadId(), hInternet, dwContext,
441  lpvStatusInformation,dwStatusInformationLength);
442  break;
444  ok(dwStatusInformationLength == sizeof(HINTERNET),
445  "info length should be sizeof(HINTERNET) instead of %d\n",
446  dwStatusInformationLength);
447  if(winetest_debug > 1)
448  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_HANDLE_CREATED %p %d\n",
449  GetCurrentThreadId(), hInternet, dwContext,
450  *(HINTERNET *)lpvStatusInformation,dwStatusInformationLength);
453  break;
455  ok(dwStatusInformationLength == sizeof(HINTERNET),
456  "info length should be sizeof(HINTERNET) instead of %d\n",
457  dwStatusInformationLength);
458  if(winetest_debug > 1)
459  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_HANDLE_CLOSING %p %d\n",
460  GetCurrentThreadId(), hInternet, dwContext,
461  *(HINTERNET *)lpvStatusInformation, dwStatusInformationLength);
464  break;
466  {
467  INTERNET_ASYNC_RESULT *iar = (INTERNET_ASYNC_RESULT *)lpvStatusInformation;
468  ok(dwStatusInformationLength == sizeof(INTERNET_ASYNC_RESULT),
469  "info length should be sizeof(INTERNET_ASYNC_RESULT) instead of %d\n",
470  dwStatusInformationLength);
471  ok(iar->dwResult == 1 || iar->dwResult == 0, "iar->dwResult = %ld\n", iar->dwResult);
472  if(winetest_debug > 1)
473  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_REQUEST_COMPLETE {%ld,%d} %d\n",
474  GetCurrentThreadId(), hInternet, dwContext,
475  iar->dwResult,iar->dwError,dwStatusInformationLength);
476  req_error = iar->dwError;
477  if(!close_handle_cnt)
479  break;
480  }
482  if(winetest_debug > 1)
483  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_REDIRECT \"%s\" %d\n",
484  GetCurrentThreadId(), hInternet, dwContext,
485  (LPCSTR)lpvStatusInformation, dwStatusInformationLength);
486  *(LPSTR)lpvStatusInformation = '\0';
489  break;
491  if(winetest_debug > 1)
492  trace("%04x:Callback %p 0x%lx INTERNET_STATUS_INTERMEDIATE_RESPONSE %p %d\n",
493  GetCurrentThreadId(), hInternet, dwContext,
494  lpvStatusInformation, dwStatusInformationLength);
495  break;
496  default:
497  if(winetest_debug > 1)
498  trace("%04x:Callback %p 0x%lx %d %p %d\n",
499  GetCurrentThreadId(), hInternet, dwContext, dwInternetStatus,
500  lpvStatusInformation, dwStatusInformationLength);
501  }
502 }
#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:112
#define INTERNET_STATUS_RECEIVING_RESPONSE
Definition: wininet.h:889
const char * LPCSTR
Definition: xmlstorage.h:183
#define CHECK_EXPECT(status)
Definition: http.c:67
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:50
#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:113
#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
#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:89
static int close_handle_cnt
Definition: http.c:344
#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 6593 of file http.c.

6594 {
6596  struct context *ctx = (struct context *)context;
6597 
6598  if(winetest_debug > 1)
6599  trace("%p 0x%08lx %u %p 0x%08x\n", handle, context, status, info, size);
6600 
6601  switch(status) {
6603  trace("request handle: 0x%08lx\n", result->dwResult);
6604  ctx->req = (HINTERNET)result->dwResult;
6605  SetEvent(ctx->event);
6606  break;
6609 
6611  ok(type != INTERNET_HANDLE_TYPE_CONNECT_HTTP, "unexpected callback\n");
6612  SetEvent(ctx->event);
6613  break;
6614  }
6618  char *str = info;
6619  ok(str[0] && str[1], "Got string: %s\n", str);
6620  ok(size == strlen(str)+1, "unexpected size %u\n", size);
6621  }
6622  }
6623 }
LPVOID HINTERNET
Definition: winhttp.h:32
HINTERNET req
Definition: http.c:6590
#define INTERNET_STATUS_HANDLE_CLOSING
Definition: wininet.h:896
Definition: http.c:6587
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:6589
const WCHAR * str
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2609
#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 6724 of file http.c.

6725 {
6726  BOOL status_ok, function_ok;
6727  struct info *info = (struct info *)context;
6728  unsigned int i;
6729 
6731 
6732  if(info->is_aborted) {
6734  return;
6735  }
6736 
6738  {
6739  DWORD size = sizeof(struct info *);
6743 
6744  ok(buflen == sizeof(*ar), "unexpected buflen = %d\n", buflen);
6745  if(info->expect_result == ERROR_SUCCESS) {
6746  ok(ar->dwResult == 1, "ar->dwResult = %ld, expected 1\n", ar->dwResult);
6747  }else {
6748  ok(!ar->dwResult, "ar->dwResult = %ld, expected 1\n", ar->dwResult);
6749  ok(ar->dwError == info->expect_result, "ar->dwError = %d, expected %d\n", ar->dwError, info->expect_result);
6750  }
6751  }
6752 
6753  i = info->index;
6754  if (i >= info->count)
6755  {
6757  return;
6758  }
6759 
6760  while (info->test[i].status != status &&
6761  (info->test[i].optional || info->test[i].todo) &&
6762  i < info->count - 1 &&
6763  info->test[i].function == info->test[i + 1].function)
6764  {
6765  i++;
6766  }
6767 
6768  status_ok = (info->test[i].status == status);
6769  function_ok = (info->test[i].function == info->function);
6770 
6771  if (!info->test[i].todo)
6772  {
6773  ok( status_ok, "%u: expected status %u got %u\n", info->line, info->test[i].status, status );
6774  ok( function_ok, "%u: expected function %u got %u\n", info->line, info->test[i].function, info->function );
6775 
6776  if (info->test[i].async)
6777  ok(info->thread != GetCurrentThreadId(), "%u: expected thread %u got %u\n",
6779  }
6780  else
6781  {
6782  todo_wine ok( status_ok, "%u: expected status %u got %u\n", info->line, info->test[i].status, status );
6783  if (status_ok)
6784  todo_wine ok( function_ok, "%u: expected function %u got %u\n", info->line, info->test[i].function, info->function );
6785  }
6786  if (i == info->count - 1 || info->test[i].function != info->test[i + 1].function) SetEvent( info->wait );
6787  info->index = i+1;
6788 
6790 }
#define ERROR_SUCCESS
Definition: deptool.c:10
const struct notification * test
Definition: notification.c:63
Definition: http.c:6587
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:6719
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:6718
static CRITICAL_SECTION notification_cs
Definition: http.c:6722
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD_PTR dwResult
Definition: wininet.h:155
#define todo_wine
Definition: test.h:154
DWORD thread
Definition: http.c:6716
#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:3955
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 549 of file http.c.

550 {
551  BOOL res;
552 
553  close_handle_cnt = handle_cnt;
554 
557  ok(res, "InternetCloseHandle failed: %u\n", GetLastError());
560 }
#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:1437
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:112
#define CHECK_NOTIFIED2(status, num)
Definition: http.c:92
#define SET_EXPECT2(status, num)
Definition: http.c:47
#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:344

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_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 5119 of file http.c.

5120 {
5121  char c;
5123  recv(server_socket, &c, 1, 0);
5124 }
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
static int server_socket
Definition: http.c:2121
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:112

Referenced by _send_response_and_wait(), _send_response_ex_and_wait(), send_response_len_and_wait(), test_connection_break(), 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 7041 of file http.c.

7043 {
7044  DWORD len, type;
7045  BOOL res;
7046 
7047  if(winetest_debug > 1)
7048  trace("closetest_callback %p: %d\n", hInternet, dwInternetStatus);
7049 
7050  ok(hInternet == closetest_session || hInternet == closetest_conn || hInternet == closetest_req,
7051  "Unexpected hInternet %p\n", hInternet);
7052  if(!closetest_closed)
7053  return;
7054 
7055  len = sizeof(type);
7058  "InternetQueryOptionA(%p INTERNET_OPTION_HANDLE_TYPE) failed: %x %u, expected TRUE ERROR_INVALID_HANDLE\n",
7060 }
static HINTERNET closetest_session
Definition: http.c:7038
#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:7039
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:2609
#define INTERNET_OPTION_HANDLE_TYPE
Definition: wininet.h:710
#define trace
Definition: atltest.h:70
static HINTERNET closetest_conn
Definition: http.c:7038
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
static HINTERNET closetest_req
Definition: http.c:7038
#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 207 of file http.c.

208 {
214 }
#define CloseHandle
Definition: compat.h:398
static HANDLE complete_event
Definition: http.c:112
static HANDLE server_req_rec_event
Definition: http.c:112
static HANDLE conn_close_event
Definition: http.c:112
static HANDLE request_sent_event
Definition: http.c:112
static HANDLE conn_wait_event
Definition: http.c:112

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 7236 of file http.c.

7237 {
7238  BOOL ret;
7239  DWORD index, size;
7240  char buf[256];
7241 
7243  {
7244  ret = HttpAddRequestHeadersA( handle, "winetest: winetest", ~0u, HTTP_ADDREQ_FLAG_ADD );
7245  ok( ret, "HttpAddRequestHeadersA failed %u\n", GetLastError() );
7246  SetEvent( (HANDLE)ctx );
7247  }
7249  {
7250  index = 0;
7251  size = sizeof(buf);
7253  buf, &size, &index );
7254  ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
7255  ok( strstr( buf, "winetest: winetest" ) != NULL, "header missing\n" );
7256  SetEvent( (HANDLE)ctx );
7257  }
7258 }
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:1386
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:3955
Definition: ps.c:97

Referenced by test_concurrent_header_access().

◆ HttpHeaders_test()

static void HttpHeaders_test ( void  )
static

Definition at line 1699 of file http.c.

1700 {
1701  HINTERNET hSession;
1702  HINTERNET hConnect;
1703  HINTERNET hRequest;
1704  CHAR buffer[256];
1705  WCHAR wbuffer[256];
1706  DWORD len = 256;
1707  DWORD oldlen;
1708  DWORD index = 0;
1709  BOOL ret;
1710 
1711  hSession = InternetOpenA("Wine Regression Test",
1713  ok( hSession != NULL ,"Unable to open Internet session\n");
1714  hConnect = InternetConnectA(hSession, "test.winehq.org",
1716  0);
1717  ok( hConnect != NULL, "Unable to connect to http://test.winehq.org\n");
1718  hRequest = HttpOpenRequestA(hConnect, "POST", "/tests/post.php",
1720  if (!hRequest && GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED)
1721  {
1722  skip( "Network unreachable, skipping test\n" );
1723  goto done;
1724  }
1725  ok( hRequest != NULL, "Failed to open request handle\n");
1726 
1727  index = 0;
1728  len = sizeof(buffer);
1729  strcpy(buffer,"Warning");
1731  buffer,&len,&index)==0,"Warning hearder reported as Existing\n");
1732 
1733  ok(HttpAddRequestHeadersA(hRequest,"Warning:test1",-1,HTTP_ADDREQ_FLAG_ADD),
1734  "Failed to add new header\n");
1735 
1736  index = 0;
1737  len = sizeof(buffer);
1738  strcpy(buffer,"Warning");
1740  buffer,&len,&index),"Unable to query header\n");
1741  ok(index == 1, "Index was not incremented\n");
1742  ok(strcmp(buffer,"test1")==0, "incorrect string was returned(%s)\n",buffer);
1743  ok(len == 5, "Invalid length (exp. 5, got %d)\n", len);
1744  ok((len < sizeof(buffer)) && (buffer[len] == 0), "Buffer not NULL-terminated\n"); /* len show only 5 characters but the buffer is NULL-terminated*/
1745  len = sizeof(buffer);
1746  strcpy(buffer,"Warning");
1748  buffer,&len,&index)==0,"Second Index Should Not Exist\n");
1749 
1750  index = 0;
1751  len = 5; /* could store the string but not the NULL terminator */
1752  strcpy(buffer,"Warning");
1754  buffer,&len,&index) == FALSE,"Query succeeded on a too small buffer\n");
1755  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
1756  ok(index == 0, "Index was incremented\n");
1757  ok(strcmp(buffer,"Warning")==0, "incorrect string was returned(%s)\n",buffer); /* string not touched */
1758  ok(len == 6, "Invalid length (exp. 6, got %d)\n", len); /* unlike success, the length includes the NULL-terminator */
1759 
1760  /* a call with NULL will fail but will return the length */
1761  index = 0;
1762  len = sizeof(buffer);
1763  SetLastError(0xdeadbeef);
1765  NULL,&len,&index) == FALSE,"Query worked\n");
1766  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
1767  ok(len > 40, "Invalid length (exp. more than 40, got %d)\n", len);
1768  ok(index == 0, "Index was incremented\n");
1769 
1770  /* even for a len that is too small */
1771  index = 0;
1772  len = 15;
1773  SetLastError(0xdeadbeef);
1775  NULL,&len,&index) == FALSE,"Query worked\n");
1776  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
1777  ok(len > 40, "Invalid length (exp. more than 40, got %d)\n", len);
1778  ok(index == 0, "Index was incremented\n");
1779 
1780  index = 0;
1781  len = 0;
1782  SetLastError(0xdeadbeef);
1784  NULL,&len,&index) == FALSE,"Query worked\n");
1785  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
1786  ok(len > 40, "Invalid length (exp. more than 40, got %d)\n", len);
1787  ok(index == 0, "Index was incremented\n");
1788  oldlen = len; /* bytes; at least long enough to hold buffer & nul */
1789 
1790 
1791  /* a working query */
1792  index = 0;
1793  len = sizeof(buffer);
1794  memset(buffer, 'x', sizeof(buffer));
1796  buffer,&len,&index),"Unable to query header\n");
1797  ok(len + sizeof(CHAR) <= oldlen, "Result longer than advertised\n");
1798  ok((len < sizeof(buffer)-sizeof(CHAR)) && (buffer[len/sizeof(CHAR)] == 0),"No NUL at end\n");
1799  ok(len == strlen(buffer) * sizeof(CHAR), "Length wrong\n");
1800  /* what's in the middle differs between Wine and Windows so currently we check only the beginning and the end */
1801  ok(strncmp(buffer, "POST /tests/post.php HTTP/1", 25)==0, "Invalid beginning of headers string\n");
1802  ok(strcmp(buffer + strlen(buffer) - 4, "\r\n\r\n")==0, "Invalid end of headers string\n");
1803  ok(index == 0, "Index was incremented\n");
1804 
1805  /* Like above two tests, but for W version */
1806 
1807  index = 0;
1808  len = 0;
1809  SetLastError(0xdeadbeef);
1811  NULL,&len,&index) == FALSE,"Query worked\n");
1812  ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
1813  ok(len > 80, "Invalid length (exp. more than 80, got %d)\n", len);
1814  ok(index == 0, "Index was incremented\n");
1815  oldlen = len; /* bytes; at least long enough to hold buffer & nul */
1816 
1817  /* a working query */
1818  index = 0;
1819  len = sizeof(wbuffer);
1820  memset(wbuffer, 'x', sizeof(wbuffer));
1822  wbuffer,&len,&index),"Unable to query header\n");
1823  ok(len + sizeof(WCHAR) <= oldlen, "Result longer than advertised\n");
1824  ok(len == lstrlenW(wbuffer) * sizeof(WCHAR), "Length wrong\n");
1825  ok((len < sizeof(wbuffer)-sizeof(WCHAR)) && (wbuffer[len/sizeof(WCHAR)] == 0),"No NUL at end\n");
1826  ok(index == 0, "Index was incremented\n");
1827 
1828  /* end of W version tests */
1829 
1830  /* Without HTTP_QUERY_FLAG_REQUEST_HEADERS */
1831  index = 0;
1832  len = sizeof(buffer);
1833  memset(buffer, 'x', sizeof(buffer));
1835  buffer,&len,&index) == TRUE,"Query failed\n");
1836  ok(len == 2 || len == 4 /* win10 */, "Expected 2 or 4, got %d\n", len);
1837  ok(memcmp(buffer, "\r\n\r\n", len) == 0, "Expected CRLF, got '%s'\n", buffer);
1838  ok(index == 0, "Index was incremented\n");
1839 
1840  ok(HttpAddRequestHeadersA(hRequest,"Warning:test2",-1,HTTP_ADDREQ_FLAG_ADD),
1841  "Failed to add duplicate header using HTTP_ADDREQ_FLAG_ADD\n");
1842 
1843  index = 0;
1844  len = sizeof(buffer);
1845  strcpy(buffer,"Warning");
1847  buffer,&len,&index),"Unable to query header\n");
1848  ok(index == 1, "Index was not incremented\n");
1849  ok(strcmp(buffer,"test1")==0, "incorrect string was returned(%s)\n",buffer);
1850  len = sizeof(buffer);
1851  strcpy(buffer,"Warning");
1853  buffer,&len,&index),"Failed to get second header\n");
1854  ok(index == 2, "Index was not incremented\n");
1855  ok(strcmp(buffer,"test2")==0, "incorrect string was returned(%s)\n",buffer);
1856  len = sizeof(buffer);
1857  strcpy(buffer,"Warning");
1859  buffer,&len,&index)==0,"Third Header Should Not Exist\n");
1860 
1861  ok(HttpAddRequestHeadersA(hRequest,"Warning:test3",-1,HTTP_ADDREQ_FLAG_REPLACE), "Failed to replace header using HTTP_ADDREQ_FLAG_REPLACE\n");
1862 
1863  index = 0;
1864  len = sizeof(buffer);
1865  strcpy(buffer,"Warning");
1867  buffer,&len,&index),"Unable to query header\n");
1868  ok(index == 1, "Index was not incremented\n");
1869  ok(strcmp(buffer,"test2")==0, "incorrect string was returned(%s)\n",buffer);
1870  len = sizeof(buffer);
1871  strcpy(buffer,"Warning");
1873  buffer,&len,&index),"Failed to get second header\n");
1874  ok(index == 2, "Index was not incremented\n");
1875  ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
1876  len = sizeof(buffer);
1877  strcpy(buffer,"Warning");
1879  buffer,&len,&index)==0,"Third Header Should Not Exist\n");
1880 
1881  ok(HttpAddRequestHeadersA(hRequest,"Warning:test4",-1,HTTP_ADDREQ_FLAG_ADD_IF_NEW)==0, "HTTP_ADDREQ_FLAG_ADD_IF_NEW replaced existing header\n");
1882 
1883  index = 0;
1884  len = sizeof(buffer);
1885  strcpy(buffer,"Warning");
1887  buffer,&len,&index),"Unable to query header\n");
1888  ok(index == 1, "Index was not incremented\n");
1889  ok(strcmp(buffer,"test2")==0, "incorrect string was returned(%s)\n",buffer);
1890  len = sizeof(buffer);
1891  strcpy(buffer,"Warning");
1893  buffer,&len,&index),"Failed to get second header\n");
1894  ok(index == 2, "Index was not incremented\n");
1895  ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
1896  len = sizeof(buffer);
1897  strcpy(buffer,"Warning");
1899  buffer,&len,&index)==0,"Third Header Should Not Exist\n");
1900 
1901  ok(HttpAddRequestHeadersA(hRequest,"Warning:test4",-1, HTTP_ADDREQ_FLAG_COALESCE), "HTTP_ADDREQ_FLAG_COALESCE Did not work\n");
1902 
1903  index = 0;
1904  len = sizeof(buffer);
1905  strcpy(buffer,"Warning");
1907  buffer,&len,&index),"Unable to query header\n");
1908  ok(index == 1, "Index was not incremented\n");
1909  ok(strcmp(buffer,"test2, test4")==0, "incorrect string was returned(%s)\n", buffer);
1910  len = sizeof(buffer);
1911  strcpy(buffer,"Warning");
1912  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
1913  ok(index == 2, "Index was not incremented\n");
1914  ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
1915  len = sizeof(buffer);
1916  strcpy(buffer,"Warning");
1917  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
1918 
1919  ok(HttpAddRequestHeadersA(hRequest,"Warning:test5",-1, HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA), "HTTP_ADDREQ_FLAG_COALESCE Did not work\n");
1920 
1921  index = 0;
1922  len = sizeof(buffer);
1923  strcpy(buffer,"Warning");
1924  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
1925  ok(index == 1, "Index was not incremented\n");
1926  ok(strcmp(buffer,"test2, test4, test5")==0, "incorrect string was returned(%s)\n",buffer);
1927  len = sizeof(buffer);
1928  strcpy(buffer,"Warning");
1929  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
1930  ok(index == 2, "Index was not incremented\n");
1931  ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
1932  len = sizeof(buffer);
1933  strcpy(buffer,"Warning");
1934  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
1935 
1936  ok(HttpAddRequestHeadersA(hRequest,"Warning:test6",-1, HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON), "HTTP_ADDREQ_FLAG_COALESCE Did not work\n");
1937 
1938  index = 0;
1939  len = sizeof(buffer);
1940  strcpy(buffer,"Warning");
1941  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
1942  ok(index == 1, "Index was not incremented\n");
1943  ok(strcmp(buffer,"test2, test4, test5; test6")==0, "incorrect string was returned(%s)\n",buffer);
1944  len = sizeof(buffer);
1945  strcpy(buffer,"Warning");
1946  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
1947  ok(index == 2, "Index was not incremented\n");
1948  ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
1949  len = sizeof(buffer);
1950  strcpy(buffer,"Warning");
1951  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
1952 
1953  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");
1954 
1955  index = 0;
1956  len = sizeof(buffer);
1957  strcpy(buffer,"Warning");
1958  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
1959  ok(index == 1, "Index was not incremented\n");
1960  ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
1961  len = sizeof(buffer);
1962  strcpy(buffer,"Warning");
1963  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
1964  ok(index == 2, "Index was not incremented\n");
1965  ok(strcmp(buffer,"test7")==0, "incorrect string was returned(%s)\n",buffer);
1966  len = sizeof(buffer);
1967  strcpy(buffer,"Warning");
1968  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
1969 
1970  /* Ensure that blank headers are ignored and don't cause a failure */
1971  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");
1972 
1973  index = 0;
1974  len = sizeof(buffer);
1975  strcpy(buffer,"BlankTest");
1976  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
1977  ok(index == 1, "Index was not incremented\n");
1978  ok(strcmp(buffer,"value")==0, "incorrect string was returned(%s)\n",buffer);
1979 
1980  /* Ensure that malformed header separators are ignored and don't cause a failure */
1981  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),
1982  "Failed to add header with malformed entries in list\n");
1983 
1984  index = 0;
1985  len = sizeof(buffer);
1986  strcpy(buffer,"MalformedTest");
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  index = 0;
1991  len = sizeof(buffer);
1992  strcpy(buffer,"MalformedTestTwo");
1993  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
1994  ok(index == 1, "Index was not incremented\n");
1995  ok(strcmp(buffer,"value2")==0, "incorrect string was returned(%s)\n",buffer);
1996  index = 0;
1997  len = sizeof(buffer);
1998  strcpy(buffer,"MalformedTestThree");
1999  ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
2000  ok(index == 1, "Index was not incremented\n");
2001  ok(strcmp(buffer,"value3")==0, "incorrect string was returned(%s)\n",buffer);
2002 
2003  ret = HttpAddRequestHeadersA(hRequest, "Authorization: Basic\r\n", -1, HTTP_ADDREQ_FLAG_ADD);
2004  ok(ret, "unable to add header %u\n", GetLastError());
2005 
2006  index = 0;
2007  buffer[0] = 0;
2008  len = sizeof(buffer);
2010  ok(ret, "unable to query header %u\n", GetLastError());
2011  ok(index == 1, "index was not incremented\n");
2012  ok(!strcmp(buffer, "Basic"), "incorrect string was returned (%s)\n", buffer);
2013 
2014  ret = HttpAddRequestHeadersA(hRequest, "Authorization:\r\n", -1, HTTP_ADDREQ_FLAG_REPLACE);
2015  ok(ret, "unable to remove header %u\n", GetLastError());
2016 
2017  index = 0;
2018  len = sizeof(buffer);
2019  SetLastError(0xdeadbeef);
2021  "header still present\n");
2023 
2024  ok(InternetCloseHandle(hRequest), "Close request handle failed\n");
2025 done:
2026  ok(InternetCloseHandle(hConnect), "Close connect handle failed\n");
2027  ok(InternetCloseHandle(hSession), "Close session handle failed\n");
2028 }
#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:1344
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1437
#define HTTP_ADDREQ_FLAG_ADD_IF_NEW
Definition: wininet.h:1706
#define lstrlenW
Definition: compat.h:407
#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:1080
#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:1386
__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:2057
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_INTERNET_NAME_NOT_RESOLVED
Definition: wininet.h:1996
#define SetLastError(x)
Definition: compat.h:409
int ret
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:3807
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:1467
#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:3955
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by START_TEST().

◆ HttpSendRequestEx_test()

static void HttpSendRequestEx_test ( void  )
static

Definition at line 1286 of file http.c.

1287 {
1288  HINTERNET hSession;
1289  HINTERNET hConnect;
1290  HINTERNET hRequest;
1291 
1292  INTERNET_BUFFERSA BufferIn;
1293  DWORD dwBytesWritten, dwBytesRead, error;
1294  CHAR szBuffer[256];
1295  int i;
1296  BOOL ret;
1297 
1298  static char szPostData[] = "mode=Test";
1299  static const char szContentType[] = "Content-Type: application/x-www-form-urlencoded";
1300 
1301  hSession = InternetOpenA("Wine Regression Test",
1303  ok( hSession != NULL ,"Unable to open Internet session\n");
1304  hConnect = InternetConnectA(hSession, "test.winehq.org",
1306  0);
1307  ok( hConnect != NULL, "Unable to connect to http://test.winehq.org\n");
1308  hRequest = HttpOpenRequestA(hConnect, "POST", "/tests/post.php",
1310  if (!hRequest && GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED)
1311  {
1312  skip( "Network unreachable, skipping test\n" );
1313  goto done;
1314  }
1315  ok( hRequest != NULL, "Failed to open request handle err %u\n", GetLastError());
1316 
1318 
1319  BufferIn.dwStructSize = sizeof(BufferIn);
1320  BufferIn.Next = (INTERNET_BUFFERSA*)0xdeadcab;
1321  BufferIn.lpcszHeader = szContentType;
1322  BufferIn.dwHeadersLength = sizeof(szContentType)-1;
1323  BufferIn.dwHeadersTotal = sizeof(szContentType)-1;
1324  BufferIn.lpvBuffer = szPostData;
1325  BufferIn.dwBufferLength = 3;
1326  BufferIn.dwBufferTotal = sizeof(szPostData)-1;
1327  BufferIn.dwOffsetLow = 0;
1328  BufferIn.dwOffsetHigh = 0;
1329 
1330  SetLastError(0xdeadbeef);
1331  ret = HttpSendRequestExA(hRequest, &BufferIn, NULL, 0 ,0);
1332  error = GetLastError();
1333  ok(ret, "HttpSendRequestEx Failed with error %u\n", error);
1334  ok(error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", error);
1335 
1337 
1338  for (i = 3; szPostData[i]; i++)
1339  ok(InternetWriteFile(hRequest, &szPostData[i], 1, &dwBytesWritten),
1340  "InternetWriteFile failed\n");
1341 
1343 
1344  ok(HttpEndRequestA(hRequest, NULL, 0, 0), "HttpEndRequest Failed\n");
1345 
1346  test_request_flags(hRequest, 0);
1347 
1348  ok(InternetReadFile(hRequest, szBuffer, 255, &dwBytesRead),
1349  "Unable to read response\n");
1350  szBuffer[dwBytesRead] = 0;
1351 
1352  ok(dwBytesRead == 13,"Read %u bytes instead of 13\n",dwBytesRead);
1353  ok(strncmp(szBuffer,"mode => Test\n",dwBytesRead)==0 || broken(proxy_active()),"Got string %s\n",szBuffer);
1354 
1355  ok(InternetCloseHandle(hRequest), "Close request handle failed\n");
1356 done:
1357  ok(InternetCloseHandle(hConnect), "Close connect handle failed\n");
1358  ok(InternetCloseHandle(hSession), "Close session handle failed\n");
1359 }
#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:1344
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1437
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:1080
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:179
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define test_request_flags(a, b)
Definition: http.c:299
BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer, DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
Definition: internet.c:2135
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:409
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:2175
#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:5415
HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession, LPCSTR lpszVerb, LPCSTR lpszObjectName, LPCSTR lpszVersion, LPCSTR lpszReferrer, LPCSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:1467
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:5319
#define INTERNET_SERVICE_HTTP
Definition: wininet.h:562

Referenced by START_TEST().

◆ init_events()

static void init_events ( void  )
static

Definition at line 198 of file http.c.

199 {
205 }
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:112
smooth NULL
Definition: ftsmooth.c:416
static HANDLE server_req_rec_event
Definition: http.c:112
static HANDLE conn_close_event
Definition: http.c:112
static HANDLE request_sent_event
Definition: http.c:112
static HANDLE conn_wait_event
Definition: http.c:112

Referenced by START_TEST().

◆ init_status_tests()

static void init_status_tests ( void  )
static

Definition at line 7198 of file http.c.

7199 {
7200  memset(expect, 0, sizeof(expect));
7201  memset(optional, 0, sizeof(optional));
7202  memset(wine_allow, 0, sizeof(wine_allow));
7203  memset(notified, 0, sizeof(notified));
7204  memset(status_string, 0, sizeof(status_string));
7205 
7206 #define STATUS_STRING(status) status_string[status] = #status
7233 #undef STATUS_STRING
7234 }
#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:108
#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:110
#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:108
#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:108
#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:108
#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 1646 of file http.c.

1647 {
1648  char file_name[MAX_PATH];
1649  test_request_t req;
1650  HANDLE lock, lock2;
1651  DWORD size;
1652  BOOL ret;
1653 
1654  open_simple_request(&req, "test.winehq.org", INTERNET_DEFAULT_HTTP_PORT, NULL, "/tests/hello.html");
1655 
1656  size = sizeof(file_name);
1658  ok(!ret, "InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) succeeded\n");
1659  ok(GetLastError() == ERROR_INTERNET_ITEM_NOT_FOUND, "GetLastError()=%u\n", GetLastError());
1660  ok(!size, "size = %d\n", size);
1661 
1662  lock = NULL;
1664  ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError());
1665 
1666  ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
1667  ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
1668 
1669  size = sizeof(file_name);
1671  ok(ret, "InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) failed: %u\n", GetLastError());
1672 
1674  ok(ret, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError());
1675  ok(lock != NULL, "lock == NULL\n");
1676 
1677  ret = InternetLockRequestFile(req.request, &lock2);
1678  ok(ret, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError());
1679  ok(lock == lock2, "lock != lock2\n");
1680 
1681  ret = InternetUnlockRequestFile(lock2);
1682  ok(ret, "InternetUnlockRequestFile failed: %u\n", GetLastError());
1683 
1685  ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%u)\n", ret, GetLastError());
1686 
1687  ok(InternetCloseHandle(req.request), "Close request handle failed\n");
1688 
1690  ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%u)\n", ret, GetLastError());
1691 
1693  ok(ret, "InternetUnlockRequestFile failed: %u\n", GetLastError());
1694 
1696  ok(ret, "Deleting file returned %x(%u)\n", ret, GetLastError());
1697 }
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:1437
BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
Definition: http.c:5647
#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:2609
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
HINTERNET request
Definition: http.c:507
BOOL WINAPI InternetLockRequestFile(HINTERNET hInternet, HANDLE *lphLockReqHandle)
Definition: internet.c:3918
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:510
#define ERROR_SHARING_VIOLATION
Definition: winerror.h:135
BOOL WINAPI InternetUnlockRequestFile(HANDLE hLockHandle)
Definition: internet.c:3947
#define ok(value,...)
Definition: atltest.h:57
static LPCWSTR file_name
Definition: protocol.c:146
#define INTERNET_OPTION_DATAFILE_NAME
Definition: wininet.h:727

Referenced by START_TEST().

◆ InternetOpenRequest_test()

static void InternetOpenRequest_test ( void  )
static

Definition at line 1361 of file http.c.

1362 {
1363  HINTERNET session, connect, request;
1364  static const char *types[] = { "*", "", NULL };
1365  static const WCHAR slash[] = {'/', 0}, any[] = {'*', 0}, empty[] = {0};
1366  static const WCHAR *typesW[] = { any, empty, NULL };
1367  BOOL ret;
1368 
1369  session = InternetOpenA("Wine Regression Test", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
1370  ok(session != NULL ,"Unable to open Internet session\n");
1371 
1373  INTERNET_SERVICE_HTTP, 0, 0);
1374  ok(connect == NULL, "InternetConnectA should have failed\n");
1375  ok(GetLastError() == ERROR_INVALID_PARAMETER, "InternetConnectA with NULL server named should have failed with ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
1376 
1378  INTERNET_SERVICE_HTTP, 0, 0);
1379  ok(connect == NULL, "InternetConnectA should have failed\n");
1380  ok(GetLastError() == ERROR_INVALID_PARAMETER, "InternetConnectA with blank server named should have failed with ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
1381 
1382  connect = InternetConnectA(session, "test.winehq.org", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL,
1383  INTERNET_SERVICE_HTTP, 0, 0);
1384  ok(connect != NULL, "Unable to connect to http://test.winehq.org with error %d\n", GetLastError());
1385 
1388  {
1389  skip( "Network unreachable, skipping test\n" );
1390  goto done;
1391  }
1392  ok(request != NULL, "Failed to open request handle err %u\n", GetLastError());
1393 
1394  ret = HttpSendRequestW(request, NULL, 0, NULL, 0);
1395  ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
1396  ok(InternetCloseHandle(request), "Close request handle failed\n");
1397 
1399  ok(request != NULL, "Failed to open request handle err %u\n", GetLastError());
1400 
1401  ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
1402  ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
1403  ok(InternetCloseHandle(request), "Close request handle failed\n");
1404 
1405 done:
1406  ok(InternetCloseHandle(connect), "Close connect handle failed\n");
1407  ok(InternetCloseHandle(session), "Close session handle failed\n");
1408 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define INTERNET_FLAG_NO_CACHE_WRITE
Definition: wininet.h:66
static const WCHAR empty[]
Definition: main.c:49
HINTERNET WINAPI InternetConnectA(HINTERNET hInternet, LPCSTR lpszServerName, INTERNET_PORT nServerPort, LPCSTR lpszUserName, LPCSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:1344
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1437
BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
Definition: http.c:5647
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:1080
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:5565
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:1467
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:3419
#define INTERNET_SERVICE_HTTP
Definition: wininet.h:562

Referenced by START_TEST().

◆ InternetOpenUrlA_test()

static void InternetOpenUrlA_test ( void  )
static

Definition at line 1249 of file http.c.

1250 {
1251  HINTERNET myhinternet, myhttp;
1252  char buffer[0x400];
1253  DWORD size, readbytes, totalbytes=0;
1254  BOOL ret;
1255 
1258  "DeleteUrlCacheEntry returned %x, GetLastError() = %d\n", ret, GetLastError());
1259 
1260  myhinternet = InternetOpenA("Winetest",0,NULL,NULL,INTERNET_FLAG_NO_CACHE_WRITE);
1261  ok((myhinternet != 0), "InternetOpen failed, error %u\n",GetLastError());
1262  size = 0x400;
1264  ok( ret, "InternetCanonicalizeUrl failed, error %u\n",GetLastError());
1265 
1266  SetLastError(0);
1267  myhttp = InternetOpenUrlA(myhinternet, TEST_URL, 0, 0,
1270  return; /* WinXP returns this when not connected to the net */
1271  ok((myhttp != 0),"InternetOpenUrl failed, error %u\n",GetLastError());
1272  ret = InternetReadFile(myhttp, buffer,0x400,&readbytes);
1273  ok( ret, "InternetReadFile failed, error %u\n",GetLastError());
1274  totalbytes += readbytes;
1275  while (readbytes && InternetReadFile(myhttp, buffer,0x400,&readbytes))
1276  totalbytes += readbytes;
1277  trace("read 0x%08x bytes\n",totalbytes);
1278 
1279  InternetCloseHandle(myhttp);
1280  InternetCloseHandle(myhinternet);
1281 
1283  ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, "INTERNET_FLAG_NO_CACHE_WRITE flag doesn't work\n");
1284 }
#define INTERNET_FLAG_NO_CACHE_WRITE
Definition: wininet.h:66
BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName)
Definition: urlcache.c:3309
#define INTERNET_FLAG_TRANSFER_BINARY
Definition: wininet.h:91
BOOL WINAPI InternetCanonicalizeUrlA(LPCSTR lpszUrl, LPSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
Definition: internet.c:2001
#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:1437
HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType, LPCSTR lpszProxy, LPCSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1080
#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:41
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_INTERNET_NAME_NOT_RESOLVED
Definition: wininet.h:1996
#define SetLastError(x)
Definition: compat.h:409
int ret
HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl, LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3665
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
Definition: internet.c:2175
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ InternetReadFile_chunked_test()

static void InternetReadFile_chunked_test ( void  )
static

Definition at line 901 of file http.c.

902 {
903  BOOL res;
904  CHAR buffer[4000];
905  DWORD length, got;
906  const char *types[2] = { "*", NULL };
907  HINTERNET hi, hic = 0, hor = 0;
908 
909  trace("Starting InternetReadFile chunked test\n");
910 
911  trace("InternetOpenA <--\n");
913  ok((hi != 0x0),"InternetOpen failed with error %u\n", GetLastError());
914  trace("InternetOpenA -->\n");
915 
916  if (hi == 0x0) goto abort;
917 
918  trace("InternetConnectA <--\n");
919  hic=InternetConnectA(hi, "test.winehq.org", INTERNET_INVALID_PORT_NUMBER,
920  NULL, NULL, INTERNET_SERVICE_HTTP, 0x0, 0xdeadbeef);
921  ok((hic != 0x0),"InternetConnect failed with error %u\n", GetLastError());
922  trace("InternetConnectA -->\n");
923 
924  if (hic == 0x0) goto abort;
925 
926  trace("HttpOpenRequestA <--\n");
927  hor = HttpOpenRequestA(hic, "GET", "/tests/chunked", NULL, NULL, types,
929  0xdeadbead);
930  if (hor == 0x0 && GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED) {
931  /*
932  * If the internet name can't be resolved we are probably behind
933  * a firewall or in some other way not directly connected to the
934  * Internet. Not enough reason to fail the test. Just ignore and
935  * abort.
936  */
937  } else {
938  ok((hor != 0x0),"HttpOpenRequest failed with error %u\n", GetLastError());
939  }
940  trace("HttpOpenRequestA -->\n");
941 
942  if (hor == 0x0) goto abort;
943 
944  trace("HttpSendRequestA -->\n");
945  SetLastError(0xdeadbeef);
946  res = HttpSendRequestA(hor, "", -1, NULL, 0);
948  "Synchronous HttpSendRequest returning 0, error %u\n", GetLastError());
949  trace("HttpSendRequestA <--\n");
950 
951  test_request_flags(hor, 0);
952 
953  length = 100;
955  buffer[length]=0;
956  trace("Option CONTENT_TYPE -> %i %s\n",res,buffer);
957 
958  SetLastError( 0xdeadbeef );
959  length = 100;
961  buffer[length]=0;
962  trace("Option TRANSFER_ENCODING -> %i %s\n",res,buffer);
964  "Failed to get TRANSFER_ENCODING option, error %u\n", GetLastError() );
965  ok( !strcmp( buffer, "chunked" ) || ( ! res && proxy_active() && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND ),
966  "Wrong transfer encoding '%s'\n", buffer );
967 
968  SetLastError( 0xdeadbeef );
969  length = 16;
971  ok( !res, "Found CONTENT_LENGTH option '%s'\n", buffer );
972  ok( GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "Wrong error %u\n", GetLastError() );
973 
974  length = 100;
975  trace("Entering Query loop\n");
976 
977  while (TRUE)
978  {
980  ok(!(!res && length != 0),"InternetQueryDataAvailable failed with non-zero length\n");
981  ok(res, "InternetQueryDataAvailable failed, error %d\n", GetLastError());
982  trace("got %u available\n",length);
983  if (length)
984  {
985  char *buffer = HeapAlloc(GetProcessHeap(),0,length+1);
986 
987  res = InternetReadFile(hor,buffer,length,&got);
988 
989  buffer[got]=0;
990  trace("ReadFile -> %i %i\n",res,got);
991  ok( length == got, "only got %u of %u available\n", got, length );
992  ok( buffer[got-1] == '\n', "received partial line '%s'\n", buffer );
993 
995  if (!got) break;
996  }
997  if (length == 0)
998  {
999  got = 0xdeadbeef;
1000  res = InternetReadFile( hor, buffer, 1, &got );
1001  ok( res, "InternetReadFile failed: %u\n", GetLastError() );
1002  ok( !got, "got %u\n", got );
1003  break;
1004  }
1005  }
1006 abort:
1007  trace("aborting\n");
1008  if (hor != 0x0) {
1009  res = InternetCloseHandle(hor);
1010  ok (res, "InternetCloseHandle of handle opened by HttpOpenRequestA failed\n");
1011  }
1012  if (hi != 0x0) {
1013  res = InternetCloseHandle(hi);
1014  ok (res, "InternetCloseHandle of handle opened by InternetOpenA failed\n");
1015  }
1016 }
#define HTTP_QUERY_CONTENT_LENGTH
Definition: wininet.h:1528
#define HTTP_QUERY_CONTENT_TYPE
Definition: wininet.h:1524
#define TRUE
Definition: types.h:120
GLint x0
Definition: linetemp.h:95
char CHAR
Definition: xmlstorage.h:175
#define INTERNET_FLAG_RELOAD
Definition: wininet.h:61
HINTERNET WINAPI InternetConnectA(HINTERNET hInternet, LPCSTR lpszServerName, INTERNET_PORT nServerPort, LPCSTR lpszUserName, LPCSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:1344
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1437
BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
Definition: http.c:5647
#define INTERNET_INVALID_PORT_NUMBER
Definition: wininet.h:36
HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType, LPCSTR lpszProxy, LPCSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1080
static BOOL proxy_active(void)
Definition: http.c:179
unsigned int BOOL
Definition: ntddk_ex.h:94
#define HTTP_QUERY_TRANSFER_ENCODING
Definition: wininet.h:1586
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI InternetQueryDataAvailable(HINTERNET hFile, LPDWORD lpdwNumberOfBytesAvailable, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3845
#define test_request_flags(a, b)
Definition: http.c:299
#define GetProcessHeap()
Definition: compat.h:395
#define trace
Definition: atltest.h:70
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
Definition: cmds.c:130
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define ERROR_HTTP_HEADER_NOT_FOUND
Definition: wininet.h:2057
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_INTERNET_NAME_NOT_RESOLVED
Definition: wininet.h:1996
#define SetLastError(x)
Definition: compat.h:409
#define INTERNET_OPEN_TYPE_PRECONFIG
Definition: wininet.h:521
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
Definition: internet.c:2175
#define ok(value,...)
Definition: atltest.h:57
#define abort()
Definition: i386-dis.c:35
HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession, LPCSTR lpszVerb, LPCSTR lpszObjectN