winhttp(9/12): Use proxy server when redirecting

Juan Lang juan.lang at gmail.com
Mon Jul 13 15:11:25 CDT 2009


--Juan
-------------- next part --------------
From c2c521e3b48abfce255197ad56e0b8da8bc4b339 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Mon, 13 Jul 2009 08:40:46 -0700
Subject: [PATCH 09/12] Use proxy server when redirecting

---
 dlls/winhttp/request.c         |    7 +++----
 dlls/winhttp/session.c         |    1 -
 dlls/winhttp/winhttp_private.h |    1 +
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 37dd556..85e9b61 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -1158,13 +1158,12 @@ static BOOL handle_redirect( request_t *request )
         hostname[len] = 0;
 
         port = uc.nPort ? uc.nPort : (uc.nScheme == INTERNET_SCHEME_HTTPS ? 443 : 80);
-        if (strcmpiW( connect->servername, hostname ) || connect->serverport != port)
+        if (strcmpiW( connect->hostname, hostname ) || connect->serverport != port)
         {
             heap_free( connect->hostname );
             connect->hostname = hostname;
-            heap_free( connect->servername );
-            connect->servername = strdupW( connect->hostname );
-            connect->serverport = connect->hostport = port;
+            connect->hostport = port;
+            if (!(ret = set_server_for_hostname( connect, hostname, port ))) goto end;
 
             netconn_close( &request->netconn );
             if (!(ret = netconn_init( &request->netconn, request->hdr.flags & WINHTTP_FLAG_SECURE ))) goto end;
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c
index cf79dd1..035fe64 100644
--- a/dlls/winhttp/session.c
+++ b/dlls/winhttp/session.c
@@ -316,7 +316,6 @@ static BOOL should_bypass_proxy(session_t *session, LPCWSTR server)
     return ret;
 }
 
-static
 BOOL set_server_for_hostname( connect_t *connect, LPCWSTR server, INTERNET_PORT port )
 {
     session_t *session = connect->session;
diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h
index 2143953..2431d7c 100644
--- a/dlls/winhttp/winhttp_private.h
+++ b/dlls/winhttp/winhttp_private.h
@@ -221,6 +221,7 @@ BOOL set_cookies( request_t *, const WCHAR * );
 BOOL add_cookie_headers( request_t * );
 BOOL add_request_headers( request_t *, LPCWSTR, DWORD, DWORD );
 void delete_domain( domain_t * );
+BOOL set_server_for_hostname( connect_t *connect, LPCWSTR server, INTERNET_PORT port );
 
 static inline void *heap_alloc( SIZE_T size )
 {
-- 
1.6.3.2


More information about the wine-patches mailing list