Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
0e0f0641
Commit
0e0f0641
authored
Mar 13, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Mar 13, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Added tests for Cache-Control: no-cache and no-store HTTP headers.
parent
9d6843a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
http.c
dlls/wininet/tests/http.c
+68
-0
No files found.
dlls/wininet/tests/http.c
View file @
0e0f0641
...
...
@@ -2015,6 +2015,16 @@ static DWORD CALLBACK server_thread(LPVOID param)
WaitForSingleObject
(
conn_close_event
,
INFINITE
);
trace
(
"closing connection
\n
"
);
}
if
(
strstr
(
buffer
,
"GET /test_cache_control_no_cache"
))
{
static
const
char
no_cache_response
[]
=
"HTTP/1.1 200 OK
\r\n
Cache-Control: no-cache
\r\n\r\n
some content"
;
send
(
c
,
no_cache_response
,
sizeof
(
no_cache_response
)
-
1
,
0
);
}
if
(
strstr
(
buffer
,
"GET /test_cache_control_no_store"
))
{
static
const
char
no_cache_response
[]
=
"HTTP/1.1 200 OK
\r\n
Cache-Control: No-StOrE
\r\n\r\n
some content"
;
send
(
c
,
no_cache_response
,
sizeof
(
no_cache_response
)
-
1
,
0
);
}
shutdown
(
c
,
2
);
closesocket
(
c
);
...
...
@@ -2474,6 +2484,63 @@ static void test_conn_close(int port)
CloseHandle
(
hCompleteEvent
);
}
static
void
test_no_cache
(
int
port
)
{
static
const
char
cache_control_no_cache
[]
=
"/test_cache_control_no_cache"
;
static
const
char
cache_control_no_store
[]
=
"/test_cache_control_no_store"
;
static
const
char
cache_url_fmt
[]
=
"http://localhost:%d%s"
;
char
cache_url
[
256
],
buf
[
256
];
HINTERNET
ses
,
con
,
req
;
DWORD
read
,
size
;
BOOL
ret
;
trace
(
"Testing no-cache header
\n
"
);
ses
=
InternetOpen
(
"winetest"
,
INTERNET_OPEN_TYPE_DIRECT
,
NULL
,
NULL
,
0
);
ok
(
ses
!=
NULL
,
"InternetOpen failed with error %u
\n
"
,
GetLastError
());
con
=
InternetConnect
(
ses
,
"localhost"
,
port
,
NULL
,
NULL
,
INTERNET_SERVICE_HTTP
,
0
,
0
);
ok
(
con
!=
NULL
,
"InternetConnect failed with error %u
\n
"
,
GetLastError
());
req
=
HttpOpenRequest
(
con
,
NULL
,
cache_control_no_cache
,
NULL
,
NULL
,
NULL
,
0
,
0
);
ok
(
req
!=
NULL
,
"HttpOpenRequest failed
\n
"
);
sprintf
(
cache_url
,
cache_url_fmt
,
port
,
cache_control_no_cache
);
DeleteUrlCacheEntry
(
cache_url
);
ret
=
HttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequest failed with error %u
\n
"
,
GetLastError
());
size
=
0
;
while
(
InternetReadFile
(
req
,
buf
,
sizeof
(
buf
),
&
read
)
&&
read
)
size
+=
read
;
ok
(
size
==
12
,
"read %d bytes of data
\n
"
,
size
);
InternetCloseHandle
(
req
);
ret
=
DeleteUrlCacheEntry
(
cache_url
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"cache entry should not exist
\n
"
);
req
=
HttpOpenRequest
(
con
,
NULL
,
cache_control_no_store
,
NULL
,
NULL
,
NULL
,
0
,
0
);
ok
(
req
!=
NULL
,
"HttpOpenRequest failed
\n
"
);
sprintf
(
cache_url
,
cache_url_fmt
,
port
,
cache_control_no_store
);
DeleteUrlCacheEntry
(
cache_url
);
ret
=
HttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
);
ok
(
ret
,
"HttpSendRequest failed with error %u
\n
"
,
GetLastError
());
size
=
0
;
while
(
InternetReadFile
(
req
,
buf
,
sizeof
(
buf
),
&
read
)
&&
read
)
size
+=
read
;
ok
(
size
==
12
,
"read %d bytes of data
\n
"
,
size
);
InternetCloseHandle
(
req
);
ret
=
DeleteUrlCacheEntry
(
cache_url
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"cache entry should not exist
\n
"
);
InternetCloseHandle
(
con
);
InternetCloseHandle
(
ses
);
}
static
void
test_HttpSendRequestW
(
int
port
)
{
static
const
WCHAR
header
[]
=
{
'U'
,
'A'
,
'-'
,
'C'
,
'P'
,
'U'
,
':'
,
' '
,
'x'
,
'8'
,
'6'
,
0
};
...
...
@@ -2951,6 +3018,7 @@ static void test_http_connection(void)
test_options
(
si
.
port
);
test_no_content
(
si
.
port
);
test_conn_close
(
si
.
port
);
test_no_cache
(
si
.
port
);
/* send the basic request again to shutdown the server thread */
test_basic_request
(
si
.
port
,
"GET"
,
"/quit"
);
...
...
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