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
1def0982
Commit
1def0982
authored
Aug 03, 2015
by
Hans Leidekker
Committed by
Alexandre Julliard
Aug 03, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Always clear last error on success.
parent
09de5cdb
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
13 deletions
+83
-13
request.c
dlls/winhttp/request.c
+9
-0
session.c
dlls/winhttp/session.c
+27
-2
notification.c
dlls/winhttp/tests/notification.c
+37
-10
url.c
dlls/winhttp/tests/url.c
+8
-1
winhttp.c
dlls/winhttp/tests/winhttp.c
+0
-0
url.c
dlls/winhttp/url.c
+2
-0
No files found.
dlls/winhttp/request.c
View file @
1def0982
...
@@ -541,6 +541,7 @@ BOOL WINAPI WinHttpAddRequestHeaders( HINTERNET hrequest, LPCWSTR headers, DWORD
...
@@ -541,6 +541,7 @@ BOOL WINAPI WinHttpAddRequestHeaders( HINTERNET hrequest, LPCWSTR headers, DWORD
ret
=
add_request_headers
(
request
,
headers
,
len
,
flags
);
ret
=
add_request_headers
(
request
,
headers
,
len
,
flags
);
release_object
(
&
request
->
hdr
);
release_object
(
&
request
->
hdr
);
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -848,6 +849,7 @@ BOOL WINAPI WinHttpQueryHeaders( HINTERNET hrequest, DWORD level, LPCWSTR name,
...
@@ -848,6 +849,7 @@ BOOL WINAPI WinHttpQueryHeaders( HINTERNET hrequest, DWORD level, LPCWSTR name,
ret
=
query_headers
(
request
,
level
,
name
,
buffer
,
buflen
,
index
);
ret
=
query_headers
(
request
,
level
,
name
,
buffer
,
buflen
,
index
);
release_object
(
&
request
->
hdr
);
release_object
(
&
request
->
hdr
);
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -1265,6 +1267,7 @@ BOOL WINAPI WinHttpSendRequest( HINTERNET hrequest, LPCWSTR headers, DWORD heade
...
@@ -1265,6 +1267,7 @@ BOOL WINAPI WinHttpSendRequest( HINTERNET hrequest, LPCWSTR headers, DWORD heade
ret
=
send_request
(
request
,
headers
,
headers_len
,
optional
,
optional_len
,
total_len
,
context
,
FALSE
);
ret
=
send_request
(
request
,
headers
,
headers_len
,
optional
,
optional_len
,
total_len
,
context
,
FALSE
);
release_object
(
&
request
->
hdr
);
release_object
(
&
request
->
hdr
);
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -1388,6 +1391,7 @@ BOOL WINAPI WinHttpQueryAuthSchemes( HINTERNET hrequest, LPDWORD supported, LPDW
...
@@ -1388,6 +1391,7 @@ BOOL WINAPI WinHttpQueryAuthSchemes( HINTERNET hrequest, LPDWORD supported, LPDW
}
}
release_object
(
&
request
->
hdr
);
release_object
(
&
request
->
hdr
);
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -1842,6 +1846,7 @@ BOOL WINAPI WinHttpSetCredentials( HINTERNET hrequest, DWORD target, DWORD schem
...
@@ -1842,6 +1846,7 @@ BOOL WINAPI WinHttpSetCredentials( HINTERNET hrequest, DWORD target, DWORD schem
ret
=
set_credentials
(
request
,
target
,
scheme
,
username
,
password
);
ret
=
set_credentials
(
request
,
target
,
scheme
,
username
,
password
);
release_object
(
&
request
->
hdr
);
release_object
(
&
request
->
hdr
);
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -2484,6 +2489,7 @@ BOOL WINAPI WinHttpReceiveResponse( HINTERNET hrequest, LPVOID reserved )
...
@@ -2484,6 +2489,7 @@ BOOL WINAPI WinHttpReceiveResponse( HINTERNET hrequest, LPVOID reserved )
ret
=
receive_response
(
request
,
FALSE
);
ret
=
receive_response
(
request
,
FALSE
);
release_object
(
&
request
->
hdr
);
release_object
(
&
request
->
hdr
);
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -2555,6 +2561,7 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available )
...
@@ -2555,6 +2561,7 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available )
ret
=
query_data_available
(
request
,
available
,
FALSE
);
ret
=
query_data_available
(
request
,
available
,
FALSE
);
release_object
(
&
request
->
hdr
);
release_object
(
&
request
->
hdr
);
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -2604,6 +2611,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, LPVOID buffer, DWORD to_read, L
...
@@ -2604,6 +2611,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, LPVOID buffer, DWORD to_read, L
ret
=
read_data
(
request
,
buffer
,
to_read
,
read
,
FALSE
);
ret
=
read_data
(
request
,
buffer
,
to_read
,
read
,
FALSE
);
release_object
(
&
request
->
hdr
);
release_object
(
&
request
->
hdr
);
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -2675,6 +2683,7 @@ BOOL WINAPI WinHttpWriteData( HINTERNET hrequest, LPCVOID buffer, DWORD to_write
...
@@ -2675,6 +2683,7 @@ BOOL WINAPI WinHttpWriteData( HINTERNET hrequest, LPCVOID buffer, DWORD to_write
ret
=
write_data
(
request
,
buffer
,
to_write
,
written
,
FALSE
);
ret
=
write_data
(
request
,
buffer
,
to_write
,
written
,
FALSE
);
release_object
(
&
request
->
hdr
);
release_object
(
&
request
->
hdr
);
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
...
dlls/winhttp/session.c
View file @
1def0982
...
@@ -276,6 +276,7 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWST
...
@@ -276,6 +276,7 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWST
end:
end:
release_object
(
&
session
->
hdr
);
release_object
(
&
session
->
hdr
);
TRACE
(
"returning %p
\n
"
,
handle
);
TRACE
(
"returning %p
\n
"
,
handle
);
if
(
handle
)
set_last_error
(
ERROR_SUCCESS
);
return
handle
;
return
handle
;
}
}
...
@@ -552,6 +553,7 @@ end:
...
@@ -552,6 +553,7 @@ end:
release_object
(
&
connect
->
hdr
);
release_object
(
&
connect
->
hdr
);
release_object
(
&
session
->
hdr
);
release_object
(
&
session
->
hdr
);
TRACE
(
"returning %p
\n
"
,
hconnect
);
TRACE
(
"returning %p
\n
"
,
hconnect
);
if
(
hconnect
)
set_last_error
(
ERROR_SUCCESS
);
return
hconnect
;
return
hconnect
;
}
}
...
@@ -1127,6 +1129,7 @@ end:
...
@@ -1127,6 +1129,7 @@ end:
release_object
(
&
request
->
hdr
);
release_object
(
&
request
->
hdr
);
release_object
(
&
connect
->
hdr
);
release_object
(
&
connect
->
hdr
);
TRACE
(
"returning %p
\n
"
,
hrequest
);
TRACE
(
"returning %p
\n
"
,
hrequest
);
if
(
hrequest
)
set_last_error
(
ERROR_SUCCESS
);
return
hrequest
;
return
hrequest
;
}
}
...
@@ -1146,6 +1149,7 @@ BOOL WINAPI WinHttpCloseHandle( HINTERNET handle )
...
@@ -1146,6 +1149,7 @@ BOOL WINAPI WinHttpCloseHandle( HINTERNET handle )
}
}
release_object
(
hdr
);
release_object
(
hdr
);
free_handle
(
handle
);
free_handle
(
handle
);
set_last_error
(
ERROR_SUCCESS
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -1206,6 +1210,7 @@ BOOL WINAPI WinHttpQueryOption( HINTERNET handle, DWORD option, LPVOID buffer, L
...
@@ -1206,6 +1210,7 @@ BOOL WINAPI WinHttpQueryOption( HINTERNET handle, DWORD option, LPVOID buffer, L
ret
=
query_option
(
hdr
,
option
,
buffer
,
buflen
);
ret
=
query_option
(
hdr
,
option
,
buffer
,
buflen
);
release_object
(
hdr
);
release_object
(
hdr
);
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -1264,6 +1269,7 @@ BOOL WINAPI WinHttpSetOption( HINTERNET handle, DWORD option, LPVOID buffer, DWO
...
@@ -1264,6 +1269,7 @@ BOOL WINAPI WinHttpSetOption( HINTERNET handle, DWORD option, LPVOID buffer, DWO
ret
=
set_option
(
hdr
,
option
,
buffer
,
buflen
);
ret
=
set_option
(
hdr
,
option
,
buffer
,
buflen
);
release_object
(
hdr
);
release_object
(
hdr
);
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -1373,6 +1379,7 @@ BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url )
...
@@ -1373,6 +1379,7 @@ BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url )
if
(
!
(
urlW
=
strdupAW
(
system_url
)))
return
FALSE
;
if
(
!
(
urlW
=
strdupAW
(
system_url
)))
return
FALSE
;
*
url
=
urlW
;
*
url
=
urlW
;
set_last_error
(
ERROR_SUCCESS
);
return
TRUE
;
return
TRUE
;
}
}
if
(
flags
&
WINHTTP_AUTO_DETECT_TYPE_DHCP
)
if
(
flags
&
WINHTTP_AUTO_DETECT_TYPE_DHCP
)
...
@@ -1433,6 +1440,7 @@ BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url )
...
@@ -1433,6 +1440,7 @@ BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url )
set_last_error
(
ERROR_WINHTTP_AUTODETECTION_FAILED
);
set_last_error
(
ERROR_WINHTTP_AUTODETECTION_FAILED
);
*
url
=
NULL
;
*
url
=
NULL
;
}
}
else
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -1600,6 +1608,7 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
...
@@ -1600,6 +1608,7 @@ BOOL WINAPI WinHttpGetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
info
->
lpszProxy
=
NULL
;
info
->
lpszProxy
=
NULL
;
info
->
lpszProxyBypass
=
NULL
;
info
->
lpszProxyBypass
=
NULL
;
}
}
set_last_error
(
ERROR_SUCCESS
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -1682,6 +1691,7 @@ done:
...
@@ -1682,6 +1691,7 @@ done:
GlobalFree
(
config
->
lpszProxyBypass
);
GlobalFree
(
config
->
lpszProxyBypass
);
config
->
lpszProxyBypass
=
NULL
;
config
->
lpszProxyBypass
=
NULL
;
}
}
else
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -1866,6 +1876,7 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO
...
@@ -1866,6 +1876,7 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO
done:
done:
GlobalFree
(
detected_pac_url
);
GlobalFree
(
detected_pac_url
);
release_object
(
&
session
->
hdr
);
release_object
(
&
session
->
hdr
);
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -1973,6 +1984,7 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
...
@@ -1973,6 +1984,7 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
}
}
RegCloseKey
(
key
);
RegCloseKey
(
key
);
}
}
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -1997,6 +2009,7 @@ WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback( HINTERNET handle, WINHT
...
@@ -1997,6 +2009,7 @@ WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback( HINTERNET handle, WINHT
hdr
->
notify_mask
=
flags
;
hdr
->
notify_mask
=
flags
;
release_object
(
hdr
);
release_object
(
hdr
);
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -2065,6 +2078,7 @@ BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int
...
@@ -2065,6 +2078,7 @@ BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int
ret
=
FALSE
;
ret
=
FALSE
;
}
}
release_object
(
hdr
);
release_object
(
hdr
);
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -2087,7 +2101,11 @@ BOOL WINAPI WinHttpTimeFromSystemTime( const SYSTEMTIME *time, LPWSTR string )
...
@@ -2087,7 +2101,11 @@ BOOL WINAPI WinHttpTimeFromSystemTime( const SYSTEMTIME *time, LPWSTR string )
TRACE
(
"%p, %p
\n
"
,
time
,
string
);
TRACE
(
"%p, %p
\n
"
,
time
,
string
);
if
(
!
time
||
!
string
)
return
FALSE
;
if
(
!
time
||
!
string
)
{
set_last_error
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
sprintfW
(
string
,
format
,
sprintfW
(
string
,
format
,
wkday
[
time
->
wDayOfWeek
],
wkday
[
time
->
wDayOfWeek
],
...
@@ -2098,6 +2116,7 @@ BOOL WINAPI WinHttpTimeFromSystemTime( const SYSTEMTIME *time, LPWSTR string )
...
@@ -2098,6 +2116,7 @@ BOOL WINAPI WinHttpTimeFromSystemTime( const SYSTEMTIME *time, LPWSTR string )
time
->
wMinute
,
time
->
wMinute
,
time
->
wSecond
);
time
->
wSecond
);
set_last_error
(
ERROR_SUCCESS
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -2112,7 +2131,11 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time )
...
@@ -2112,7 +2131,11 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time )
TRACE
(
"%s, %p
\n
"
,
debugstr_w
(
string
),
time
);
TRACE
(
"%s, %p
\n
"
,
debugstr_w
(
string
),
time
);
if
(
!
string
||
!
time
)
return
FALSE
;
if
(
!
string
||
!
time
)
{
set_last_error
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
/* Windows does this too */
/* Windows does this too */
GetSystemTime
(
time
);
GetSystemTime
(
time
);
...
@@ -2121,6 +2144,8 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time )
...
@@ -2121,6 +2144,8 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time )
* a SYSTEMTIME structure.
* a SYSTEMTIME structure.
*/
*/
set_last_error
(
ERROR_SUCCESS
);
while
(
*
s
&&
!
isalphaW
(
*
s
))
s
++
;
while
(
*
s
&&
!
isalphaW
(
*
s
))
s
++
;
if
(
s
[
0
]
==
'\0'
||
s
[
1
]
==
'\0'
||
s
[
2
]
==
'\0'
)
return
TRUE
;
if
(
s
[
0
]
==
'\0'
||
s
[
1
]
==
'\0'
||
s
[
2
]
==
'\0'
)
return
TRUE
;
time
->
wDayOfWeek
=
7
;
time
->
wDayOfWeek
=
7
;
...
...
dlls/winhttp/tests/notification.c
View file @
1def0982
...
@@ -474,7 +474,7 @@ static const struct notification async_test[] =
...
@@ -474,7 +474,7 @@ static const struct notification async_test[] =
static
void
test_async
(
void
)
static
void
test_async
(
void
)
{
{
HANDLE
ses
,
con
,
req
,
event
;
HANDLE
ses
,
con
,
req
,
event
;
DWORD
size
,
status
;
DWORD
size
,
status
,
err
;
BOOL
ret
,
unload
=
TRUE
;
BOOL
ret
,
unload
=
TRUE
;
struct
info
info
,
*
context
=
&
info
;
struct
info
info
,
*
context
=
&
info
;
char
buffer
[
1024
];
char
buffer
[
1024
];
...
@@ -495,22 +495,36 @@ static void test_async( void )
...
@@ -495,22 +495,36 @@ static void test_async( void )
unload
=
FALSE
;
unload
=
FALSE
;
}
}
SetLastError
(
0xdeadbeef
);
WinHttpSetStatusCallback
(
ses
,
check_notification
,
WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS
,
0
);
WinHttpSetStatusCallback
(
ses
,
check_notification
,
WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS
,
0
);
err
=
GetLastError
();
ok
(
err
==
ERROR_SUCCESS
||
broken
(
err
==
0xdeadbeef
)
/* < win7 */
,
"got %u
\n
"
,
err
);
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSetOption
(
ses
,
WINHTTP_OPTION_CONTEXT_VALUE
,
&
context
,
sizeof
(
struct
info
*
)
);
ret
=
WinHttpSetOption
(
ses
,
WINHTTP_OPTION_CONTEXT_VALUE
,
&
context
,
sizeof
(
struct
info
*
)
);
ok
(
ret
,
"failed to set context value %u
\n
"
,
GetLastError
());
err
=
GetLastError
();
ok
(
ret
,
"failed to set context value %u
\n
"
,
err
);
ok
(
err
==
ERROR_SUCCESS
||
broken
(
err
==
0xdeadbeef
)
/* < win7 */
,
"got %u
\n
"
,
err
);
setup_test
(
&
info
,
winhttp_connect
,
__LINE__
);
setup_test
(
&
info
,
winhttp_connect
,
__LINE__
);
SetLastError
(
0xdeadbeef
);
con
=
WinHttpConnect
(
ses
,
test_winehq
,
0
,
0
);
con
=
WinHttpConnect
(
ses
,
test_winehq
,
0
,
0
);
ok
(
con
!=
NULL
,
"failed to open a connection %u
\n
"
,
GetLastError
());
err
=
GetLastError
();
ok
(
con
!=
NULL
,
"failed to open a connection %u
\n
"
,
err
);
ok
(
err
==
ERROR_SUCCESS
||
broken
(
err
==
WSAEINVAL
)
/* < win7 */
,
"got %u
\n
"
,
err
);
setup_test
(
&
info
,
winhttp_open_request
,
__LINE__
);
setup_test
(
&
info
,
winhttp_open_request
,
__LINE__
);
SetLastError
(
0xdeadbeef
);
req
=
WinHttpOpenRequest
(
con
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
0
);
req
=
WinHttpOpenRequest
(
con
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
0
);
ok
(
req
!=
NULL
,
"failed to open a request %u
\n
"
,
GetLastError
());
err
=
GetLastError
();
ok
(
req
!=
NULL
,
"failed to open a request %u
\n
"
,
err
);
ok
(
err
==
ERROR_SUCCESS
,
"got %u
\n
"
,
err
);
setup_test
(
&
info
,
winhttp_send_request
,
__LINE__
);
setup_test
(
&
info
,
winhttp_send_request
,
__LINE__
);
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
,
0
,
0
);
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
)
{
{
skip
(
"connection failed, skipping
\n
"
);
skip
(
"connection failed, skipping
\n
"
);
WinHttpCloseHandle
(
req
);
WinHttpCloseHandle
(
req
);
...
@@ -519,30 +533,43 @@ static void test_async( void )
...
@@ -519,30 +533,43 @@ static void test_async( void )
CloseHandle
(
info
.
wait
);
CloseHandle
(
info
.
wait
);
return
;
return
;
}
}
ok
(
ret
,
"failed to send request %u
\n
"
,
GetLastError
());
ok
(
ret
,
"failed to send request %u
\n
"
,
err
);
ok
(
err
==
ERROR_SUCCESS
,
"got %u
\n
"
,
err
);
WaitForSingleObject
(
info
.
wait
,
INFINITE
);
WaitForSingleObject
(
info
.
wait
,
INFINITE
);
setup_test
(
&
info
,
winhttp_receive_response
,
__LINE__
);
setup_test
(
&
info
,
winhttp_receive_response
,
__LINE__
);
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpReceiveResponse
(
req
,
NULL
);
ret
=
WinHttpReceiveResponse
(
req
,
NULL
);
ok
(
ret
,
"failed to receive response %u
\n
"
,
GetLastError
());
err
=
GetLastError
();
ok
(
ret
,
"failed to receive response %u
\n
"
,
err
);
ok
(
err
==
ERROR_SUCCESS
,
"got %u
\n
"
,
err
);
WaitForSingleObject
(
info
.
wait
,
INFINITE
);
WaitForSingleObject
(
info
.
wait
,
INFINITE
);
size
=
sizeof
(
status
);
size
=
sizeof
(
status
);
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpQueryHeaders
(
req
,
WINHTTP_QUERY_STATUS_CODE
|
WINHTTP_QUERY_FLAG_NUMBER
,
NULL
,
&
status
,
&
size
,
NULL
);
ret
=
WinHttpQueryHeaders
(
req
,
WINHTTP_QUERY_STATUS_CODE
|
WINHTTP_QUERY_FLAG_NUMBER
,
NULL
,
&
status
,
&
size
,
NULL
);
ok
(
ret
,
"failed unexpectedly %u
\n
"
,
GetLastError
());
err
=
GetLastError
();
ok
(
ret
,
"failed unexpectedly %u
\n
"
,
err
);
ok
(
status
==
200
,
"request failed unexpectedly %u
\n
"
,
status
);
ok
(
status
==
200
,
"request failed unexpectedly %u
\n
"
,
status
);
ok
(
err
==
ERROR_SUCCESS
||
broken
(
err
==
0xdeadbeef
)
/* < win7 */
,
"got %u
\n
"
,
err
);
setup_test
(
&
info
,
winhttp_query_data
,
__LINE__
);
setup_test
(
&
info
,
winhttp_query_data
,
__LINE__
);
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpQueryDataAvailable
(
req
,
NULL
);
ret
=
WinHttpQueryDataAvailable
(
req
,
NULL
);
ok
(
ret
,
"failed to query data available %u
\n
"
,
GetLastError
());
err
=
GetLastError
();
ok
(
ret
,
"failed to query data available %u
\n
"
,
err
);
ok
(
err
==
ERROR_SUCCESS
||
err
==
ERROR_IO_PENDING
||
broken
(
err
==
0xdeadbeef
)
/* < win7 */
,
"got %u
\n
"
,
err
);
WaitForSingleObject
(
info
.
wait
,
INFINITE
);
WaitForSingleObject
(
info
.
wait
,
INFINITE
);
setup_test
(
&
info
,
winhttp_read_data
,
__LINE__
);
setup_test
(
&
info
,
winhttp_read_data
,
__LINE__
);
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpReadData
(
req
,
buffer
,
sizeof
(
buffer
),
NULL
);
ret
=
WinHttpReadData
(
req
,
buffer
,
sizeof
(
buffer
),
NULL
);
ok
(
ret
,
"failed to query data available %u
\n
"
,
GetLastError
());
err
=
GetLastError
();
ok
(
ret
,
"failed to read data %u
\n
"
,
err
);
ok
(
err
==
ERROR_SUCCESS
,
"got %u
\n
"
,
err
);
WaitForSingleObject
(
info
.
wait
,
INFINITE
);
WaitForSingleObject
(
info
.
wait
,
INFINITE
);
...
...
dlls/winhttp/tests/url.c
View file @
1def0982
...
@@ -169,11 +169,14 @@ static void WinHttpCreateUrl_test( void )
...
@@ -169,11 +169,14 @@ static void WinHttpCreateUrl_test( void )
ok
(
len
==
57
,
"expected len 57 got %u
\n
"
,
len
);
ok
(
len
==
57
,
"expected len 57 got %u
\n
"
,
len
);
/* allocated url, NULL scheme */
/* allocated url, NULL scheme */
SetLastError
(
0xdeadbeef
);
uc
.
lpszScheme
=
NULL
;
uc
.
lpszScheme
=
NULL
;
url
[
0
]
=
0
;
url
[
0
]
=
0
;
len
=
256
;
len
=
256
;
ret
=
WinHttpCreateUrl
(
&
uc
,
0
,
url
,
&
len
);
ret
=
WinHttpCreateUrl
(
&
uc
,
0
,
url
,
&
len
);
ok
(
ret
,
"expected success
\n
"
);
ok
(
ret
,
"expected success
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
||
broken
(
GetLastError
()
==
0xdeadbeef
)
/* < win7 */
,
"expected ERROR_SUCCESS got %u
\n
"
,
GetLastError
()
);
ok
(
len
==
56
,
"expected len 56 got %u
\n
"
,
len
);
ok
(
len
==
56
,
"expected len 56 got %u
\n
"
,
len
);
ok
(
!
lstrcmpW
(
url
,
url1
),
"url doesn't match
\n
"
);
ok
(
!
lstrcmpW
(
url
,
url1
),
"url doesn't match
\n
"
);
...
@@ -380,9 +383,13 @@ static void WinHttpCrackUrl_test( void )
...
@@ -380,9 +383,13 @@ static void WinHttpCrackUrl_test( void )
/* no buffers */
/* no buffers */
reset_url_components
(
&
uc
);
reset_url_components
(
&
uc
);
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpCrackUrl
(
url_k1
,
0
,
0
,
&
uc
);
ret
=
WinHttpCrackUrl
(
url_k1
,
0
,
0
,
&
uc
);
error
=
GetLastError
();
ok
(
ret
,
"WinHttpCrackUrl failed le=%u
\n
"
,
GetLastError
()
);
ok
(
ret
,
"WinHttpCrackUrl failed le=%u
\n
"
,
error
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_INVALID_PARAMETER
)
/* < win7 */
,
"got %u, expected ERROR_SUCCESS
\n
"
,
error
);
ok
(
uc
.
nScheme
==
INTERNET_SCHEME_HTTP
,
"unexpected scheme
\n
"
);
ok
(
uc
.
nScheme
==
INTERNET_SCHEME_HTTP
,
"unexpected scheme
\n
"
);
ok
(
uc
.
lpszScheme
==
url_k1
,
"unexpected scheme
\n
"
);
ok
(
uc
.
lpszScheme
==
url_k1
,
"unexpected scheme
\n
"
);
ok
(
uc
.
dwSchemeLength
==
4
,
"unexpected scheme length
\n
"
);
ok
(
uc
.
dwSchemeLength
==
4
,
"unexpected scheme length
\n
"
);
...
...
dlls/winhttp/tests/winhttp.c
View file @
1def0982
This diff is collapsed.
Click to expand it.
dlls/winhttp/url.c
View file @
1def0982
...
@@ -304,6 +304,7 @@ exit:
...
@@ -304,6 +304,7 @@ exit:
if
(
ret
)
uc
->
nScheme
=
scheme
;
if
(
ret
)
uc
->
nScheme
=
scheme
;
heap_free
(
url_decoded
);
heap_free
(
url_decoded
);
heap_free
(
url_escaped
);
heap_free
(
url_escaped
);
if
(
ret
)
set_last_error
(
ERROR_SUCCESS
);
return
ret
;
return
ret
;
}
}
...
@@ -522,5 +523,6 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
...
@@ -522,5 +523,6 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
}
}
}
}
*
url
=
0
;
*
url
=
0
;
set_last_error
(
ERROR_SUCCESS
);
return
TRUE
;
return
TRUE
;
}
}
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