Title: [221625] trunk/Source/WebKit
Revision
221625
Author
commit-qu...@webkit.org
Date
2017-09-05 11:08:14 -0700 (Tue, 05 Sep 2017)

Log Message

[WinCairo] Add Network Process files for wincairo webkit
https://bugs.webkit.org/show_bug.cgi?id=176069

Patch by Yousuke Kimoto <yousuke.kim...@sony.com> on 2017-09-05
Reviewed by Alex Christensen.

* NetworkProcess/Downloads/curl/DownloadCurl.cpp: Added.
(WebKit::Download::resume):
(WebKit::Download::platformDidFinish):
(WebKit::Download::startNetworkLoadWithHandle):
(WebKit::Download::startNetworkLoad):
(WebKit::Download::platformInvalidate):
* NetworkProcess/EntryPoint/win/NetworkProcessMain.cpp: Added.
(main):
* NetworkProcess/curl/NetworkProcessCurl.cpp: Added.
(WebKit::NetworkProcess::platformInitializeNetworkProcess):
(WebKit::NetworkProcess::platformSetURLCacheSize):
(WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost):
(WebKit::NetworkProcess::clearCacheForAllOrigins):
(WebKit::NetworkProcess::clearDiskCache):
(WebKit::NetworkProcess::platformTerminate):
* NetworkProcess/curl/RemoteNetworkingContextCurl.cpp: Added.
(WebKit::RemoteNetworkingContext::~RemoteNetworkingContext):
(WebKit::RemoteNetworkingContext::isValid const):
(WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
(WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
(WebKit::RemoteNetworkingContext::storageSession const):
(WebKit::RemoteNetworkingContext::blockedError const):
* NetworkProcess/win/NetworkProcessMainWin.cpp: Added.
(WebKit::NetworkProcessMainWin):
* NetworkProcess/win/NetworkProcessMainWin.h: Added.
* NetworkProcess/win/SystemProxyWin.cpp: Added.
(WindowsSystemProxy::getSystemHttpProxy):
(WindowsSystemProxy::setCurlHttpProxy):
(WindowsSystemProxy::parseProxyString):
* NetworkProcess/win/SystemProxyWin.h: Added.
* PlatformWin.cmake:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (221624 => 221625)


--- trunk/Source/WebKit/ChangeLog	2017-09-05 17:52:51 UTC (rev 221624)
+++ trunk/Source/WebKit/ChangeLog	2017-09-05 18:08:14 UTC (rev 221625)
@@ -1,3 +1,42 @@
+2017-09-05  Yousuke Kimoto  <yousuke.kim...@sony.com>
+
+        [WinCairo] Add Network Process files for wincairo webkit
+        https://bugs.webkit.org/show_bug.cgi?id=176069
+
+        Reviewed by Alex Christensen.
+
+        * NetworkProcess/Downloads/curl/DownloadCurl.cpp: Added.
+        (WebKit::Download::resume):
+        (WebKit::Download::platformDidFinish):
+        (WebKit::Download::startNetworkLoadWithHandle):
+        (WebKit::Download::startNetworkLoad):
+        (WebKit::Download::platformInvalidate):
+        * NetworkProcess/EntryPoint/win/NetworkProcessMain.cpp: Added.
+        (main):
+        * NetworkProcess/curl/NetworkProcessCurl.cpp: Added.
+        (WebKit::NetworkProcess::platformInitializeNetworkProcess):
+        (WebKit::NetworkProcess::platformSetURLCacheSize):
+        (WebKit::NetworkProcess::allowSpecificHTTPSCertificateForHost):
+        (WebKit::NetworkProcess::clearCacheForAllOrigins):
+        (WebKit::NetworkProcess::clearDiskCache):
+        (WebKit::NetworkProcess::platformTerminate):
+        * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp: Added.
+        (WebKit::RemoteNetworkingContext::~RemoteNetworkingContext):
+        (WebKit::RemoteNetworkingContext::isValid const):
+        (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
+        (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
+        (WebKit::RemoteNetworkingContext::storageSession const):
+        (WebKit::RemoteNetworkingContext::blockedError const):
+        * NetworkProcess/win/NetworkProcessMainWin.cpp: Added.
+        (WebKit::NetworkProcessMainWin):
+        * NetworkProcess/win/NetworkProcessMainWin.h: Added.
+        * NetworkProcess/win/SystemProxyWin.cpp: Added.
+        (WindowsSystemProxy::getSystemHttpProxy):
+        (WindowsSystemProxy::setCurlHttpProxy):
+        (WindowsSystemProxy::parseProxyString):
+        * NetworkProcess/win/SystemProxyWin.h: Added.
+        * PlatformWin.cmake:
+
 2017-09-05  Youenn Fablet  <you...@apple.com>
 
         Allow retrieving Cache Storage records for a given URL only

Added: trunk/Source/WebKit/NetworkProcess/Downloads/curl/DownloadCurl.cpp (0 => 221625)


--- trunk/Source/WebKit/NetworkProcess/Downloads/curl/DownloadCurl.cpp	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/Downloads/curl/DownloadCurl.cpp	2017-09-05 18:08:14 UTC (rev 221625)
@@ -0,0 +1,66 @@
+/*
+* Copyright (C) 2017 Sony Interactive Entertainment Inc.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+* THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "config.h"
+#include "Download.h"
+
+#if !USE(NETWORK_SESSION)
+
+#include "DataReference.h"
+#include "WebPage.h"
+#include <WebCore/NotImplemented.h>
+#include <WebCore/ResourceHandle.h>
+#include <WebCore/ResourceHandleClient.h>
+#include <WebCore/ResourceResponse.h>
+
+namespace WebKit {
+
+void Download::resume(const IPC::DataReference&, const String&, const SandboxExtension::Handle&)
+{
+    notImplemented();
+}
+
+void Download::platformDidFinish()
+{
+    notImplemented();
+}
+
+void Download::startNetworkLoadWithHandle(WebCore::ResourceHandle*, const WebCore::ResourceResponse&)
+{
+    notImplemented();
+}
+
+void Download::startNetworkLoad()
+{
+    notImplemented();
+}
+
+void Download::platformInvalidate()
+{
+    notImplemented();
+}
+
+}
+#endif

Added: trunk/Source/WebKit/NetworkProcess/EntryPoint/win/NetworkProcessMain.cpp (0 => 221625)


--- trunk/Source/WebKit/NetworkProcess/EntryPoint/win/NetworkProcessMain.cpp	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/EntryPoint/win/NetworkProcessMain.cpp	2017-09-05 18:08:14 UTC (rev 221625)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2017 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "NetworkProcessMainWin.h"
+
+#include <stdio.h>
+#include <windows.h>
+
+int main(int argc, char** argv)
+{
+    WebKit::NetworkProcessMainWin(argc, argv);
+}

Added: trunk/Source/WebKit/NetworkProcess/curl/NetworkProcessCurl.cpp (0 => 221625)


--- trunk/Source/WebKit/NetworkProcess/curl/NetworkProcessCurl.cpp	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/curl/NetworkProcessCurl.cpp	2017-09-05 18:08:14 UTC (rev 221625)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2017 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NetworkProcess.h"
+
+#include "NetworkCache.h"
+#include "NetworkProcessCreationParameters.h"
+#include "ResourceCachesToClear.h"
+#include "WebCookieManager.h"
+#include <WebCore/CertificateInfo.h>
+#include <WebCore/FileSystem.h>
+#include <WebCore/NetworkStorageSession.h>
+#include <WebCore/NotImplemented.h>
+#include <WebCore/ResourceHandle.h>
+#include <wtf/RAMSize.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void NetworkProcess::platformInitializeNetworkProcess(const NetworkProcessCreationParameters& parameters)
+{
+    notImplemented();
+}
+
+void NetworkProcess::platformSetURLCacheSize(unsigned, uint64_t)
+{
+    notImplemented();
+}
+
+void NetworkProcess::allowSpecificHTTPSCertificateForHost(const CertificateInfo& certificateInfo, const String& host)
+{
+    notImplemented();
+}
+
+void NetworkProcess::clearCacheForAllOrigins(uint32_t cachesToClear)
+{
+    notImplemented();
+}
+
+void NetworkProcess::clearDiskCache(std::chrono::system_clock::time_point, Function<void()>&&)
+{
+    notImplemented();
+}
+
+void NetworkProcess::platformTerminate()
+{
+    notImplemented();
+}
+
+} // namespace WebKit

Added: trunk/Source/WebKit/NetworkProcess/curl/RemoteNetworkingContextCurl.cpp (0 => 221625)


--- trunk/Source/WebKit/NetworkProcess/curl/RemoteNetworkingContextCurl.cpp	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/curl/RemoteNetworkingContextCurl.cpp	2017-09-05 18:08:14 UTC (rev 221625)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2017 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RemoteNetworkingContext.h"
+
+#include "NetworkSession.h"
+#include "SessionTracker.h"
+#include "WebsiteDataStoreParameters.h"
+#include <WebCore/NetworkStorageSession.h>
+#include <WebCore/NotImplemented.h>
+#include <WebCore/ResourceError.h>
+#include <WebCore/ResourceHandle.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+RemoteNetworkingContext::~RemoteNetworkingContext()
+{
+}
+
+bool RemoteNetworkingContext::isValid() const
+{
+    return true;
+}
+
+void RemoteNetworkingContext::ensurePrivateBrowsingSession(WebsiteDataStoreParameters&&)
+{
+    notImplemented();
+}
+
+void RemoteNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStoreParameters&&)
+{
+    notImplemented();
+}
+
+NetworkStorageSession& RemoteNetworkingContext::storageSession() const
+{
+    return NetworkStorageSession::defaultStorageSession();
+}
+
+ResourceError RemoteNetworkingContext::blockedError(const ResourceRequest& request) const
+{
+    return ResourceError();
+}
+
+}

Added: trunk/Source/WebKit/NetworkProcess/win/NetworkProcessMainWin.cpp (0 => 221625)


--- trunk/Source/WebKit/NetworkProcess/win/NetworkProcessMainWin.cpp	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/win/NetworkProcessMainWin.cpp	2017-09-05 18:08:14 UTC (rev 221625)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NetworkProcessMainWin.h"
+
+#include "ChildProcessMain.h"
+#include "NetworkProcess.h"
+
+namespace WebKit {
+
+int NetworkProcessMainWin(int argc, char** argv)
+{
+    return ChildProcessMain<NetworkProcess, ChildProcessMainBase>(argc, argv);
+}
+
+} // namespace WebKit

Added: trunk/Source/WebKit/NetworkProcess/win/NetworkProcessMainWin.h (0 => 221625)


--- trunk/Source/WebKit/NetworkProcess/win/NetworkProcessMainWin.h	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/win/NetworkProcessMainWin.h	2017-09-05 18:08:14 UTC (rev 221625)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2017 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <WebKit/WKBase.h>
+
+namespace WebKit {
+
+extern "C" {
+WK_EXPORT int NetworkProcessMainWin(int argc, char** argv);
+}
+
+} // namespace WebKit

Added: trunk/Source/WebKit/NetworkProcess/win/SystemProxyWin.cpp (0 => 221625)


--- trunk/Source/WebKit/NetworkProcess/win/SystemProxyWin.cpp	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/win/SystemProxyWin.cpp	2017-09-05 18:08:14 UTC (rev 221625)
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2017 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SystemProxyWin.h"
+
+#include <WebCore/CurlContext.h>
+
+bool WindowsSystemProxy::getSystemHttpProxy(char* buffer, int bufferLen, int* port)
+{
+    std::unique_ptr<TCHAR[]> tRegBuffer = std::make_unique<TCHAR[]>(bufferLen);
+    std::unique_ptr<TCHAR[]> tHost = std::make_unique<TCHAR[]>(bufferLen);
+    if (!tRegBuffer || !tHost)
+        return false;
+    DWORD type;
+    DWORD size;
+    HKEY key;
+
+    LONG ret = RegOpenKeyEx(HKEY_CURRENT_USER,
+        L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
+        0,
+        KEY_READ,
+        &key);
+    if (ret != ERROR_SUCCESS)
+        return false;
+
+    size = bufferLen - 1;
+    ret = RegQueryValueEx(key,
+        L"ProxyServer",
+        nullptr,
+        &type,
+        (LPBYTE)tRegBuffer.get(),
+        &size);
+
+    if (ret != ERROR_SUCCESS)
+        return false;
+
+    if (!parseProxyString(tRegBuffer.get(), tHost.get(), bufferLen, port))
+        return false;
+
+    wcstombs(buffer, tHost.get(), bufferLen);
+    buffer[bufferLen-1] = '\0';
+    return true;
+}
+
+void WindowsSystemProxy::setCurlHttpProxy(char* proxy, int port)
+{
+    WebCore::CurlContext::singleton().setProxyInfo(proxy, port);
+}
+
+void WindowsSystemProxy::setCurlHttpProxy()
+{
+    char proxy[ProxyServerNameLength];
+    int port;
+    if (getSystemHttpProxy(proxy, ProxyServerNameLength, &port))
+        setCurlHttpProxy(proxy, port);
+}
+
+bool WindowsSystemProxy::parseProxyString(const TCHAR* regProxyString, TCHAR* hostString, int hostStringLen, int* port)
+{
+    const TCHAR* found = wcschr(regProxyString, L':');
+    if (!found)
+        return false;
+
+    int len = found - regProxyString;
+    if (len >= hostStringLen)
+        return false;
+
+    wcsncpy(hostString, regProxyString, hostStringLen);
+    hostString[len] = L'\0';
+
+    TCHAR* portStr = const_cast<TCHAR*>(found) + 1;
+    *port = _wtoi(portStr);
+
+    return true;
+}

Added: trunk/Source/WebKit/NetworkProcess/win/SystemProxyWin.h (0 => 221625)


--- trunk/Source/WebKit/NetworkProcess/win/SystemProxyWin.h	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/win/SystemProxyWin.h	2017-09-05 18:08:14 UTC (rev 221625)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2017 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+class WindowsSystemProxy {
+    static const int ProxyServerNameLength = 512;
+public:
+    static bool getSystemHttpProxy(char* buffer, int bufferLen, int* port);
+    static bool getSystemHttpsProxy(char* buffer, int bufferLen, int* port);
+    static bool getSystemFtpProxy(char* buffer, int bufferLen, int* port);
+
+    static void setCurlHttpProxy(char* proxy, int port);
+    static void setCurlHttpProxy();
+
+private:
+    static bool parseProxyString(const TCHAR* regProxyString, TCHAR* hostString, int hostStringLen, int* port);
+};

Modified: trunk/Source/WebKit/PlatformWin.cmake (221624 => 221625)


--- trunk/Source/WebKit/PlatformWin.cmake	2017-09-05 17:52:51 UTC (rev 221624)
+++ trunk/Source/WebKit/PlatformWin.cmake	2017-09-05 18:08:14 UTC (rev 221625)
@@ -9,6 +9,13 @@
 add_definitions(-DBUILDING_WEBKIT)
 
 list(APPEND WebKit2_SOURCES
+    NetworkProcess/Downloads/curl/DownloadCurl.cpp
+
+    NetworkProcess/curl/NetworkProcessCurl.cpp
+    NetworkProcess/curl/RemoteNetworkingContextCurl.cpp
+
+    NetworkProcess/win/NetworkProcessMainWin.cpp
+    NetworkProcess/win/SystemProxyWin.cpp
 )
 
 # DerivedSources/_javascript_Core/inspector/InspectorBackendCommands.js is
@@ -56,6 +63,7 @@
 )
 
 list(APPEND NetworkProcess_SOURCES
+    NetworkProcess/EntryPoint/win/NetworkProcessMain.cpp
 )
 
 list(APPEND StorageProcess_SOURCES
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to