Reviewed & landed by Maciej.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Nov 2006 03:15:17 +0000 (03:15 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Nov 2006 03:15:17 +0000 (03:15 +0000)
        Fixes http://bugs.webkit.org/show_bug.cgi?id=11265

        * platform/win/ResourceLoaderWin.cpp:
        (WebCore::transferJobStatusCallback):
        (WebCore::ResourceLoader::start):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17608 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/network/win/ResourceHandleWin.cpp

index 730868b4643a330d5b440e7dca22755edd1e88d4..5a631eada5785a6d6c30cc07593d82a515af4c50 100644 (file)
@@ -1,3 +1,13 @@
+2006-11-05  MorganL  <morganl.webkit@yahoo.com>
+
+        Reviewed & landed by Maciej.
+
+        Fixes http://bugs.webkit.org/show_bug.cgi?id=11265
+
+        * platform/win/ResourceLoaderWin.cpp:
+        (WebCore::transferJobStatusCallback):
+        (WebCore::ResourceLoader::start):
+
 2006-11-04  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Oliver.
index 65345f041288ac5e4e693ddd3c9c606092f090a0..0456413e4afc53438af596f2994f5a972b5ad3fe 100644 (file)
@@ -152,7 +152,10 @@ void ResourceHandle::onHandleCreated(LPARAM lParam)
                                                    "POST", urlStr.latin1(), 0, 0, accept,
                                                    INTERNET_FLAG_KEEP_CONNECTION | 
                                                    INTERNET_FLAG_FORMS_SUBMIT |
-                                                   INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_CACHE_WRITE,
+                                                   INTERNET_FLAG_RELOAD |
+                                                   INTERNET_FLAG_NO_CACHE_WRITE |
+                                                   INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS |
+                                                   INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP,
                                                    (DWORD_PTR)d->m_jobId);
             if (urlHandle == INVALID_HANDLE_VALUE) {
                 InternetCloseHandle(d->m_resourceHandle);
@@ -258,7 +261,7 @@ void ResourceHandle::onRequestComplete(LPARAM lParam)
     if (d->m_secondaryHandle)
         InternetCloseHandle(d->m_secondaryHandle);
     InternetCloseHandle(d->m_resourceHandle);
-    
+
     client()->receivedAllData(this, &platformData);
     client()->didFinishLoading(this);
     delete this;
@@ -270,6 +273,13 @@ static void __stdcall transferJobStatusCallback(HINTERNET internetHandle,
                                                 LPVOID statusInformation,
                                                 DWORD statusInformationLength)
 {
+#ifdef RESOURCE_LOADER_DEBUG
+    char buf[64];
+    _snprintf(buf, sizeof(buf), "status-callback: status=%u, job=%p\n",
+              internetStatus, jobId);
+    OutputDebugStringA(buf);
+#endif
+
     UINT msg;
     LPARAM lParam;
 
@@ -280,6 +290,12 @@ static void __stdcall transferJobStatusCallback(HINTERNET internetHandle,
         lParam = (LPARAM) LPINTERNET_ASYNC_RESULT(statusInformation)->dwResult;
         break;
     case INTERNET_STATUS_REQUEST_COMPLETE:
+#ifdef RESOURCE_LOADER_DEBUG
+        _snprintf(buf, sizeof(buf), "request-complete: result=%p, error=%u\n",
+            LPINTERNET_ASYNC_RESULT(statusInformation)->dwResult,
+            LPINTERNET_ASYNC_RESULT(statusInformation)->dwError);
+        OutputDebugStringA(buf);
+#endif
         // tell the main thread that the request is done
         msg = requestCompleteMessage;
         lParam = 0;
@@ -335,21 +351,31 @@ bool ResourceHandle::start(DocLoader* docLoader)
             delete this;
             return false;
         }
-        static INTERNET_STATUS_CALLBACK callbackHandle = InternetSetStatusCallback(internetHandle, transferJobStatusCallback);
+        static INTERNET_STATUS_CALLBACK callbackHandle = 
+            InternetSetStatusCallback(internetHandle, transferJobStatusCallback);
 
         initializeOffScreenResourceHandleWindow();
         d->m_jobId = addToOutstandingJobs(this);
 
-        // For form posting, we can't use InternetOpenURL.  We have to use InternetConnect followed by
-        // HttpSendRequest.
+        DWORD flags =
+            INTERNET_FLAG_KEEP_CONNECTION |
+            INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS |
+            INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP;
+
+        // For form posting, we can't use InternetOpenURL.  We have to use
+        // InternetConnect followed by HttpSendRequest.
         HINTERNET urlHandle;
         String referrer = docLoader->frame()->referrer();
         if (method() == "POST") {
             d->m_postReferrer = referrer;
             DeprecatedString host = url().host();
             host += "\0";
-            urlHandle = InternetConnectA(internetHandle, host.ascii(), url().port(), 0, 0, 
-                                         INTERNET_SERVICE_HTTP, 0, (DWORD_PTR)d->m_jobId);
+            urlHandle = InternetConnectA(internetHandle, host.ascii(),
+                                         d->URL.port(),
+                                         NULL, // no username
+                                         NULL, // no password
+                                         INTERNET_SERVICE_HTTP,
+                                         flags, (DWORD_PTR)d->m_jobId);
         } else {
             DeprecatedString urlStr = url().url();
             int fragmentIndex = urlStr.find('#');
@@ -359,8 +385,9 @@ bool ResourceHandle::start(DocLoader* docLoader)
             if (!referrer.isEmpty())
                 headers += String("Referer: ") + referrer + "\r\n";
 
-            urlHandle = InternetOpenUrlA(internetHandle, urlStr.ascii(), headers.latin1(), headers.length(),
-                                         INTERNET_FLAG_KEEP_CONNECTION, (DWORD_PTR)d->m_jobId);
+            urlHandle = InternetOpenUrlA(internetHandle, urlStr.ascii(),
+                                         headers.latin1(), headers.length(),
+                                         flags, (DWORD_PTR)d->m_jobId);
         }
 
         if (urlHandle == INVALID_HANDLE_VALUE) {