Module: wine Branch: master Commit: 64d69b55f95303a10c439062b634eaf5583aa1ef URL: http://source.winehq.org/git/wine.git/?a=commit;h=64d69b55f95303a10c439062b6...
Author: Juan Lang juan.lang@gmail.com Date: Tue Jul 21 13:52:22 2009 -0700
winhttp: Store send and receive timeouts in request_t, and only set them in a netconn_t if it's connected.
---
dlls/winhttp/session.c | 15 +++++++++++++-- dlls/winhttp/winhttp_private.h | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index 683a6fb..81113e4 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -33,6 +33,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
+#define DEFAULT_SEND_TIMEOUT 30000 +#define DEFAULT_RECEIVE_TIMEOUT 30000 + void set_last_error( DWORD error ) { /* FIXME */ @@ -633,6 +636,8 @@ 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->send_timeout = DEFAULT_SEND_TIMEOUT; + request->recv_timeout = DEFAULT_RECEIVE_TIMEOUT;
if (!verb || !verb[0]) verb = getW; if (!(request->verb = strdupW( verb ))) goto end; @@ -1178,10 +1183,16 @@ BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int }
if (send < 0) send = 0; - if (netconn_set_timeout( &request->netconn, TRUE, send )) ret = FALSE; + request->send_timeout = send;
if (receive < 0) receive = 0; - if (netconn_set_timeout( &request->netconn, FALSE, receive )) ret = FALSE; + 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; + }
release_object( &request->hdr ); return ret; diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index 2431d7c..97c8f90 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -139,6 +139,8 @@ typedef struct LPWSTR version; LPWSTR raw_headers; netconn_t netconn; + int send_timeout; + int recv_timeout; LPWSTR status_text; DWORD content_length; /* total number of bytes to be read (per chunk) */ DWORD content_read; /* bytes read so far */