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
d0983e9e
Commit
d0983e9e
authored
Jan 29, 2010
by
Matijn Woudt
Committed by
Alexandre Julliard
Jan 29, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Add timeout for session handles and implement for WinHttpSetTimeouts.
parent
a09e659a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
23 deletions
+46
-23
session.c
dlls/winhttp/session.c
+40
-20
winhttp.c
dlls/winhttp/tests/winhttp.c
+3
-3
winhttp_private.h
dlls/winhttp/winhttp_private.h
+3
-0
No files found.
dlls/winhttp/session.c
View file @
d0983e9e
...
...
@@ -173,6 +173,9 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWST
session
->
hdr
.
flags
=
flags
;
session
->
hdr
.
refs
=
1
;
session
->
hdr
.
redirect_policy
=
WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP
;
session
->
connect_timeout
=
DEFAULT_CONNECT_TIMEOUT
;
session
->
send_timeout
=
DEFAULT_SEND_TIMEOUT
;
session
->
recv_timeout
=
DEFAULT_RECEIVE_TIMEOUT
;
list_init
(
&
session
->
cookie_cache
);
if
(
agent
&&
!
(
session
->
agent
=
strdupW
(
agent
)))
goto
end
;
...
...
@@ -668,9 +671,9 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o
list_add_head
(
&
connect
->
hdr
.
children
,
&
request
->
hdr
.
entry
);
if
(
!
netconn_init
(
&
request
->
netconn
,
request
->
hdr
.
flags
&
WINHTTP_FLAG_SECURE
))
goto
end
;
request
->
connect_timeout
=
DEFAULT_CONNECT_TIMEOUT
;
request
->
send_timeout
=
DEFAULT_SEND_TIMEOUT
;
request
->
recv_timeout
=
DEFAULT_RECEIVE_TIMEOUT
;
request
->
connect_timeout
=
connect
->
session
->
connect_timeout
;
request
->
send_timeout
=
connect
->
session
->
send_timeout
;
request
->
recv_timeout
=
connect
->
session
->
recv_timeout
;
if
(
!
verb
||
!
verb
[
0
])
verb
=
getW
;
if
(
!
(
request
->
verb
=
strdupW
(
verb
)))
goto
end
;
...
...
@@ -1190,7 +1193,9 @@ WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback( HINTERNET handle, WINHT
BOOL
WINAPI
WinHttpSetTimeouts
(
HINTERNET
handle
,
int
resolve
,
int
connect
,
int
send
,
int
receive
)
{
BOOL
ret
=
TRUE
;
object_header_t
*
hdr
;
request_t
*
request
;
session_t
*
session
;
TRACE
(
"%p, %d, %d, %d, %d
\n
"
,
handle
,
resolve
,
connect
,
send
,
receive
);
...
...
@@ -1203,34 +1208,49 @@ BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int
if
(
resolve
>
0
)
FIXME
(
"resolve timeout (%d) not supported
\n
"
,
resolve
);
if
(
!
(
request
=
(
request_t
*
)
grab_object
(
handle
)))
if
(
!
(
hdr
=
grab_object
(
handle
)))
{
set_last_error
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
if
(
request
->
hdr
.
type
!=
WINHTTP_HANDLE_TYPE_REQUEST
)
switch
(
hdr
->
type
)
{
release_object
(
&
request
->
hdr
);
set_last_error
(
ERROR_WINHTTP_INCORRECT_HANDLE_TYPE
);
return
FALSE
;
}
case
WINHTTP_HANDLE_TYPE_REQUEST
:
request
=
(
request_t
*
)
hdr
;
request
->
connect_timeout
=
connect
;
request
->
connect_timeout
=
connect
;
if
(
send
<
0
)
send
=
0
;
request
->
send_timeout
=
send
;
if
(
send
<
0
)
send
=
0
;
request
->
send_timeout
=
send
;
if
(
receive
<
0
)
receive
=
0
;
request
->
recv_timeout
=
receive
;
if
(
receive
<
0
)
receive
=
0
;
request
->
recv_timeout
=
receive
;
if
(
netconn_connected
(
&
request
->
netconn
))
{
if
(
netconn_set_timeout
(
&
request
->
netconn
,
TRUE
,
send
))
ret
=
FALSE
;
if
(
netconn_set_timeout
(
&
request
->
netconn
,
FALSE
,
receive
))
ret
=
FALSE
;
}
if
(
netconn_connected
(
&
request
->
netconn
))
{
if
(
netconn_set_timeout
(
&
request
->
netconn
,
TRUE
,
send
))
ret
=
FALSE
;
if
(
netconn_set_timeout
(
&
request
->
netconn
,
FALSE
,
receive
))
ret
=
FALSE
;
}
release_object
(
&
request
->
hdr
);
break
;
release_object
(
&
request
->
hdr
);
case
WINHTTP_HANDLE_TYPE_SESSION
:
session
=
(
session_t
*
)
hdr
;
session
->
connect_timeout
=
connect
;
if
(
send
<
0
)
send
=
0
;
session
->
send_timeout
=
send
;
if
(
receive
<
0
)
receive
=
0
;
session
->
recv_timeout
=
receive
;
break
;
default:
release_object
(
hdr
);
set_last_error
(
ERROR_WINHTTP_INCORRECT_HANDLE_TYPE
);
return
FALSE
;
}
return
ret
;
}
...
...
dlls/winhttp/tests/winhttp.c
View file @
d0983e9e
...
...
@@ -1064,15 +1064,15 @@ static void test_Timeouts (void)
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSetTimeouts
(
ses
,
-
1
,
-
1
,
-
1
,
-
1
);
todo_wine
ok
(
ret
,
"%u
\n
"
,
GetLastError
());
ok
(
ret
,
"%u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSetTimeouts
(
ses
,
0
,
0
,
0
,
0
);
todo_wine
ok
(
ret
,
"%u
\n
"
,
GetLastError
());
ok
(
ret
,
"%u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSetTimeouts
(
ses
,
0x0123
,
0x4567
,
0x89ab
,
0xcdef
);
todo_wine
ok
(
ret
,
"%u
\n
"
,
GetLastError
());
ok
(
ret
,
"%u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
value
=
0xdeadbeef
;
...
...
dlls/winhttp/winhttp_private.h
View file @
d0983e9e
...
...
@@ -96,6 +96,9 @@ typedef struct
object_header_t
hdr
;
LPWSTR
agent
;
DWORD
access
;
int
connect_timeout
;
int
send_timeout
;
int
recv_timeout
;
LPWSTR
proxy_server
;
LPWSTR
proxy_bypass
;
LPWSTR
proxy_username
;
...
...
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