Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
383b7094
Commit
383b7094
authored
May 15, 2015
by
Michael Müller
Committed by
Vitaly Lipatov
Jul 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet/tests: Add more tests for cookies.
parent
96dccad3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
3 deletions
+89
-3
http.c
dlls/wininet/tests/http.c
+89
-3
No files found.
dlls/wininet/tests/http.c
View file @
383b7094
...
@@ -2131,6 +2131,14 @@ static const char largemsg[] =
...
@@ -2131,6 +2131,14 @@ static const char largemsg[] =
"Content-Length: %I64u
\r\n
"
"Content-Length: %I64u
\r\n
"
"
\r\n
"
;
"
\r\n
"
;
static
const
char
okmsg_cookie_path
[]
=
"HTTP/1.1 200 OK
\r\n
"
"Date: Mon, 01 Dec 2008 13:44:34 GMT
\r\n
"
"Server: winetest
\r\n
"
"Content-Length: 0
\r\n
"
"Set-Cookie: subcookie2=data; path=/test_cookie_set_path
\r\n
"
"
\r\n
"
;
static
const
char
notokmsg
[]
=
static
const
char
notokmsg
[]
=
"HTTP/1.1 400 Bad Request
\r\n
"
"HTTP/1.1 400 Bad Request
\r\n
"
"Server: winetest
\r\n
"
"Server: winetest
\r\n
"
...
@@ -2550,6 +2558,32 @@ static DWORD CALLBACK server_thread(LPVOID param)
...
@@ -2550,6 +2558,32 @@ static DWORD CALLBACK server_thread(LPVOID param)
else
else
send
(
c
,
noauthmsg
,
sizeof
noauthmsg
-
1
,
0
);
send
(
c
,
noauthmsg
,
sizeof
noauthmsg
-
1
,
0
);
}
}
if
(
strstr
(
buffer
,
"/test_cookie_path1"
))
{
if
(
strstr
(
buffer
,
"subcookie=data"
))
send
(
c
,
okmsg
,
sizeof
okmsg
-
1
,
0
);
else
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
}
if
(
strstr
(
buffer
,
"/test_cookie_path2"
))
{
if
(
strstr
(
buffer
,
"subcookie2=data"
))
send
(
c
,
okmsg
,
sizeof
okmsg
-
1
,
0
);
else
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
}
if
(
strstr
(
buffer
,
"/test_cookie_set_path"
))
{
send
(
c
,
okmsg_cookie_path
,
sizeof
okmsg_cookie_path
-
1
,
0
);
}
if
(
strstr
(
buffer
,
"/test_cookie_merge"
))
{
if
(
strstr
(
buffer
,
"subcookie=data"
)
&&
!
strstr
(
buffer
,
"manual_cookie=test"
))
send
(
c
,
okmsg
,
sizeof
okmsg
-
1
,
0
);
else
send
(
c
,
notokmsg
,
sizeof
notokmsg
-
1
,
0
);
}
if
(
strstr
(
buffer
,
"/test_host_override"
))
if
(
strstr
(
buffer
,
"/test_host_override"
))
{
{
if
(
strstr
(
buffer
,
host_header_override
))
if
(
strstr
(
buffer
,
host_header_override
))
...
@@ -4063,7 +4097,7 @@ static void test_cookie_header(int port)
...
@@ -4063,7 +4097,7 @@ static void test_cookie_header(int port)
HINTERNET
ses
,
con
,
req
;
HINTERNET
ses
,
con
,
req
;
DWORD
size
,
error
;
DWORD
size
,
error
;
BOOL
ret
;
BOOL
ret
;
char
buffer
[
64
];
char
buffer
[
256
];
ses
=
InternetOpenA
(
"winetest"
,
INTERNET_OPEN_TYPE_DIRECT
,
NULL
,
NULL
,
0
);
ses
=
InternetOpenA
(
"winetest"
,
INTERNET_OPEN_TYPE_DIRECT
,
NULL
,
NULL
,
0
);
ok
(
ses
!=
NULL
,
"InternetOpen failed
\n
"
);
ok
(
ses
!=
NULL
,
"InternetOpen failed
\n
"
);
...
@@ -4091,7 +4125,7 @@ static void test_cookie_header(int port)
...
@@ -4091,7 +4125,7 @@ static void test_cookie_header(int port)
size
=
sizeof
(
buffer
);
size
=
sizeof
(
buffer
);
ret
=
HttpQueryInfoA
(
req
,
HTTP_QUERY_COOKIE
|
HTTP_QUERY_FLAG_REQUEST_HEADERS
,
buffer
,
&
size
,
NULL
);
ret
=
HttpQueryInfoA
(
req
,
HTTP_QUERY_COOKIE
|
HTTP_QUERY_FLAG_REQUEST_HEADERS
,
buffer
,
&
size
,
NULL
);
ok
(
ret
,
"HttpQueryInfo failed: %lu
\n
"
,
GetLastError
());
ok
(
ret
,
"HttpQueryInfo failed: %lu
\n
"
,
GetLastError
());
ok
(
!
strcmp
(
buffer
,
"cookie=not biscuit"
),
"got '%s' expected
\'
cookie=not biscuit
\'\n
"
,
buffer
);
ok
(
!
!
strstr
(
buffer
,
"cookie=not biscuit"
),
"got '%s' expected
\'
cookie=not biscuit
\'\n
"
,
buffer
);
ret
=
HttpSendRequestA
(
req
,
NULL
,
0
,
NULL
,
0
);
ret
=
HttpSendRequestA
(
req
,
NULL
,
0
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequest failed: %lu
\n
"
,
GetLastError
());
ok
(
ret
,
"HttpSendRequest failed: %lu
\n
"
,
GetLastError
());
...
@@ -4102,9 +4136,61 @@ static void test_cookie_header(int port)
...
@@ -4102,9 +4136,61 @@ static void test_cookie_header(int port)
size
=
sizeof
(
buffer
);
size
=
sizeof
(
buffer
);
ret
=
HttpQueryInfoA
(
req
,
HTTP_QUERY_COOKIE
|
HTTP_QUERY_FLAG_REQUEST_HEADERS
,
buffer
,
&
size
,
NULL
);
ret
=
HttpQueryInfoA
(
req
,
HTTP_QUERY_COOKIE
|
HTTP_QUERY_FLAG_REQUEST_HEADERS
,
buffer
,
&
size
,
NULL
);
ok
(
ret
,
"HttpQueryInfo failed: %lu
\n
"
,
GetLastError
());
ok
(
ret
,
"HttpQueryInfo failed: %lu
\n
"
,
GetLastError
());
ok
(
!
strcmp
(
buffer
,
"cookie=biscuit"
),
"got '%s' expected
\'
cookie=biscuit
\'\n
"
,
buffer
);
ok
(
!
strstr
(
buffer
,
"cookie=not biscuit"
),
"'%s' should not contain
\'
cookie=not biscuit
\'\n
"
,
buffer
);
ok
(
!!
strstr
(
buffer
,
"cookie=biscuit"
),
"'%s' should contain
\'
cookie=biscuit
\'\n
"
,
buffer
);
InternetCloseHandle
(
req
);
InternetSetCookieA
(
"http://localhost/testCCCC"
,
"subcookie"
,
"data"
);
req
=
HttpOpenRequestA
(
con
,
NULL
,
"/test_cookie_path1"
,
NULL
,
NULL
,
NULL
,
INTERNET_FLAG_KEEP_CONNECTION
,
0
);
ok
(
req
!=
NULL
,
"HttpOpenRequest failed
\n
"
);
ret
=
HttpSendRequestA
(
req
,
NULL
,
0
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequest failed
\n
"
);
test_status_code
(
req
,
200
);
InternetCloseHandle
(
req
);
req
=
HttpOpenRequestA
(
con
,
NULL
,
"/test_cookie_path1/abc"
,
NULL
,
NULL
,
NULL
,
INTERNET_FLAG_KEEP_CONNECTION
,
0
);
ok
(
req
!=
NULL
,
"HttpOpenRequest failed
\n
"
);
ret
=
HttpSendRequestA
(
req
,
NULL
,
0
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequest failed
\n
"
);
test_status_code
(
req
,
200
);
InternetCloseHandle
(
req
);
req
=
HttpOpenRequestA
(
con
,
NULL
,
"/test_cookie_set_path"
,
NULL
,
NULL
,
NULL
,
INTERNET_FLAG_KEEP_CONNECTION
,
0
);
ok
(
req
!=
NULL
,
"HttpOpenRequest failed
\n
"
);
ret
=
HttpSendRequestA
(
req
,
NULL
,
0
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequest failed
\n
"
);
test_status_code
(
req
,
200
);
InternetCloseHandle
(
req
);
req
=
HttpOpenRequestA
(
con
,
NULL
,
"/test_cookie_path2"
,
NULL
,
NULL
,
NULL
,
INTERNET_FLAG_KEEP_CONNECTION
,
0
);
ok
(
req
!=
NULL
,
"HttpOpenRequest failed
\n
"
);
ret
=
HttpSendRequestA
(
req
,
NULL
,
0
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequest failed
\n
"
);
test_status_code
(
req
,
400
);
InternetCloseHandle
(
req
);
InternetCloseHandle
(
req
);
req
=
HttpOpenRequestA
(
con
,
NULL
,
"/test_cookie_merge"
,
NULL
,
NULL
,
NULL
,
INTERNET_FLAG_KEEP_CONNECTION
,
0
);
ok
(
req
!=
NULL
,
"HttpOpenRequest failed
\n
"
);
ret
=
HttpAddRequestHeadersA
(
req
,
"Cookie: manual_cookie=test
\r\n
"
,
~
0u
,
HTTP_ADDREQ_FLAG_ADD
);
ok
(
ret
,
"HttpAddRequestHeaders failed: %lu
\n
"
,
GetLastError
());
ret
=
HttpSendRequestA
(
req
,
NULL
,
0
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequest failed
\n
"
);
test_status_code
(
req
,
200
);
InternetCloseHandle
(
req
);
InternetCloseHandle
(
con
);
InternetCloseHandle
(
con
);
InternetCloseHandle
(
ses
);
InternetCloseHandle
(
ses
);
}
}
...
...
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