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
68039dca
Commit
68039dca
authored
Jul 23, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Jul 24, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Implement connect timeout.
parent
f18276fe
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
9 deletions
+43
-9
net.c
dlls/winhttp/net.c
+35
-6
request.c
dlls/winhttp/request.c
+1
-1
session.c
dlls/winhttp/session.c
+5
-1
winhttp_private.h
dlls/winhttp/winhttp_private.h
+2
-1
No files found.
dlls/winhttp/net.c
View file @
68039dca
...
...
@@ -287,15 +287,44 @@ BOOL netconn_close( netconn_t *conn )
return
TRUE
;
}
BOOL
netconn_connect
(
netconn_t
*
conn
,
const
struct
sockaddr
*
sockaddr
,
unsigned
int
addr_len
)
BOOL
netconn_connect
(
netconn_t
*
conn
,
const
struct
sockaddr
*
sockaddr
,
unsigned
int
addr_len
,
int
timeout
)
{
if
(
connect
(
conn
->
socket
,
sockaddr
,
addr_len
)
==
-
1
)
BOOL
ret
=
FALSE
;
int
res
=
0
,
state
;
if
(
timeout
>
0
)
{
WARN
(
"unable to connect to host (%s)
\n
"
,
strerror
(
errno
));
set_last_error
(
sock_get_error
(
errno
)
);
return
FALSE
;
state
=
1
;
ioctlsocket
(
conn
->
socket
,
FIONBIO
,
&
state
);
}
return
TRUE
;
if
(
connect
(
conn
->
socket
,
sockaddr
,
addr_len
)
<
0
)
{
res
=
sock_get_error
(
errno
);
if
(
res
==
WSAEWOULDBLOCK
||
res
==
WSAEINPROGRESS
)
{
struct
pollfd
pfd
;
pfd
.
fd
=
conn
->
socket
;
pfd
.
events
=
POLLOUT
;
if
(
poll
(
&
pfd
,
1
,
timeout
)
>
0
)
ret
=
TRUE
;
else
res
=
sock_get_error
(
errno
);
}
}
else
ret
=
TRUE
;
if
(
timeout
>
0
)
{
state
=
0
;
ioctlsocket
(
conn
->
socket
,
FIONBIO
,
&
state
);
}
if
(
!
ret
)
{
WARN
(
"unable to connect to host (%d)
\n
"
,
res
);
set_last_error
(
res
);
}
return
ret
;
}
BOOL
netconn_secure_connect
(
netconn_t
*
conn
)
...
...
dlls/winhttp/request.c
View file @
68039dca
...
...
@@ -925,7 +925,7 @@ static BOOL open_connection( request_t *request )
}
netconn_set_timeout
(
&
request
->
netconn
,
TRUE
,
request
->
send_timeout
);
netconn_set_timeout
(
&
request
->
netconn
,
FALSE
,
request
->
recv_timeout
);
if
(
!
netconn_connect
(
&
request
->
netconn
,
(
struct
sockaddr
*
)
&
connect
->
sockaddr
,
slen
))
if
(
!
netconn_connect
(
&
request
->
netconn
,
(
struct
sockaddr
*
)
&
connect
->
sockaddr
,
slen
,
request
->
connect_timeout
))
{
netconn_close
(
&
request
->
netconn
);
heap_free
(
addressW
);
...
...
dlls/winhttp/session.c
View file @
68039dca
...
...
@@ -33,6 +33,7 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
winhttp
);
#define DEFAULT_CONNECT_TIMEOUT 60000
#define DEFAULT_SEND_TIMEOUT 30000
#define DEFAULT_RECEIVE_TIMEOUT 30000
...
...
@@ -636,6 +637,7 @@ 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
;
...
...
@@ -1167,7 +1169,7 @@ BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int
return
FALSE
;
}
FIXME
(
"resolve
and connect
timeout not supported
\n
"
);
FIXME
(
"resolve timeout not supported
\n
"
);
if
(
!
(
request
=
(
request_t
*
)
grab_object
(
handle
)))
{
...
...
@@ -1182,6 +1184,8 @@ BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int
return
FALSE
;
}
request
->
connect_timeout
=
connect
;
if
(
send
<
0
)
send
=
0
;
request
->
send_timeout
=
send
;
...
...
dlls/winhttp/winhttp_private.h
View file @
68039dca
...
...
@@ -139,6 +139,7 @@ typedef struct
LPWSTR
version
;
LPWSTR
raw_headers
;
netconn_t
netconn
;
int
connect_timeout
;
int
send_timeout
;
int
recv_timeout
;
LPWSTR
status_text
;
...
...
@@ -206,7 +207,7 @@ void send_callback( object_header_t *, DWORD, LPVOID, DWORD );
void
close_connection
(
request_t
*
);
BOOL
netconn_close
(
netconn_t
*
);
BOOL
netconn_connect
(
netconn_t
*
,
const
struct
sockaddr
*
,
unsigned
int
);
BOOL
netconn_connect
(
netconn_t
*
,
const
struct
sockaddr
*
,
unsigned
int
,
int
);
BOOL
netconn_connected
(
netconn_t
*
);
BOOL
netconn_create
(
netconn_t
*
,
int
,
int
,
int
);
BOOL
netconn_get_next_line
(
netconn_t
*
,
char
*
,
DWORD
*
);
...
...
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