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
f3346a78
Commit
f3346a78
authored
Sep 07, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 08, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Support asynchronous requests.
parent
a4d0abb2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
5 deletions
+75
-5
request.c
dlls/winhttp/request.c
+0
-0
notification.c
dlls/winhttp/tests/notification.c
+29
-5
winhttp_private.h
dlls/winhttp/winhttp_private.h
+46
-0
No files found.
dlls/winhttp/request.c
View file @
f3346a78
This diff is collapsed.
Click to expand it.
dlls/winhttp/tests/notification.c
View file @
f3346a78
...
...
@@ -34,6 +34,9 @@ enum api
winhttp_open_request
,
winhttp_send_request
,
winhttp_receive_response
,
winhttp_query_data
,
winhttp_read_data
,
winhttp_write_data
,
winhttp_close_handle
};
...
...
@@ -70,12 +73,15 @@ static void CALLBACK check_notification( HINTERNET handle, DWORD_PTR context, DW
ok
(
info
->
test
[
i
].
status
==
status
,
"expected status 0x%08x got 0x%08x
\n
"
,
info
->
test
[
i
].
status
,
status
);
ok
(
info
->
test
[
i
].
function
==
info
->
function
,
"expected function %u got %u
\n
"
,
info
->
test
[
i
].
function
,
info
->
function
);
}
else
todo_wine
else
{
ok
(
info
->
test
[
i
].
status
==
status
,
"expected status 0x%08x got 0x%08x
\n
"
,
info
->
test
[
i
].
status
,
status
);
ok
(
info
->
test
[
i
].
function
==
info
->
function
,
"expected function %u got %u
\n
"
,
info
->
test
[
i
].
function
,
info
->
function
);
todo_wine
ok
(
info
->
test
[
i
].
status
==
status
,
"expected status 0x%08x got 0x%08x
\n
"
,
info
->
test
[
i
].
status
,
status
);
if
(
info
->
test
[
i
].
status
==
status
)
{
todo_wine
ok
(
info
->
test
[
i
].
function
==
info
->
function
,
"expected function %u got %u
\n
"
,
info
->
test
[
i
].
function
,
info
->
function
);
}
}
info
->
index
++
;
i
f
(
info
->
test
[
i
].
status
==
status
)
i
nfo
->
index
++
;
if
(
status
&
WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS
)
SetEvent
(
info
->
wait
);
}
...
...
@@ -146,7 +152,7 @@ static void test_connection_cache( void )
WinHttpCloseHandle
(
con
);
WinHttpCloseHandle
(
ses
);
Sleep
(
20
00
);
/* make sure connection is evicted from cache */
Sleep
(
15
00
);
/* make sure connection is evicted from cache */
info
.
index
=
0
;
...
...
@@ -287,6 +293,10 @@ static const struct notification async_test[] =
{
winhttp_receive_response
,
WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE
,
0
},
{
winhttp_receive_response
,
WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED
,
0
},
{
winhttp_receive_response
,
WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE
,
0
},
{
winhttp_query_data
,
WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE
,
0
},
{
winhttp_read_data
,
WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE
,
1
},
{
winhttp_read_data
,
WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED
,
1
},
{
winhttp_read_data
,
WINHTTP_CALLBACK_STATUS_READ_COMPLETE
,
1
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
,
0
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
,
0
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
0
},
...
...
@@ -302,6 +312,7 @@ static void test_async( void )
DWORD
size
,
status
;
BOOL
ret
;
struct
info
info
,
*
context
=
&
info
;
char
buffer
[
1024
];
info
.
test
=
async_test
;
info
.
count
=
sizeof
(
async_test
)
/
sizeof
(
async_test
[
0
]);
...
...
@@ -341,6 +352,18 @@ static void test_async( void )
ok
(
ret
,
"failed unexpectedly %u
\n
"
,
GetLastError
());
ok
(
status
==
200
,
"request failed unexpectedly %u
\n
"
,
status
);
info
.
function
=
winhttp_query_data
;
ret
=
WinHttpQueryDataAvailable
(
req
,
NULL
);
ok
(
ret
,
"failed to query data available %u
\n
"
,
GetLastError
());
WaitForSingleObject
(
info
.
wait
,
INFINITE
);
info
.
function
=
winhttp_read_data
;
ret
=
WinHttpReadData
(
req
,
buffer
,
sizeof
(
buffer
),
NULL
);
ok
(
ret
,
"failed to query data available %u
\n
"
,
GetLastError
());
WaitForSingleObject
(
info
.
wait
,
INFINITE
);
info
.
function
=
winhttp_close_handle
;
WinHttpCloseHandle
(
req
);
WinHttpCloseHandle
(
con
);
...
...
@@ -352,5 +375,6 @@ START_TEST (notification)
{
test_connection_cache
();
test_redirect
();
Sleep
(
1500
);
/* make sure previous connection is evicted from cache */
test_async
();
}
dlls/winhttp/winhttp_private.h
View file @
f3346a78
...
...
@@ -120,6 +120,52 @@ typedef struct
DWORD
num_headers
;
}
request_t
;
typedef
struct
_task_header_t
task_header_t
;
struct
_task_header_t
{
request_t
*
request
;
void
(
*
proc
)(
task_header_t
*
);
};
typedef
struct
{
task_header_t
hdr
;
LPWSTR
headers
;
DWORD
headers_len
;
LPVOID
optional
;
DWORD
optional_len
;
DWORD
total_len
;
DWORD_PTR
context
;
}
send_request_t
;
typedef
struct
{
task_header_t
hdr
;
}
receive_response_t
;
typedef
struct
{
task_header_t
hdr
;
LPDWORD
available
;
}
query_data_t
;
typedef
struct
{
task_header_t
hdr
;
LPVOID
buffer
;
DWORD
to_read
;
LPDWORD
read
;
}
read_data_t
;
typedef
struct
{
task_header_t
hdr
;
LPCVOID
buffer
;
DWORD
to_write
;
LPDWORD
written
;
}
write_data_t
;
object_header_t
*
addref_object
(
object_header_t
*
);
object_header_t
*
grab_object
(
HINTERNET
);
void
release_object
(
object_header_t
*
);
...
...
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