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
462f56d4
Commit
462f56d4
authored
Sep 25, 2014
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 25, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Protect the request headers array with a critical section.
parent
bbfae5be
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
0 deletions
+53
-0
http.c
dlls/wininet/http.c
+0
-0
internet.h
dlls/wininet/internet.h
+3
-0
http.c
dlls/wininet/tests/http.c
+50
-0
No files found.
dlls/wininet/http.c
View file @
462f56d4
This diff is collapsed.
Click to expand it.
dlls/wininet/internet.h
View file @
462f56d4
...
...
@@ -364,8 +364,11 @@ typedef struct
LPWSTR
statusText
;
DWORD
bytesToWrite
;
DWORD
bytesWritten
;
CRITICAL_SECTION
headers_section
;
/* section to protect the headers array */
HTTPHEADERW
*
custHeaders
;
DWORD
nCustHeaders
;
FILETIME
last_modified
;
HANDLE
hCacheFile
;
req_file_t
*
req_file
;
...
...
dlls/wininet/tests/http.c
View file @
462f56d4
...
...
@@ -5475,6 +5475,55 @@ static void init_status_tests(void)
#undef STATUS_STRING
}
static
void
WINAPI
header_cb
(
HINTERNET
handle
,
DWORD_PTR
ctx
,
DWORD
status
,
LPVOID
info
,
DWORD
len
)
{
if
(
status
==
INTERNET_STATUS_REQUEST_COMPLETE
)
SetEvent
(
(
HANDLE
)
ctx
);
}
static
void
test_concurrent_header_access
(
void
)
{
HINTERNET
ses
,
con
,
req
;
DWORD
index
,
len
,
err
;
BOOL
ret
;
char
buf
[
128
];
HANDLE
wait
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ses
=
InternetOpenA
(
"winetest"
,
0
,
NULL
,
NULL
,
INTERNET_FLAG_ASYNC
);
ok
(
ses
!=
NULL
,
"InternetOpenA failed
\n
"
);
con
=
InternetConnectA
(
ses
,
"test.winehq.org"
,
INTERNET_DEFAULT_HTTP_PORT
,
NULL
,
NULL
,
INTERNET_SERVICE_HTTP
,
0
,
0
);
ok
(
con
!=
NULL
,
"InternetConnectA failed %u
\n
"
,
GetLastError
()
);
req
=
HttpOpenRequestA
(
con
,
NULL
,
"/"
,
NULL
,
NULL
,
NULL
,
0
,
(
DWORD_PTR
)
wait
);
ok
(
req
!=
NULL
,
"HttpOpenRequestA failed %u
\n
"
,
GetLastError
()
);
pInternetSetStatusCallbackA
(
req
,
header_cb
);
SetLastError
(
0xdeadbeef
);
ret
=
HttpSendRequestA
(
req
,
NULL
,
0
,
NULL
,
0
);
err
=
GetLastError
();
ok
(
!
ret
,
"HttpSendRequestA succeeded
\n
"
);
ok
(
err
==
ERROR_IO_PENDING
,
"got %u
\n
"
,
ERROR_IO_PENDING
);
ret
=
HttpAddRequestHeadersA
(
req
,
"winetest: winetest"
,
~
0u
,
HTTP_ADDREQ_FLAG_ADD
);
ok
(
ret
,
"HttpAddRequestHeadersA failed %u
\n
"
,
GetLastError
()
);
index
=
0
;
len
=
sizeof
(
buf
);
ret
=
HttpQueryInfoA
(
req
,
HTTP_QUERY_RAW_HEADERS_CRLF
|
HTTP_QUERY_FLAG_REQUEST_HEADERS
,
buf
,
&
len
,
&
index
);
ok
(
ret
,
"HttpQueryInfoA failed %u
\n
"
,
GetLastError
()
);
ok
(
strstr
(
buf
,
"winetest: winetest"
)
!=
NULL
,
"header missing
\n
"
);
WaitForSingleObject
(
wait
,
5000
);
InternetCloseHandle
(
req
);
InternetCloseHandle
(
con
);
InternetCloseHandle
(
ses
);
CloseHandle
(
wait
);
}
START_TEST
(
http
)
{
HMODULE
hdll
;
...
...
@@ -5517,4 +5566,5 @@ START_TEST(http)
InternetReadFile_test
(
INTERNET_FLAG_ASYNC
,
&
test_data
[
3
]);
test_connection_failure
();
test_default_service_port
();
test_concurrent_header_access
();
}
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