Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1697eb6e
Commit
1697eb6e
authored
Jul 30, 2014
by
Bruno Jesus
Committed by
Alexandre Julliard
Jul 30, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp/tests: Add a no-content header test.
parent
c3d7f5b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
0 deletions
+87
-0
winhttp.c
dlls/winhttp/tests/winhttp.c
+87
-0
No files found.
dlls/winhttp/tests/winhttp.c
View file @
1697eb6e
...
@@ -1767,6 +1767,11 @@ static const char okmsg[] =
...
@@ -1767,6 +1767,11 @@ static const char okmsg[] =
"Server: winetest
\r\n
"
"Server: winetest
\r\n
"
"
\r\n
"
;
"
\r\n
"
;
static
const
char
nocontentmsg
[]
=
"HTTP/1.1 204 No Content
\r\n
"
"Server: winetest
\r\n
"
"
\r\n
"
;
static
const
char
noauthmsg
[]
=
static
const
char
noauthmsg
[]
=
"HTTP/1.1 401 Unauthorized
\r\n
"
"HTTP/1.1 401 Unauthorized
\r\n
"
"Server: winetest
\r\n
"
"Server: winetest
\r\n
"
...
@@ -1850,6 +1855,10 @@ static DWORD CALLBACK server_thread(LPVOID param)
...
@@ -1850,6 +1855,10 @@ static DWORD CALLBACK server_thread(LPVOID param)
{
{
send
(
c
,
page1
,
sizeof
page1
-
1
,
0
);
send
(
c
,
page1
,
sizeof
page1
-
1
,
0
);
}
}
if
(
strstr
(
buffer
,
"GET /no_content"
))
{
send
(
c
,
nocontentmsg
,
sizeof
nocontentmsg
-
1
,
0
);
}
if
(
strstr
(
buffer
,
"GET /quit"
))
if
(
strstr
(
buffer
,
"GET /quit"
))
{
{
send
(
c
,
okmsg
,
sizeof
okmsg
-
1
,
0
);
send
(
c
,
okmsg
,
sizeof
okmsg
-
1
,
0
);
...
@@ -2087,6 +2096,83 @@ static void test_no_headers(int port)
...
@@ -2087,6 +2096,83 @@ static void test_no_headers(int port)
WinHttpCloseHandle
(
ses
);
WinHttpCloseHandle
(
ses
);
}
}
static
void
test_no_content
(
int
port
)
{
static
const
WCHAR
no_contentW
[]
=
{
'/'
,
'n'
,
'o'
,
'_'
,
'c'
,
'o'
,
'n'
,
't'
,
'e'
,
'n'
,
't'
,
0
};
HINTERNET
ses
,
con
,
req
;
WCHAR
buf
[
128
];
DWORD
size
,
len
=
sizeof
(
buf
),
bytes_read
,
status
;
BOOL
ret
;
ses
=
WinHttpOpen
(
test_useragent
,
0
,
NULL
,
NULL
,
0
);
ok
(
ses
!=
NULL
,
"failed to open session %u
\n
"
,
GetLastError
());
con
=
WinHttpConnect
(
ses
,
localhostW
,
port
,
0
);
ok
(
con
!=
NULL
,
"failed to open a connection %u
\n
"
,
GetLastError
());
req
=
WinHttpOpenRequest
(
con
,
NULL
,
no_contentW
,
NULL
,
NULL
,
NULL
,
0
);
ok
(
req
!=
NULL
,
"failed to open a request %u
\n
"
,
GetLastError
());
size
=
12345
;
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpQueryDataAvailable
(
req
,
&
size
);
todo_wine
{
ok
(
!
ret
,
"expected error
\n
"
);
ok
(
GetLastError
()
==
ERROR_WINHTTP_INCORRECT_HANDLE_STATE
,
"expected ERROR_WINHTTP_INCORRECT_HANDLE_STATE, got 0x%08x
\n
"
,
GetLastError
());
ok
(
size
==
12345
||
broken
(
size
==
0
)
/* Win <= 2003 */
,
"expected 12345, got %u
\n
"
,
size
);
}
ret
=
WinHttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
,
0
,
0
);
ok
(
ret
,
"expected success
\n
"
);
ret
=
WinHttpReceiveResponse
(
req
,
NULL
);
ok
(
ret
,
"expected success
\n
"
);
size
=
sizeof
(
status
);
ret
=
WinHttpQueryHeaders
(
req
,
WINHTTP_QUERY_STATUS_CODE
|
WINHTTP_QUERY_FLAG_NUMBER
,
NULL
,
&
status
,
&
size
,
NULL
);
ok
(
ret
,
"expected success
\n
"
);
ok
(
status
==
204
,
"expected status 204, got %d
\n
"
,
status
);
SetLastError
(
0xdeadbeef
);
size
=
sizeof
(
status
);
status
=
12345
;
ret
=
WinHttpQueryHeaders
(
req
,
WINHTTP_QUERY_CONTENT_LENGTH
|
WINHTTP_QUERY_FLAG_NUMBER
,
NULL
,
&
status
,
&
size
,
0
);
ok
(
!
ret
,
"expected no content-length header
\n
"
);
ok
(
GetLastError
()
==
ERROR_WINHTTP_HEADER_NOT_FOUND
,
"wrong error %u
\n
"
,
GetLastError
()
);
ok
(
status
==
12345
,
"expected 0, got %d
\n
"
,
status
);
size
=
12345
;
ret
=
WinHttpQueryDataAvailable
(
req
,
&
size
);
ok
(
ret
,
"expected success
\n
"
);
ok
(
size
==
0
,
"expected 0, got %d
\n
"
,
size
);
ret
=
WinHttpReadData
(
req
,
buf
,
len
,
&
bytes_read
);
ok
(
bytes_read
==
0
,
"expected 0, got %u available
\n
"
,
bytes_read
);
size
=
12345
;
ret
=
WinHttpQueryDataAvailable
(
req
,
&
size
);
ok
(
ret
,
"expected success
\n
"
);
ok
(
size
==
0
,
"expected 0, got %d
\n
"
,
size
);
WinHttpCloseHandle
(
req
);
size
=
12345
;
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpQueryDataAvailable
(
req
,
&
size
);
ok
(
!
ret
,
"expected error
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"expected ERROR_INVALID_HANDLE, got 0x%08x
\n
"
,
GetLastError
());
ok
(
size
==
12345
,
"expected 12345, got %u
\n
"
,
size
);
WinHttpCloseHandle
(
con
);
WinHttpCloseHandle
(
ses
);
}
static
void
test_bad_header
(
int
port
)
static
void
test_bad_header
(
int
port
)
{
{
static
const
WCHAR
bad_headerW
[]
=
static
const
WCHAR
bad_headerW
[]
=
...
@@ -3078,6 +3164,7 @@ START_TEST (winhttp)
...
@@ -3078,6 +3164,7 @@ START_TEST (winhttp)
test_connection_info
(
si
.
port
);
test_connection_info
(
si
.
port
);
test_basic_request
(
si
.
port
,
NULL
,
basicW
);
test_basic_request
(
si
.
port
,
NULL
,
basicW
);
test_no_headers
(
si
.
port
);
test_no_headers
(
si
.
port
);
test_no_content
(
si
.
port
);
test_basic_authentication
(
si
.
port
);
test_basic_authentication
(
si
.
port
);
test_bad_header
(
si
.
port
);
test_bad_header
(
si
.
port
);
test_multiple_reads
(
si
.
port
);
test_multiple_reads
(
si
.
port
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment