Modified: trunk/Source/WebCore/ChangeLog (218522 => 218523)
--- trunk/Source/WebCore/ChangeLog 2017-06-20 01:23:34 UTC (rev 218522)
+++ trunk/Source/WebCore/ChangeLog 2017-06-20 01:47:00 UTC (rev 218523)
@@ -1,3 +1,19 @@
+2017-06-19 Daewoong Jang <daewoong.j...@navercorp.com>
+
+ [cURL] Move file scope static variables into function scopes
+ https://bugs.webkit.org/show_bug.cgi?id=173567
+
+ Reviewed by Alex Christensen.
+
+ * platform/network/curl/SSLHandle.cpp:
+ (WebCore::allowedHosts):
+ (WebCore::allowedClientHosts):
+ (WebCore::allowsAnyHTTPSCertificateHosts):
+ (WebCore::addAllowedClientCertificate):
+ (WebCore::setSSLClientCertificate):
+ (WebCore::sslIgnoreHTTPSCertificate):
+ (WebCore::certVerifyCallback):
+
2017-06-19 Darin Adler <da...@apple.com>
[Cocoa] implement URLSession:task:needNewBodyStream: delegate method
Modified: trunk/Source/WebCore/platform/network/curl/SSLHandle.cpp (218522 => 218523)
--- trunk/Source/WebCore/platform/network/curl/SSLHandle.cpp 2017-06-20 01:23:34 UTC (rev 218522)
+++ trunk/Source/WebCore/platform/network/curl/SSLHandle.cpp 2017-06-20 01:47:00 UTC (rev 218523)
@@ -35,31 +35,42 @@
#include <openssl/ssl.h>
#include <openssl/x509_vfy.h>
#include <wtf/ListHashSet.h>
+#include <wtf/NeverDestroyed.h>
#include <wtf/text/CString.h>
namespace WebCore {
typedef std::tuple<String, String> clientCertificate;
-static HashMap<String, ListHashSet<String>, ASCIICaseInsensitiveHash> allowedHosts;
-static HashMap<String, clientCertificate, ASCIICaseInsensitiveHash> allowedClientHosts;
+static HashMap<String, ListHashSet<String>, ASCIICaseInsensitiveHash>& allowedHosts()
+{
+ static NeverDestroyed<HashMap<String, ListHashSet<String>, ASCIICaseInsensitiveHash>> map;
+ return map;
+}
+
+static HashMap<String, clientCertificate, ASCIICaseInsensitiveHash>& allowedClientHosts()
+{
+ static NeverDestroyed<HashMap<String, clientCertificate, ASCIICaseInsensitiveHash>> map;
+ return map;
+}
+
void allowsAnyHTTPSCertificateHosts(const String& host)
{
ListHashSet<String> certificates;
- allowedHosts.set(host, certificates);
+ allowedHosts().set(host, certificates);
}
void addAllowedClientCertificate(const String& host, const String& certificate, const String& key)
{
clientCertificate clientInfo(certificate, key);
- allowedClientHosts.set(host, clientInfo);
+ allowedClientHosts().set(host, clientInfo);
}
void setSSLClientCertificate(ResourceHandle* handle)
{
String host = handle->firstRequest().url().host();
- auto it = allowedClientHosts.find(host);
- if (it == allowedClientHosts.end())
+ auto it = allowedClientHosts().find(host);
+ if (it == allowedClientHosts().end())
return;
ResourceHandleInternal* d = handle->getInternal();
@@ -71,8 +82,8 @@
bool sslIgnoreHTTPSCertificate(const String& host, const ListHashSet<String>& certificates)
{
- auto it = allowedHosts.find(host);
- if (it != allowedHosts.end()) {
+ auto it = allowedHosts().find(host);
+ if (it != allowedHosts().end()) {
if ((it->value).isEmpty()) {
it->value = certificates;
return true;
@@ -198,8 +209,8 @@
d->m_sslErrors = sslCertificateFlag(err);
#if PLATFORM(WIN)
- auto it = allowedHosts.find(host);
- ok = (it != allowedHosts.end());
+ auto it = allowedHosts().find(host);
+ ok = (it != allowedHosts().end());
#else
ListHashSet<String> certificates;
if (!pemData(ctx, certificates))