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
29967d63
Commit
29967d63
authored
Sep 22, 2015
by
Hans Leidekker
Committed by
Alexandre Julliard
Sep 25, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp/tests: Handle timeout errors.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
parent
42a8a3e7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
19 deletions
+33
-19
notification.c
dlls/winhttp/tests/notification.c
+13
-8
winhttp.c
dlls/winhttp/tests/winhttp.c
+20
-11
No files found.
dlls/winhttp/tests/notification.c
View file @
29967d63
...
...
@@ -159,7 +159,7 @@ static void setup_test( struct info *info, enum api function, unsigned int line
static
void
test_connection_cache
(
void
)
{
HANDLE
ses
,
con
,
req
,
event
;
DWORD
size
,
status
;
DWORD
size
,
status
,
err
;
BOOL
ret
,
unload
=
TRUE
;
struct
info
info
,
*
context
=
&
info
;
...
...
@@ -194,7 +194,8 @@ static void test_connection_cache( void )
setup_test
(
&
info
,
winhttp_send_request
,
__LINE__
);
ret
=
WinHttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
,
0
,
0
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_WINHTTP_CANNOT_CONNECT
)
err
=
GetLastError
();
if
(
!
ret
&&
(
err
==
ERROR_WINHTTP_CANNOT_CONNECT
||
err
==
ERROR_WINHTTP_TIMEOUT
))
{
skip
(
"connection failed, skipping
\n
"
);
goto
done
;
...
...
@@ -222,7 +223,8 @@ static void test_connection_cache( void )
setup_test
(
&
info
,
winhttp_send_request
,
__LINE__
);
ret
=
WinHttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
,
0
,
0
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_WINHTTP_CANNOT_CONNECT
)
err
=
GetLastError
();
if
(
!
ret
&&
(
err
==
ERROR_WINHTTP_CANNOT_CONNECT
||
err
==
ERROR_WINHTTP_TIMEOUT
))
{
skip
(
"connection failed, skipping
\n
"
);
goto
done
;
...
...
@@ -289,7 +291,8 @@ static void test_connection_cache( void )
setup_test
(
&
info
,
winhttp_send_request
,
__LINE__
);
ret
=
WinHttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
,
0
,
0
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_WINHTTP_CANNOT_CONNECT
)
err
=
GetLastError
();
if
(
!
ret
&&
(
err
==
ERROR_WINHTTP_CANNOT_CONNECT
||
err
==
ERROR_WINHTTP_TIMEOUT
))
{
skip
(
"connection failed, skipping
\n
"
);
goto
done
;
...
...
@@ -317,7 +320,8 @@ static void test_connection_cache( void )
setup_test
(
&
info
,
winhttp_send_request
,
__LINE__
);
ret
=
WinHttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
,
0
,
0
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_WINHTTP_CANNOT_CONNECT
)
err
=
GetLastError
();
if
(
!
ret
&&
(
err
==
ERROR_WINHTTP_CANNOT_CONNECT
||
err
==
ERROR_WINHTTP_TIMEOUT
))
{
skip
(
"connection failed, skipping
\n
"
);
goto
done
;
...
...
@@ -387,7 +391,7 @@ static const struct notification redirect_test[] =
static
void
test_redirect
(
void
)
{
HANDLE
ses
,
con
,
req
;
DWORD
size
,
status
;
DWORD
size
,
status
,
err
;
BOOL
ret
;
struct
info
info
,
*
context
=
&
info
;
...
...
@@ -414,7 +418,8 @@ static void test_redirect( void )
setup_test
(
&
info
,
winhttp_send_request
,
__LINE__
);
ret
=
WinHttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
,
0
,
0
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_WINHTTP_CANNOT_CONNECT
)
err
=
GetLastError
();
if
(
!
ret
&&
(
err
==
ERROR_WINHTTP_CANNOT_CONNECT
||
err
==
ERROR_WINHTTP_TIMEOUT
))
{
skip
(
"connection failed, skipping
\n
"
);
goto
done
;
...
...
@@ -524,7 +529,7 @@ static void test_async( void )
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
,
0
,
0
);
err
=
GetLastError
();
if
(
!
ret
&&
err
==
ERROR_WINHTTP_CANNOT_CONNECT
)
if
(
!
ret
&&
(
err
==
ERROR_WINHTTP_CANNOT_CONNECT
||
err
==
ERROR_WINHTTP_TIMEOUT
)
)
{
skip
(
"connection failed, skipping
\n
"
);
WinHttpCloseHandle
(
req
);
...
...
dlls/winhttp/tests/winhttp.c
View file @
29967d63
...
...
@@ -254,7 +254,7 @@ static void test_OpenRequest (void)
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSendRequest
(
request
,
WINHTTP_NO_ADDITIONAL_HEADERS
,
0
,
NULL
,
0
,
0
,
0
);
err
=
GetLastError
();
if
(
!
ret
&&
err
==
ERROR_WINHTTP_CANNOT_CONNECT
)
if
(
!
ret
&&
(
err
==
ERROR_WINHTTP_CANNOT_CONNECT
||
err
==
ERROR_WINHTTP_TIMEOUT
)
)
{
skip
(
"Connection failed, skipping.
\n
"
);
goto
done
;
...
...
@@ -280,6 +280,7 @@ static void test_empty_headers_param(void)
{
static
const
WCHAR
empty
[]
=
{
0
};
HINTERNET
ses
,
con
,
req
;
DWORD
err
;
BOOL
ret
;
ses
=
WinHttpOpen
(
test_useragent
,
0
,
NULL
,
NULL
,
0
);
...
...
@@ -292,7 +293,8 @@ static void test_empty_headers_param(void)
ok
(
req
!=
NULL
,
"failed to open a request %u
\n
"
,
GetLastError
());
ret
=
WinHttpSendRequest
(
req
,
empty
,
0
,
NULL
,
0
,
0
,
0
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_WINHTTP_CANNOT_CONNECT
)
err
=
GetLastError
();
if
(
!
ret
&&
(
err
==
ERROR_WINHTTP_CANNOT_CONNECT
||
err
==
ERROR_WINHTTP_TIMEOUT
))
{
skip
(
"connection failed, skipping
\n
"
);
goto
done
;
...
...
@@ -315,7 +317,7 @@ static void test_SendRequest (void)
static
CHAR
post_data
[]
=
"mode=Test"
;
static
const
char
test_post
[]
=
"mode => Test
\0\n
"
;
HINTERNET
session
,
request
,
connection
;
DWORD
header_len
,
optional_len
,
total_len
,
bytes_rw
,
size
;
DWORD
header_len
,
optional_len
,
total_len
,
bytes_rw
,
size
,
err
;
DWORD_PTR
context
;
BOOL
ret
;
CHAR
buffer
[
256
];
...
...
@@ -348,7 +350,8 @@ static void test_SendRequest (void)
context
++
;
ret
=
WinHttpSendRequest
(
request
,
content_type
,
header_len
,
post_data
,
optional_len
,
total_len
,
context
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_WINHTTP_CANNOT_CONNECT
)
err
=
GetLastError
();
if
(
!
ret
&&
(
err
==
ERROR_WINHTTP_CANNOT_CONNECT
||
err
==
ERROR_WINHTTP_TIMEOUT
))
{
skip
(
"connection failed, skipping
\n
"
);
goto
done
;
...
...
@@ -968,7 +971,7 @@ static void CALLBACK cert_error(HINTERNET handle, DWORD_PTR ctx, DWORD status, L
static
void
test_secure_connection
(
void
)
{
HINTERNET
ses
,
con
,
req
;
DWORD
size
,
status
,
policy
,
bitness
,
read_size
;
DWORD
size
,
status
,
policy
,
bitness
,
read_size
,
err
;
BOOL
ret
;
CERT_CONTEXT
*
cert
;
WINHTTP_CERTIFICATE_INFO
info
;
...
...
@@ -989,7 +992,8 @@ static void test_secure_connection(void)
ok
(
req
!=
NULL
,
"failed to open a request %u
\n
"
,
GetLastError
());
ret
=
WinHttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
,
0
,
0
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_WINHTTP_CANNOT_CONNECT
)
err
=
GetLastError
();
if
(
!
ret
&&
(
err
==
ERROR_WINHTTP_CANNOT_CONNECT
||
err
==
ERROR_WINHTTP_TIMEOUT
))
{
skip
(
"Connection failed, skipping.
\n
"
);
goto
cleanup
;
...
...
@@ -1011,7 +1015,9 @@ static void test_secure_connection(void)
WinHttpSetStatusCallback
(
req
,
cert_error
,
WINHTTP_CALLBACK_STATUS_SECURE_FAILURE
,
0
);
ret
=
WinHttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
,
0
,
0
);
if
(
!
ret
&&
(
GetLastError
()
==
ERROR_WINHTTP_SECURE_FAILURE
||
GetLastError
()
==
ERROR_WINHTTP_CANNOT_CONNECT
))
err
=
GetLastError
();
if
(
!
ret
&&
(
err
==
ERROR_WINHTTP_SECURE_FAILURE
||
err
==
ERROR_WINHTTP_CANNOT_CONNECT
||
err
==
ERROR_WINHTTP_TIMEOUT
))
{
skip
(
"secure connection failed, skipping remaining secure tests
\n
"
);
goto
cleanup
;
...
...
@@ -1089,7 +1095,8 @@ static void test_request_parameter_defaults(void)
ok
(
req
!=
NULL
,
"failed to open a request %u
\n
"
,
GetLastError
());
ret
=
WinHttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
,
0
,
0
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_WINHTTP_CANNOT_CONNECT
)
error
=
GetLastError
();
if
(
!
ret
&&
(
error
==
ERROR_WINHTTP_CANNOT_CONNECT
||
error
==
ERROR_WINHTTP_TIMEOUT
))
{
skip
(
"connection failed, skipping
\n
"
);
goto
done
;
...
...
@@ -1116,7 +1123,8 @@ static void test_request_parameter_defaults(void)
ok
(
req
!=
NULL
,
"failed to open a request %u
\n
"
,
GetLastError
());
ret
=
WinHttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
,
0
,
0
);
if
(
!
ret
&&
(
GetLastError
()
==
ERROR_WINHTTP_CANNOT_CONNECT
||
GetLastError
()
==
ERROR_WINHTTP_TIMEOUT
))
error
=
GetLastError
();
if
(
!
ret
&&
(
error
==
ERROR_WINHTTP_CANNOT_CONNECT
||
error
==
ERROR_WINHTTP_TIMEOUT
))
{
skip
(
"connection failed, skipping
\n
"
);
goto
done
;
...
...
@@ -4009,7 +4017,7 @@ static void test_chunked_read(void)
static
const
WCHAR
verb
[]
=
{
'/'
,
't'
,
'e'
,
's'
,
't'
,
'c'
,
'h'
,
'u'
,
'n'
,
'k'
,
'e'
,
'd'
,
0
};
static
const
WCHAR
chunked
[]
=
{
'c'
,
'h'
,
'u'
,
'n'
,
'k'
,
'e'
,
'd'
,
0
};
WCHAR
header
[
32
];
DWORD
len
;
DWORD
len
,
err
;
HINTERNET
ses
,
con
=
NULL
,
req
=
NULL
;
BOOL
ret
;
...
...
@@ -4028,7 +4036,8 @@ static void test_chunked_read(void)
if
(
!
req
)
goto
done
;
ret
=
WinHttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
,
0
,
0
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_WINHTTP_CANNOT_CONNECT
)
err
=
GetLastError
();
if
(
!
ret
&&
(
err
==
ERROR_WINHTTP_CANNOT_CONNECT
||
err
==
ERROR_WINHTTP_TIMEOUT
))
{
skip
(
"connection failed, skipping
\n
"
);
goto
done
;
...
...
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