Cairo-based Windows port does not handle the https protocol.
authorbfulgham@webkit.org <bfulgham@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Aug 2009 23:09:04 +0000 (23:09 +0000)
committerbfulgham@webkit.org <bfulgham@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Aug 2009 23:09:04 +0000 (23:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=28171.

Reviewed by Adam Roben.

No new tests needed.  Existing https tests show this failure
for WinCairo builds.

* WebCore.vcproj/WebCoreCURL.vsprops: Add a few preprocessor
  definitions for SSL support in cURL.
* platform/network/curl/ResourceHandleManager.h: Add new
  certificate path member variable.
* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::certificateBundlePath): New method to retrieve the
  proper certificate resource bundle path.
(WebCore::ResourceHandleManager::initializeHandle): Check for
  the resource bundle and use if available to activate SSL
  support.

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

WebCore/ChangeLog
WebCore/WebCore.vcproj/WebCoreCURL.vsprops
WebCore/platform/network/curl/ResourceHandleManager.cpp
WebCore/platform/network/curl/ResourceHandleManager.h

index ed97c15..7a0fd8a 100644 (file)
@@ -1,3 +1,24 @@
+2009-08-10  Brent Fulgham  <bfulgham@webkit.org>
+
+        Reviewed by Adam Roben.
+
+        Cairo-based Windows port does not handle the https protocol.
+        https://bugs.webkit.org/show_bug.cgi?id=28171.
+
+        No new tests needed.  Existing https tests show this failure
+        for WinCairo builds.
+
+        * WebCore.vcproj/WebCoreCURL.vsprops: Add a few preprocessor
+          definitions for SSL support in cURL.
+        * platform/network/curl/ResourceHandleManager.h: Add new
+          certificate path member variable.
+        * platform/network/curl/ResourceHandleManager.cpp:
+        (WebCore::certificateBundlePath): New method to retrieve the
+          proper certificate resource bundle path.
+        (WebCore::ResourceHandleManager::initializeHandle): Check for
+          the resource bundle and use if available to activate SSL
+          support.
+
 2009-08-11  Maxime Simon  <simon.maxime@gmail.com>
 
         Reviewed by Eric Seidel.
index aaadb97..4320e05 100644 (file)
@@ -7,5 +7,6 @@
        <Tool\r
                Name="VCCLCompilerTool"\r
                AdditionalIncludeDirectories="$(ProjectDir)..\platform\network\curl"\r
+               PreprocessorDefinitions="USE_WINDOWS_SSPI;USE_SSLEAY;HAVE_ZLIB"\r
        />\r
 </VisualStudioPropertySheet>\r
index 2aa286a..75d44a5 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2007 Holger Hans Peter Freyther
  * Copyright (C) 2008 Collabora Ltd.
  * Copyright (C) 2008 Nuanti Ltd.
+ * Copyright (C) 2009 Appcelerator Inc.
+ * Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -54,10 +56,25 @@ const int maxRunningJobs = 5;
 
 static const bool ignoreSSLErrors = getenv("WEBKIT_IGNORE_SSL_ERRORS");
 
+static CString certificatePath()
+{
+#if PLATFORM(CF)
+    CFBundleRef webKitBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit"));
+    RetainPtr<CFURLRef> certURLRef(AdoptCF, CFBundleCopyResourceURL(webKitBundle, CFSTR("cacert"), CFSTR("pem"), CFSTR("certificates")));
+    if (certURLRef) {
+        char path[MAX_PATH];
+        CFURLGetFileSystemRepresentation(certURLRef.get(), false, reinterpret_cast<UInt8*>(path), MAX_PATH);
+        return path;
+    }
+#endif
+    return getenv("CURL_CA_BUNDLE_PATH");
+}
+
 ResourceHandleManager::ResourceHandleManager()
     : m_downloadTimer(this, &ResourceHandleManager::downloadTimerCallback)
     , m_cookieJarFileName(0)
     , m_runningJobs(0)
+    , m_certificatePath (certificatePath())
 {
     curl_global_init(CURL_GLOBAL_ALL);
     m_curlMultiHandle = curl_multi_init();
@@ -629,6 +646,10 @@ void ResourceHandleManager::initializeHandle(ResourceHandle* job)
     // and/or reporting SSL errors to the user.
     if (ignoreSSLErrors)
         curl_easy_setopt(d->m_handle, CURLOPT_SSL_VERIFYPEER, false);
+
+    if (!m_certificatePath.isNull())
+       curl_easy_setopt(d->m_handle, CURLOPT_CAINFO, m_certificatePath.data());
+
     // enable gzip and deflate through Accept-Encoding:
     curl_easy_setopt(d->m_handle, CURLOPT_ENCODING, "");
 
index d38e577..89b27d7 100644 (file)
@@ -29,6 +29,7 @@
 #define ResourceHandleManager_h
 
 #include "Frame.h"
+#include "CString.h"
 #include "Timer.h"
 #include "ResourceHandleClient.h"
 
@@ -71,6 +72,7 @@ private:
     char* m_cookieJarFileName;
     char m_curlErrorBuffer[CURL_ERROR_SIZE];
     Vector<ResourceHandle*> m_resourceHandleList;
+    const CString m_certificatePath;
     int m_runningJobs;
 };