Hans Leidekker : wininet: Resolve hostname once per connection.

Alexandre Julliard julliard at winehq.org
Tue Jun 24 06:43:59 CDT 2008


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

Author: Hans Leidekker <hans at it.vu.nl>
Date:   Mon Jun 23 20:58:41 2008 +0200

wininet: Resolve hostname once per connection.

---

 dlls/wininet/http.c       |   13 +++----------
 dlls/wininet/tests/http.c |   18 ++++--------------
 2 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index ea2afb3..fdfd9da 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -1329,6 +1329,8 @@ static BOOL HTTP_ResolveName(LPWININETHTTPREQW lpwhr)
     char szaddr[32];
     LPWININETHTTPSESSIONW lpwhs = lpwhr->lpHttpSession;
 
+    if (lpwhs->socketAddress.sin_addr.s_addr) return TRUE;
+
     INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
                           INTERNET_STATUS_RESOLVING_NAME,
                           lpwhs->lpszServerName,
@@ -2016,16 +2018,6 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
                           INTERNET_STATUS_HANDLE_CREATED, &handle,
                           sizeof(handle));
 
-    /*
-     * A STATUS_REQUEST_COMPLETE is NOT sent here as per my tests on windows
-     */
-
-    if (!HTTP_ResolveName(lpwhr))
-    {
-        InternetCloseHandle( handle );
-        handle = NULL;
-    }
-
 lend:
     if( lpwhr )
         WININET_Release( &lpwhr->hdr );
@@ -3600,6 +3592,7 @@ static BOOL HTTP_OpenConnection(LPWININETHTTPREQW lpwhr)
         bSuccess = TRUE;
         goto lend;
     }
+    if (!HTTP_ResolveName(lpwhr)) goto lend;
 
     lpwhs = lpwhr->lpHttpSession;
 
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 9ad9790..dfe48c0 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -270,8 +270,6 @@ static void InternetReadFile_test(int flags)
 
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
-    SET_WINE_ALLOW(INTERNET_STATUS_RESOLVING_NAME);
-    SET_WINE_ALLOW(INTERNET_STATUS_NAME_RESOLVED);
 
     trace("HttpOpenRequestA <--\n");
     hor = HttpOpenRequestA(hic, "GET", "/about/", NULL, NULL, types,
@@ -297,11 +295,8 @@ static void InternetReadFile_test(int flags)
     ok(!strcmp(buffer, "http://www.winehq.org/about/"), "Wrong URL %s\n", buffer);
 
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
-    todo_wine
-    {
-        CHECK_NOT_NOTIFIED(INTERNET_STATUS_RESOLVING_NAME);
-        CHECK_NOT_NOTIFIED(INTERNET_STATUS_NAME_RESOLVED);
-    }
+    CHECK_NOT_NOTIFIED(INTERNET_STATUS_RESOLVING_NAME);
+    CHECK_NOT_NOTIFIED(INTERNET_STATUS_NAME_RESOLVED);
     if (first_connection_to_test_url)
     {
         SET_EXPECT(INTERNET_STATUS_RESOLVING_NAME);
@@ -516,8 +511,6 @@ static void InternetReadFileExA_test(int flags)
 
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
-    SET_WINE_ALLOW(INTERNET_STATUS_RESOLVING_NAME);
-    SET_WINE_ALLOW(INTERNET_STATUS_NAME_RESOLVED);
 
     trace("HttpOpenRequestA <--\n");
     hor = HttpOpenRequestA(hic, "GET", "/about/", NULL, NULL, types,
@@ -538,11 +531,8 @@ static void InternetReadFileExA_test(int flags)
     if (hor == 0x0) goto abort;
 
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
-    todo_wine
-    {
-        CHECK_NOT_NOTIFIED(INTERNET_STATUS_RESOLVING_NAME);
-        CHECK_NOT_NOTIFIED(INTERNET_STATUS_NAME_RESOLVED);
-    }
+    CHECK_NOT_NOTIFIED(INTERNET_STATUS_RESOLVING_NAME);
+    CHECK_NOT_NOTIFIED(INTERNET_STATUS_NAME_RESOLVED);
     if (first_connection_to_test_url)
     {
         SET_EXPECT(INTERNET_STATUS_RESOLVING_NAME);




More information about the wine-cvs mailing list