Hans Leidekker : winhttp: Implement WinHttpSetTimeouts.

Alexandre Julliard julliard at winehq.org
Tue Jul 7 08:08:17 CDT 2009


Module: wine
Branch: master
Commit: 9d9c505a273edbb79ce7dc60a324d2bbf6a2bdab
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9d9c505a273edbb79ce7dc60a324d2bbf6a2bdab

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Jul  7 10:14:11 2009 +0200

winhttp: Implement WinHttpSetTimeouts.

---

 dlls/winhttp/session.c         |   36 ++++++++++++++++++++++++++++++++++--
 dlls/winhttp/winhttp_private.h |    1 +
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c
index 11c4b4f..55f9779 100644
--- a/dlls/winhttp/session.c
+++ b/dlls/winhttp/session.c
@@ -737,8 +737,40 @@ WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback( HINTERNET handle, WINHT
  */
 BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int send, int receive )
 {
-    FIXME("%p, %d, %d, %d, %d\n", handle, resolve, connect, send, receive);
-    return TRUE;
+    BOOL ret = TRUE;
+    request_t *request;
+
+    TRACE("%p, %d, %d, %d, %d\n", handle, resolve, connect, send, receive);
+
+    if (resolve < -1 || connect < -1 || send < -1 || receive < -1)
+    {
+        set_last_error( ERROR_INVALID_PARAMETER );
+        return FALSE;
+    }
+
+    FIXME("resolve and connect timeout not supported\n");
+
+    if (!(request = (request_t *)grab_object( handle )))
+    {
+        set_last_error( ERROR_INVALID_HANDLE );
+        return FALSE;
+    }
+
+    if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST)
+    {
+        release_object( &request->hdr );
+        set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE );
+        return FALSE;
+    }
+
+    if (send < 0) send = 0;
+    if (netconn_set_timeout( &request->netconn, TRUE, send )) ret = FALSE;
+
+    if (receive < 0) receive = 0;
+    if (netconn_set_timeout( &request->netconn, FALSE, receive )) ret = FALSE;
+
+    release_object( &request->hdr );
+    return ret;
 }
 
 static const WCHAR wkday[7][4] =
diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h
index 511e124..823d0ae 100644
--- a/dlls/winhttp/winhttp_private.h
+++ b/dlls/winhttp/winhttp_private.h
@@ -214,6 +214,7 @@ BOOL netconn_recv( netconn_t *, void *, size_t, int, int * );
 BOOL netconn_resolve( WCHAR *, INTERNET_PORT, struct sockaddr_in * );
 BOOL netconn_secure_connect( netconn_t * );
 BOOL netconn_send( netconn_t *, const void *, size_t, int, int * );
+DWORD netconn_set_timeout( netconn_t *, BOOL, int );
 const void *netconn_get_certificate( netconn_t * );
 
 BOOL set_cookies( request_t *, const WCHAR * );




More information about the wine-cvs mailing list