<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[245468] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/245468">245468</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2019-05-17 10:22:40 -0700 (Fri, 17 May 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/245418">r245418</a>.
https://bugs.webkit.org/show_bug.cgi?id=197989

New API test causing crashes on Mojave testers (Requested by
ShawnRoberts on #webkit).

Reverted changeset:

"Add a unit test for client certificate authentication"
https://bugs.webkit.org/show_bug.cgi?id=197800
https://trac.webkit.org/changeset/245418</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfspicocoaSecuritySPIh">trunk/Source/WTF/wtf/spi/cocoa/SecuritySPI.h</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitSharedcfArgumentCodersCFcpp">trunk/Source/WebKit/Shared/cf/ArgumentCodersCF.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITCPServercpp">trunk/Tools/TestWebKitAPI/TCPServer.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITCPServerh">trunk/Tools/TestWebKitAPI/TCPServer.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaChallengemm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaPDFLinkReferrermm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PDFLinkReferrer.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaProxymm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Proxy.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaWKNavigationResponsemm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKNavigationResponse.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitCocoaWKWebsiteDatastoremm">trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (245467 => 245468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog       2019-05-17 16:39:09 UTC (rev 245467)
+++ trunk/Source/WTF/ChangeLog  2019-05-17 17:22:40 UTC (rev 245468)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2019-05-17  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r245418.
+        https://bugs.webkit.org/show_bug.cgi?id=197989
+
+        New API test causing crashes on Mojave testers (Requested by
+        ShawnRoberts on #webkit).
+
+        Reverted changeset:
+
+        "Add a unit test for client certificate authentication"
+        https://bugs.webkit.org/show_bug.cgi?id=197800
+        https://trac.webkit.org/changeset/245418
+
</ins><span class="cx"> 2019-05-16  Keith Miller  <keith_miller@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Wasm should cage the memory base pointers in structs
</span></span></pre></div>
<a id="trunkSourceWTFwtfspicocoaSecuritySPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/spi/cocoa/SecuritySPI.h (245467 => 245468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/spi/cocoa/SecuritySPI.h     2019-05-17 16:39:09 UTC (rev 245467)
+++ trunk/Source/WTF/wtf/spi/cocoa/SecuritySPI.h        2019-05-17 17:22:40 UTC (rev 245468)
</span><span class="lines">@@ -27,10 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span><span class="cx"> 
</span><del>-#include <Security/SecAccessControlPriv.h>
</del><span class="cx"> #include <Security/SecCertificatePriv.h>
</span><del>-#include <Security/SecIdentityPriv.h>
-#include <Security/SecKeyPriv.h>
</del><span class="cx"> #include <Security/SecTask.h>
</span><span class="cx"> #include <Security/SecTrustPriv.h>
</span><span class="cx"> 
</span><span class="lines">@@ -70,11 +67,7 @@
</span><span class="cx"> 
</span><span class="cx"> SecTaskRef SecTaskCreateWithAuditToken(CFAllocatorRef, audit_token_t);
</span><span class="cx"> SecTaskRef SecTaskCreateFromSelf(CFAllocatorRef);
</span><del>-CFTypeRef SecTaskCopyValueForEntitlement(SecTaskRef, CFStringRef entitlement, CFErrorRef*);
-SecIdentityRef SecIdentityCreate(CFAllocatorRef, SecCertificateRef, SecKeyRef);
-OSStatus SecKeyFindWithPersistentRef(CFDataRef persistentRef, SecKeyRef* lookedUpData);
-SecAccessControlRef SecAccessControlCreateFromData(CFAllocatorRef, CFDataRef, CFErrorRef*);
-CFDataRef SecAccessControlCopyData(SecAccessControlRef);
</del><ins>+CFTypeRef SecTaskCopyValueForEntitlement(SecTaskRef, CFStringRef entitlement, CFErrorRef *);
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> #include <Security/SecAsn1Types.h>
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (245467 => 245468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2019-05-17 16:39:09 UTC (rev 245467)
+++ trunk/Source/WebKit/ChangeLog       2019-05-17 17:22:40 UTC (rev 245468)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2019-05-17  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r245418.
+        https://bugs.webkit.org/show_bug.cgi?id=197989
+
+        New API test causing crashes on Mojave testers (Requested by
+        ShawnRoberts on #webkit).
+
+        Reverted changeset:
+
+        "Add a unit test for client certificate authentication"
+        https://bugs.webkit.org/show_bug.cgi?id=197800
+        https://trac.webkit.org/changeset/245418
+
</ins><span class="cx"> 2019-05-17  Antti Koivisto  <antti@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [iOS] Respect scrolling="no" on composited frames
</span></span></pre></div>
<a id="trunkSourceWebKitSharedcfArgumentCodersCFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/cf/ArgumentCodersCF.cpp (245467 => 245468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/cf/ArgumentCodersCF.cpp       2019-05-17 16:39:09 UTC (rev 245467)
+++ trunk/Source/WebKit/Shared/cf/ArgumentCodersCF.cpp  2019-05-17 17:22:40 UTC (rev 245468)
</span><span class="lines">@@ -41,6 +41,29 @@
</span><span class="cx"> #import <Foundation/Foundation.h>
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if USE(APPLE_INTERNAL_SDK)
+#include <Security/SecIdentityPriv.h>
+#endif
+
+extern "C" SecIdentityRef SecIdentityCreate(CFAllocatorRef allocator, SecCertificateRef certificate, SecKeyRef privateKey);
+
+#if PLATFORM(IOS_FAMILY)
+#if USE(APPLE_INTERNAL_SDK)
+#include <Security/SecKeyPriv.h>
+#endif
+
+extern "C" OSStatus SecKeyFindWithPersistentRef(CFDataRef persistentRef, SecKeyRef* lookedUpData);
+#endif
+
+#if HAVE(SEC_ACCESS_CONTROL)
+#if USE(APPLE_INTERNAL_SDK)
+#include <Security/SecAccessControlPriv.h>
+#endif
+
+extern "C" SecAccessControlRef SecAccessControlCreateFromData(CFAllocatorRef allocator, CFDataRef data, CFErrorRef *error);
+extern "C" CFDataRef SecAccessControlCopyData(SecAccessControlRef access_control);
+#endif
+
</ins><span class="cx"> namespace IPC {
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (245467 => 245468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2019-05-17 16:39:09 UTC (rev 245467)
+++ trunk/Tools/ChangeLog       2019-05-17 17:22:40 UTC (rev 245468)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2019-05-17  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r245418.
+        https://bugs.webkit.org/show_bug.cgi?id=197989
+
+        New API test causing crashes on Mojave testers (Requested by
+        ShawnRoberts on #webkit).
+
+        Reverted changeset:
+
+        "Add a unit test for client certificate authentication"
+        https://bugs.webkit.org/show_bug.cgi?id=197800
+        https://trac.webkit.org/changeset/245418
+
</ins><span class="cx"> 2019-05-17  Aakash Jain  <aakash_jain@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [ews-build] Add build step to Transfer archive to S3
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITCPServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TCPServer.cpp (245467 => 245468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TCPServer.cpp  2019-05-17 16:39:09 UTC (rev 245467)
+++ trunk/Tools/TestWebKitAPI/TCPServer.cpp     2019-05-17 17:22:40 UTC (rev 245468)
</span><span class="lines">@@ -30,7 +30,6 @@
</span><span class="cx"> #include <thread>
</span><span class="cx"> #include <unistd.h>
</span><span class="cx"> #include <wtf/Optional.h>
</span><del>-#include <wtf/text/Base64.h>
</del><span class="cx"> 
</span><span class="cx"> extern "C" {
</span><span class="cx"> 
</span><span class="lines">@@ -39,10 +38,6 @@
</span><span class="cx"> struct SSL_CTX;
</span><span class="cx"> struct EVP_PKEY;
</span><span class="cx"> struct SSL_METHOD;
</span><del>-struct X509_STORE_CTX {
-    void* unused;
-    X509* cert;
-};
</del><span class="cx"> struct pem_password_cb;
</span><span class="cx"> int BIO_free(BIO*);
</span><span class="cx"> int SSL_free(SSL*);
</span><span class="lines">@@ -61,15 +56,6 @@
</span><span class="cx"> SSL* SSL_new(SSL_CTX*);
</span><span class="cx"> int SSL_accept(SSL*);
</span><span class="cx"> int SSL_set_fd(SSL*, int);
</span><del>-void SSL_CTX_set_verify(SSL_CTX*, int, int (*)(int, X509_STORE_CTX*));
-void SSL_CTX_set_cert_verify_callback(SSL_CTX*, int (*)(X509_STORE_CTX*, void*), void*);
-int SSL_get_error(const SSL*, int);
-int SSL_read(SSL*, void*, int);
-int SSL_write(SSL*, const void*, int);
-int i2d_X509(X509*, unsigned char**);
-void OPENSSL_free(void*);
-#define SSL_VERIFY_PEER 0x01
-#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02
</del><span class="cx"> 
</span><span class="cx"> } // extern "C"
</span><span class="cx"> 
</span><span class="lines">@@ -106,12 +92,6 @@
</span><span class="cx">         EVP_PKEY_free(key);
</span><span class="cx">     }
</span><span class="cx"> };
</span><del>-template<> struct deleter<uint8_t[]> {
-    void operator()(uint8_t* buffer)
-    {
-        OPENSSL_free(buffer);
-    }
-};
</del><span class="cx"> 
</span><span class="cx"> TCPServer::TCPServer(Function<void(Socket)>&& connectionHandler, size_t connections)
</span><span class="cx">     : m_connectionHandler(WTFMove(connectionHandler))
</span><span class="lines">@@ -121,7 +101,7 @@
</span><span class="cx"> 
</span><span class="cx"> TCPServer::TCPServer(Protocol protocol, Function<void(SSL*)>&& secureConnectionHandler)
</span><span class="cx"> {
</span><del>-    auto startSecureConnection = [secureConnectionHandler = WTFMove(secureConnectionHandler), protocol] (Socket socket) {
</del><ins>+    auto startSecureConnection = [secureConnectionHandler = WTFMove(secureConnectionHandler)] (Socket socket) {
</ins><span class="cx">         SSL_library_init();
</span><span class="cx"> 
</span><span class="cx">         std::unique_ptr<SSL_CTX, deleter<SSL_CTX>> ctx(SSL_CTX_new(SSLv23_server_method()));
</span><span class="lines">@@ -149,20 +129,6 @@
</span><span class="cx">         ASSERT(certX509);
</span><span class="cx">         SSL_CTX_use_certificate(ctx.get(), certX509.get());
</span><span class="cx"> 
</span><del>-        if (protocol == Protocol::HTTPSWithClientCertificateRequest) {
-            SSL_CTX_set_verify(ctx.get(), SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, nullptr);
-            SSL_CTX_set_cert_verify_callback(ctx.get(), [] (X509_STORE_CTX* store_ctx, void*) -> int {
-                uint8_t* bufferPointer = nullptr;
-                auto length = i2d_X509(store_ctx->cert, &bufferPointer);
-                std::unique_ptr<uint8_t[], deleter<uint8_t[]>> buffer(bufferPointer);
-                auto expectedCert = testCertificate();
-                EXPECT_EQ(static_cast<int>(expectedCert.size()), length);
-                for (int i = 0; i < length; ++i)
-                    EXPECT_EQ(buffer.get()[i], expectedCert[i]);
-                return 1;
-            }, nullptr);
-        }
-
</del><span class="cx">         // This is a test key from BoringSSL.
</span><span class="cx">         char kKeyPEM[] =
</span><span class="cx">         "-----BEGIN RSA PRIVATE KEY-----\n"
</span><span class="lines">@@ -198,7 +164,6 @@
</span><span class="cx"> 
</span><span class="cx">     switch (protocol) {
</span><span class="cx">     case Protocol::HTTPS:
</span><del>-    case Protocol::HTTPSWithClientCertificateRequest:
</del><span class="cx">         m_connectionHandler = WTFMove(startSecureConnection);
</span><span class="cx">         break;
</span><span class="cx">     case Protocol::HTTPSProxy:
</span><span class="lines">@@ -274,182 +239,4 @@
</span><span class="cx">     return WTF::nullopt;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template<> Vector<uint8_t> TCPServer::read(Socket socket)
-{
-    uint8_t buffer[1000];
-    auto bytesRead = ::read(socket, buffer, sizeof(buffer));
-    ASSERT_UNUSED(bytesRead, bytesRead > 0);
-    ASSERT(static_cast<size_t>(bytesRead) < sizeof(buffer));
-
-    Vector<uint8_t> vector;
-    vector.append(buffer, bytesRead);
-    return vector;
-}
-
-template<> void TCPServer::write(Socket socket, const void* response, size_t length)
-{
-    auto bytesWritten = ::write(socket, response, length);
-    EXPECT_EQ(static_cast<size_t>(bytesWritten), length);
-}
-
-template<> Vector<uint8_t> TCPServer::read(SSL* ssl)
-{
-    uint8_t buffer[1000];
-    auto bytesRead = SSL_read(ssl, buffer, sizeof(buffer));
-    ASSERT_UNUSED(bytesRead, bytesRead > 0);
-    ASSERT(static_cast<size_t>(bytesRead) < sizeof(buffer));
-
-    Vector<uint8_t> vector;
-    vector.append(buffer, bytesRead);
-    return vector;
-}
-
-template<> void TCPServer::write(SSL* ssl, const void* response, size_t length)
-{
-    auto bytesWritten = SSL_write(ssl, response, length);
-    EXPECT_EQ(static_cast<size_t>(bytesWritten), length);
-}
-
-void TCPServer::respondWithChallengeThenOK(Socket socket)
-{
-    read(socket);
-    
-    const char* challengeHeader =
-    "HTTP/1.1 401 Unauthorized\r\n"
-    "Date: Sat, 23 Mar 2019 06:29:01 GMT\r\n"
-    "Content-Length: 0\r\n"
-    "WWW-Authenticate: Basic realm=\"testrealm\"\r\n\r\n";
-    write(socket, challengeHeader, strlen(challengeHeader));
-    
-    read(socket);
-    
-    const char* responseHeader =
-    "HTTP/1.1 200 OK\r\n"
-    "Content-Length: 13\r\n\r\n"
-    "Hello, World!";
-    write(socket, responseHeader, strlen(responseHeader));
-}
-
-void TCPServer::respondWithOK(SSL* ssl)
-{
-    read(ssl);
-    
-    const char* reply = ""
-    "HTTP/1.1 200 OK\r\n"
-    "Content-Length: 34\r\n\r\n"
-    "<script>alert('success!')</script>";
-    write(ssl, reply, strlen(reply));
-}
-
-Vector<uint8_t> TCPServer::testCertificate()
-{
-    // Certificate and private key were generated by running this command:
-    // openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
-    // and entering this information:
-    /*
-     Country Name (2 letter code) []:US
-     State or Province Name (full name) []:New Mexico
-     Locality Name (eg, city) []:Santa Fe
-     Organization Name (eg, company) []:Self
-     Organizational Unit Name (eg, section) []:Myself
-     Common Name (eg, fully qualified host name) []:Me
-     Email Address []:me@example.com
-     */
-    
-    String pemEncodedCertificate(""
-    "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"
-    "3vjZD3y9kZk7mre9XHwkI8MdK5s=");
-    
-    Vector<uint8_t> vector;
-    base64Decode(pemEncodedCertificate, vector, WTF::Base64DecodeOptions::Base64Default);
-    return vector;
-}
-
-Vector<uint8_t> TCPServer::testPrivateKey()
-{
-    String pemEncodedPrivateKey(""
-    "MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDeuE3hI+DxVj8+"
-    "0YM0pjdP0khKBvLxgYwnHS875hkVmbcbd+xNSzK8PIQfCqnlpsJlEH8HLU/BaQ2t"
-    "/Gf9c/w/Tfgk+UTqKtWK4BhCupSHqTtlHwKk4zkYRxFmABQkYZDA2U6QTBoecwZz"
-    "xKwe6uAM+HlcGmBsPK13sEm4HU2gj8omaFxqOQC5Xe9qtL648uh88c2p75wvyE2e"
-    "NlDAdZqs/jmSzh4Fw4Pu3CrG4edWb8VYSuljxazmzUys9OFR0NqGMQx/5h8Mn0ov"
-    "zL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M0+5JDUOV1"
-    "y8dSbaP/RuEv0qYjkGqQVk5e70SUyOzKV+ZxCThdHvFLiovTOTTgevUzE75xydfG"
-    "e7oCmtTurzgvl/69Vu5Ygij1n4CWPHHcq4CQW/DOZ7BhFGBwhrW79voHJF8PbwPO"
-    "+0DTudDGY3nAD5sTnF8zUuObYihJtfzj/t59fOMCggEBAIYuuBUASb62zQ4bv5/g"
-    "VRM/KSpfi9NDnEjfZ7x7h5zCiuVgx/ZjpAlQRO8vzV18roEOOKtx9cnJd8AEd+Hc"
-    "n93BoS1hx0mhsVh+1TRZwyjyBXYJpqwD2wz1Mz1XOIQ6EqbM/yPKTD2gfwg7yO53"
-    "qYxrxZsWagVVcG9Q+ARBERatTwLpoN+fcJLxuh4r/Ca/LepsxmOrKzTa/MGK1LhW"
-    "rWgIk2/ogEPLSptj2d1PEDO+GAzFz4VKjhW1NlUh9fGi6IJPLHLnBw3odbi0S8KT"
-    "gA9Z5+LBc5clotAP5rtQA8Wh/ZCEoPTKTTA2bjW2HMatJcbGmR0FpCQr3AM0Y1SO"
-    "MakCggEALru6QZ6YUwJJG45H1eq/rPdDY8tqqjJVViKoBVvzKj/XfJZYEVQiIw5p"
-    "uoGhDoyFuFUeIh/d1Jc2Iruy2WjoOkiQYtIugDHHxRrkLdQcjPhlCTCE/mmySJt+"
-    "bkUbiHIbQ8dJ5yj8SKr0bHzqEtOy9/JeRjkYGHC6bVWpq5FA2MBhf4dNjJ4UDlnT"
-    "vuePcTjr7nnfY1sztvfVl9D8dmgT+TBnOOV6yWj1gm5bS1DxQSLgNmtKxJ8tAh2u"
-    "dEObvcpShP22ItOVjSampRuAuRG26ZemEbGCI3J6Mqx3y6m+6HwultsgtdzDgrFe"
-    "qJfU8bbdbu2pi47Y4FdJK0HLffl5Rw==");
-
-    Vector<uint8_t> vector;
-    base64Decode(pemEncodedPrivateKey, vector, WTF::Base64DecodeOptions::Base64Default);
-    return vector;
-}
-    
</del><span class="cx"> } // namespace TestWebKitAPI
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITCPServerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TCPServer.h (245467 => 245468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TCPServer.h    2019-05-17 16:39:09 UTC (rev 245467)
+++ trunk/Tools/TestWebKitAPI/TCPServer.h       2019-05-17 17:22:40 UTC (rev 245468)
</span><span class="lines">@@ -29,7 +29,11 @@
</span><span class="cx"> #include <wtf/Function.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx"> 
</span><ins>+extern "C" {
</ins><span class="cx"> struct SSL;
</span><ins>+int SSL_read(SSL*, void*, int);
+int SSL_write(SSL*, const void*, int);
+}
</ins><span class="cx"> 
</span><span class="cx"> namespace TestWebKitAPI {
</span><span class="cx"> 
</span><span class="lines">@@ -40,10 +44,8 @@
</span><span class="cx">     static constexpr Port InvalidPort = 0;
</span><span class="cx">     
</span><span class="cx">     TCPServer(Function<void(Socket)>&&, size_t connections = 1);
</span><del>-    enum class Protocol : uint8_t {
-        HTTPS,
-        HTTPSProxy,
-        HTTPSWithClientCertificateRequest,
</del><ins>+    enum class Protocol : bool {
+        HTTPS, HTTPSProxy
</ins><span class="cx">     };
</span><span class="cx">     TCPServer(Protocol, Function<void(SSL*)>&&);
</span><span class="cx">     ~TCPServer();
</span><span class="lines">@@ -50,15 +52,6 @@
</span><span class="cx">     
</span><span class="cx">     Port port() const { return m_port; }
</span><span class="cx">     
</span><del>-    static void respondWithOK(SSL*);
-    static void respondWithChallengeThenOK(Socket);
-
-    template<typename T> static Vector<uint8_t> read(T);
-    template<typename T> static void write(T, const void*, size_t);
-
-    static Vector<uint8_t> testPrivateKey();
-    static Vector<uint8_t> testCertificate();
-    
</del><span class="cx"> private:
</span><span class="cx">     Optional<Socket> socketBindListen(size_t connections);
</span><span class="cx">     void listenForConnections(size_t connections);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaChallengemm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm (245467 => 245468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm 2019-05-17 16:39:09 UTC (rev 245467)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm    2019-05-17 17:22:40 UTC (rev 245468)
</span><span class="lines">@@ -33,17 +33,141 @@
</span><span class="cx"> #import <WebKit/WKProcessPoolPrivate.h>
</span><span class="cx"> #import <WebKit/WKWebsiteDataRecordPrivate.h>
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><del>-#import <wtf/spi/cocoa/SecuritySPI.h>
</del><span class="cx"> 
</span><span class="cx"> static bool navigationFinished;
</span><span class="cx"> 
</span><del>-static RetainPtr<NSURLCredential> credentialWithIdentity()
</del><ins>+static void respondWithChallengeThenOK(int socket)
</ins><span class="cx"> {
</span><del>-    auto certificateBytes = TestWebKitAPI::TCPServer::testCertificate();
-    auto certificate = adoptCF(SecCertificateCreateWithData(nullptr, (__bridge CFDataRef)[NSData dataWithBytes:certificateBytes.data() length:certificateBytes.size()]));
</del><ins>+    char readBuffer[1000];
+    auto bytesRead = ::read(socket, readBuffer, sizeof(readBuffer));
+    EXPECT_GT(bytesRead, 0);
+    EXPECT_TRUE(static_cast<size_t>(bytesRead) < sizeof(readBuffer));
</ins><span class="cx">     
</span><del>-    auto privateKeyBytes = TestWebKitAPI::TCPServer::testPrivateKey();
-    NSData *derEncodedPrivateKey = [NSData dataWithBytes:privateKeyBytes.data() length:privateKeyBytes.size()];
</del><ins>+    const char* challengeHeader =
+    "HTTP/1.1 401 Unauthorized\r\n"
+    "Date: Sat, 23 Mar 2019 06:29:01 GMT\r\n"
+    "Content-Length: 0\r\n"
+    "WWW-Authenticate: Basic realm=\"testrealm\"\r\n\r\n";
+    auto bytesWritten = ::write(socket, challengeHeader, strlen(challengeHeader));
+    EXPECT_EQ(static_cast<size_t>(bytesWritten), strlen(challengeHeader));
+    
+    bytesRead = ::read(socket, readBuffer, sizeof(readBuffer));
+    EXPECT_GT(bytesRead, 0);
+    EXPECT_TRUE(static_cast<size_t>(bytesRead) < sizeof(readBuffer));
+    
+    const char* responseHeader =
+    "HTTP/1.1 200 OK\r\n"
+    "Content-Length: 13\r\n\r\n"
+    "Hello, World!";
+    bytesWritten = ::write(socket, responseHeader, strlen(responseHeader));
+    EXPECT_EQ(static_cast<size_t>(bytesWritten), strlen(responseHeader));
+}
+
+#if PLATFORM(MAC)
+
+static std::pair<RetainPtr<NSURLCredential>, RetainPtr<NSString>> credentialWithIdentityAndKeychainPath()
+{
+    // Certificate and private key were generated by running this command:
+    // openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
+    // and entering this information:
+    /*
+     Country Name (2 letter code) []:US
+     State or Province Name (full name) []:New Mexico
+     Locality Name (eg, city) []:Santa Fe
+     Organization Name (eg, company) []:Self
+     Organizational Unit Name (eg, section) []:Myself
+     Common Name (eg, fully qualified host name) []:Me
+     Email Address []:me@example.com
+     */
+    
+    NSString *pemEncodedCertificate = @""
+    "MIIFgDCCA2gCCQCKHiPRU5MQuDANBgkqhkiG9w0BAQsFADCBgTELMAkGA1UEBhMC"
+    "VVMxEzARBgNVBAgMCk5ldyBNZXhpY28xETAPBgNVBAcMCFNhbnRhIEZlMQ0wCwYD"
+    "VQQKDARTZWxmMQ8wDQYDVQQLDAZNeXNlbGYxCzAJBgNVBAMMAk1lMR0wGwYJKoZI"
+    "hvcNAQkBFg5tZUBleGFtcGxlLmNvbTAeFw0xOTAzMjMwNTUwMTRaFw0yMDAzMjIw"
+    "NTUwMTRaMIGBMQswCQYDVQQGEwJVUzETMBEGA1UECAwKTmV3IE1leGljbzERMA8G"
+    "A1UEBwwIU2FudGEgRmUxDTALBgNVBAoMBFNlbGYxDzANBgNVBAsMBk15c2VsZjEL"
+    "MAkGA1UEAwwCTWUxHTAbBgkqhkiG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TnF8zUuObYihJtfzj/t59fOMCggEBAIYuuBUASb62zQ4bv5/g"
+    "VRM/KSpfi9NDnEjfZ7x7h5zCiuVgx/ZjpAlQRO8vzV18roEOOKtx9cnJd8AEd+Hc"
+    "n93BoS1hx0mhsVh+1TRZwyjyBXYJpqwD2wz1Mz1XOIQ6EqbM/yPKTD2gfwg7yO53"
+    "qYxrxZsWagVVcG9Q+ARBERatTwLpoN+fcJLxuh4r/Ca/LepsxmOrKzTa/MGK1LhW"
+    "rWgIk2/ogEPLSptj2d1PEDO+GAzFz4VKjhW1NlUh9fGi6IJPLHLnBw3odbi0S8KT"
+    "gA9Z5+LBc5clotAP5rtQA8Wh/ZCEoPTKTTA2bjW2HMatJcbGmR0FpCQr3AM0Y1SO"
+    "MakCggEALru6QZ6YUwJJG45H1eq/rPdDY8tqqjJVViKoBVvzKj/XfJZYEVQiIw5p"
+    "uoGhDoyFuFUeIh/d1Jc2Iruy2WjoOkiQYtIugDHHxRrkLdQcjPhlCTCE/mmySJt+"
+    "bkUbiHIbQ8dJ5yj8SKr0bHzqEtOy9/JeRjkYGHC6bVWpq5FA2MBhf4dNjJ4UDlnT"
+    "vuePcTjr7nnfY1sztvfVl9D8dmgT+TBnOOV6yWj1gm5bS1DxQSLgNmtKxJ8tAh2u"
+    "dEObvcpShP22ItOVjSampRuAuRG26ZemEbGCI3J6Mqx3y6m+6HwultsgtdzDgrFe"
+    "qJfU8bbdbu2pi47Y4FdJK0HLffl5Rw==";
+    
+    NSData *derEncodedCertificate = [[[NSData alloc] initWithBase64EncodedString:pemEncodedCertificate options:0] autorelease];
+    RetainPtr<SecCertificateRef> certificate = adoptCF(SecCertificateCreateWithData(nullptr, (__bridge CFDataRef)derEncodedCertificate));
+    
+    NSData *derEncodedPrivateKey = [[[NSData alloc] initWithBase64EncodedString:pemEncodedPrivateKey options:0] autorelease];
</ins><span class="cx">     NSDictionary* options = @{
</span><span class="cx">         (id)kSecAttrKeyType: (id)kSecAttrKeyTypeRSA,
</span><span class="cx">         (id)kSecAttrKeyClass: (id)kSecAttrKeyClassPrivate,
</span><span class="lines">@@ -51,16 +175,36 @@
</span><span class="cx">     };
</span><span class="cx">     const NSUInteger pemEncodedPrivateKeyHeaderLength = 26;
</span><span class="cx">     CFErrorRef error = nullptr;
</span><del>-    auto privateKey = adoptCF(SecKeyCreateWithData((__bridge CFDataRef)[derEncodedPrivateKey subdataWithRange:NSMakeRange(pemEncodedPrivateKeyHeaderLength, derEncodedPrivateKey.length - pemEncodedPrivateKeyHeaderLength)], (__bridge CFDictionaryRef)options, &error));
</del><ins>+    RetainPtr<SecKeyRef> privateKey = adoptCF(SecKeyCreateWithData((__bridge CFDataRef)[derEncodedPrivateKey subdataWithRange:NSMakeRange(pemEncodedPrivateKeyHeaderLength, derEncodedPrivateKey.length - pemEncodedPrivateKeyHeaderLength)], (__bridge CFDictionaryRef)options, &error));
</ins><span class="cx">     EXPECT_NULL(error);
</span><span class="cx">     EXPECT_NOT_NULL(privateKey.get());
</span><span class="cx"> 
</span><del>-    auto identity = adoptCF(SecIdentityCreate(kCFAllocatorDefault, certificate.get(), privateKey.get()));
-    EXPECT_NOT_NULL(identity);
</del><ins>+    SecKeychainRef keychainRef = nullptr;
+    const char* keychainPassword = "testpassword";
+    NSString *keychainPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"TestKeychain"];
+    OSStatus status = SecKeychainCreate([keychainPath UTF8String], strlen(keychainPassword), keychainPassword, NO, nullptr, &keychainRef);
+    EXPECT_TRUE(status == errSecSuccess);
+    RetainPtr<SecKeychainRef> keychain = adoptCF(keychainRef);
+    EXPECT_NOT_NULL(keychain);
+
+    SecExternalItemType type = kSecItemTypePrivateKey;
+    status = SecItemImport((__bridge CFDataRef)derEncodedPrivateKey, nullptr, nullptr, &type, 0, nullptr, keychain.get(), nullptr);
+    EXPECT_TRUE(status == errSecSuccess);
+
+    SecIdentityRef identityRef = nullptr;
+    status = SecIdentityCreateWithCertificate(keychain.get(), certificate.get(), &identityRef);
+    EXPECT_NOT_NULL(identityRef);
+    EXPECT_TRUE(status == errSecSuccess);
+    RetainPtr<SecIdentityRef> identity = adoptCF(identityRef);
</ins><span class="cx">     
</span><del>-    return [NSURLCredential credentialWithIdentity:identity.get() certificates:@[(id)certificate.get()] persistence:NSURLCredentialPersistenceNone];
</del><ins>+    return {
+        [NSURLCredential credentialWithIdentity:identity.get() certificates:@[(id)certificate.get()] persistence:NSURLCredentialPersistenceNone],
+        keychainPath
+    };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static RetainPtr<NSString> keychainPath;
+
</ins><span class="cx"> @interface ChallengeDelegate : NSObject <WKNavigationDelegate>
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="lines">@@ -85,15 +229,18 @@
</span><span class="cx">     EXPECT_TRUE([protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodHTTPBasic]);
</span><span class="cx">     EXPECT_EQ([(NSHTTPURLResponse *)challenge.failureResponse statusCode], 401);
</span><span class="cx"> 
</span><del>-    completionHandler(NSURLSessionAuthChallengeUseCredential, credentialWithIdentity().get());
</del><ins>+    auto pair = credentialWithIdentityAndKeychainPath();
+    completionHandler(NSURLSessionAuthChallengeUseCredential, pair.first.get());
+    keychainPath = WTFMove(pair.second);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+namespace TestWebKitAPI {
+
</ins><span class="cx"> TEST(Challenge, SecIdentity)
</span><span class="cx"> {
</span><del>-    using namespace TestWebKitAPI;
-    TCPServer server(TCPServer::respondWithChallengeThenOK);
</del><ins>+    TCPServer server(respondWithChallengeThenOK);
</ins><span class="cx"> 
</span><span class="cx">     auto webView = adoptNS([WKWebView new]);
</span><span class="cx">     auto delegate = adoptNS([ChallengeDelegate new]);
</span><span class="lines">@@ -101,56 +248,15 @@
</span><span class="cx">     [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://127.0.0.1:%d/", server.port()]]]];
</span><span class="cx"> 
</span><span class="cx">     Util::run(&navigationFinished);
</span><del>-}
-
-@interface ClientCertificateDelegate : NSObject <WKNavigationDelegate> {
-    Vector<RetainPtr<NSString>> _authenticationMethods;
-}
-- (const Vector<RetainPtr<NSString>>&)authenticationMethods;
-@end
-
-@implementation ClientCertificateDelegate
-
-- (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation
-{
-    navigationFinished = true;
-}
-
-- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler
-{
-    _authenticationMethods.append(challenge.protectionSpace.authenticationMethod);
-
-    if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
-        return completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
</del><span class="cx">     
</span><del>-    EXPECT_TRUE([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodClientCertificate]);
-    completionHandler(NSURLSessionAuthChallengeUseCredential, credentialWithIdentity().get());
</del><ins>+    EXPECT_NOT_NULL(keychainPath.get());
+    NSError *error = nil;
+    [[NSFileManager defaultManager] removeItemAtPath:keychainPath.get() error:&error];
+    EXPECT_NULL(error);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (const Vector<RetainPtr<NSString>>&)authenticationMethods
-{
-    return _authenticationMethods;
-}
</del><ins>+} // namespace TestWebKitAPI
</ins><span class="cx"> 
</span><del>-@end
-
-#if HAVE(SEC_KEY_PROXY) && PLATFORM(MAC) // FIXME: Investigate why this doesn't work on iOS.
-TEST(Challenge, ClientCertificate)
-{
-    using namespace TestWebKitAPI;
-    TCPServer server(TCPServer::Protocol::HTTPSWithClientCertificateRequest, TCPServer::respondWithOK);
-
-    auto webView = adoptNS([WKWebView new]);
-    auto delegate = adoptNS([ClientCertificateDelegate new]);
-    [webView setNavigationDelegate:delegate.get()];
-    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://127.0.0.1:%d/", server.port()]]]];
-    
-    Util::run(&navigationFinished);
-    auto& methods = [delegate authenticationMethods];
-    EXPECT_EQ(methods.size(), 2ull);
-    EXPECT_TRUE([methods[0] isEqualToString:NSURLAuthenticationMethodServerTrust]);
-    EXPECT_TRUE([methods[2] isEqualToString:NSURLAuthenticationMethodClientCertificate]);
-}
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> static bool receivedSecondChallenge;
</span><span class="lines">@@ -184,7 +290,7 @@
</span><span class="cx"> TEST(Challenge, BasicProposedCredential)
</span><span class="cx"> {
</span><span class="cx">     using namespace TestWebKitAPI;
</span><del>-    TCPServer server(TCPServer::respondWithChallengeThenOK, 2);
</del><ins>+    TCPServer server(respondWithChallengeThenOK, 2);
</ins><span class="cx">     auto configuration = retainPtr([WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"BasicProposedCredentialPlugIn"]);
</span><span class="cx">     auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]);
</span><span class="cx">     auto delegate = adoptNS([ProposedCredentialDelegate new]);
</span><span class="lines">@@ -300,13 +406,16 @@
</span><span class="cx"> TEST(WebKit, ServerTrust)
</span><span class="cx"> {
</span><span class="cx">     TCPServer server(TCPServer::Protocol::HTTPS, [] (SSL* ssl) {
</span><del>-        TCPServer::read(ssl);
</del><ins>+        char requestBuffer[1000];
+        auto readResult = SSL_read(ssl, requestBuffer, sizeof(requestBuffer));
+        ASSERT_UNUSED(readResult, readResult > 0);
</ins><span class="cx"> 
</span><span class="cx">         const char* reply = ""
</span><span class="cx">         "HTTP/1.1 200 OK\r\n"
</span><span class="cx">         "Content-Length: 13\r\n\r\n"
</span><span class="cx">         "Hello, World!";
</span><del>-        TCPServer::write(ssl, reply, strlen(reply));
</del><ins>+        auto writeResult = SSL_write(ssl, reply, strlen(reply));
+        ASSERT_UNUSED(writeResult, writeResult == static_cast<int>(strlen(reply)));
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     auto webView = adoptNS([WKWebView new]);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaPDFLinkReferrermm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PDFLinkReferrer.mm (245467 => 245468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PDFLinkReferrer.mm   2019-05-17 16:39:09 UTC (rev 245467)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PDFLinkReferrer.mm      2019-05-17 17:22:40 UTC (rev 245468)
</span><span class="lines">@@ -72,17 +72,19 @@
</span><span class="cx"> 
</span><span class="cx"> TEST(WebKit, PDFLinkReferrer)
</span><span class="cx"> {
</span><del>-    using namespace TestWebKitAPI;
-    TCPServer server([] (int socket) {
</del><ins>+    TestWebKitAPI::TCPServer server([] (int socket) {
+        char readBuffer[1000];
+        memset(readBuffer, 0, 1000);
+
</ins><span class="cx">         // This assumes all the data from the HTTP request is available to be read at once,
</span><span class="cx">         // which is probably an okay assumption.
</span><del>-        auto requestBytes = TCPServer::read(socket);
</del><ins>+        ::read(socket, readBuffer, 999);
</ins><span class="cx"> 
</span><span class="cx">         // Look for a referer header.
</span><del>-        const auto* currentLine = reinterpret_cast<const char*>(requestBytes.data());
</del><ins>+        char* currentLine = readBuffer;
</ins><span class="cx">         while (currentLine) {
</span><span class="cx">             EXPECT_NE(strncasecmp(currentLine, "referer:", 8), 0);
</span><del>-            const char* nextLine = strchr(currentLine, '\n');
</del><ins>+            char* nextLine = strchr(currentLine, '\n');
</ins><span class="cx">             currentLine = nextLine ? nextLine + 1 : 0;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -89,7 +91,7 @@
</span><span class="cx">         const char* responseHeader =
</span><span class="cx">         "HTTP/1.1 200 OK\r\n"
</span><span class="cx">         "Content-Length: 0\r\n\r\n";
</span><del>-        TCPServer::write(socket, responseHeader, strlen(responseHeader));
</del><ins>+        ::write(socket, responseHeader, strlen(responseHeader));
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Proxy.mm (245467 => 245468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Proxy.mm     2019-05-17 16:39:09 UTC (rev 245467)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Proxy.mm        2019-05-17 17:22:40 UTC (rev 245468)
</span><span class="lines">@@ -57,8 +57,19 @@
</span><span class="cx"> 
</span><span class="cx"> TEST(WebKit, HTTPSProxy)
</span><span class="cx"> {
</span><del>-    TCPServer server(TCPServer::Protocol::HTTPSProxy, TCPServer::respondWithOK);
</del><ins>+    TCPServer server(TCPServer::Protocol::HTTPSProxy, [] (SSL* ssl) {
+        char requestBuffer[1000];
+        auto readResult = SSL_read(ssl, requestBuffer, sizeof(requestBuffer));
+        ASSERT_UNUSED(readResult, readResult > 0);
</ins><span class="cx"> 
</span><ins>+        const char* reply = ""
+        "HTTP/1.1 200 OK\r\n"
+        "Content-Length: 34\r\n\r\n"
+        "<script>alert('success!')</script>";
+        auto writeResult = SSL_write(ssl, reply, strlen(reply));
+        ASSERT_UNUSED(writeResult, writeResult == static_cast<int>(strlen(reply)));
+    });
+
</ins><span class="cx">     auto storeConfiguration = adoptNS([_WKWebsiteDataStoreConfiguration new]);
</span><span class="cx">     [storeConfiguration setHTTPSProxy:[NSURL URLWithString:[NSString stringWithFormat:@"https://127.0.0.1:%d/", server.port()]]];
</span><span class="cx">     auto viewConfiguration = adoptNS([WKWebViewConfiguration new]);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaWKNavigationResponsemm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKNavigationResponse.mm (245467 => 245468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKNavigationResponse.mm      2019-05-17 16:39:09 UTC (rev 245467)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKNavigationResponse.mm 2019-05-17 17:22:40 UTC (rev 245468)
</span><span class="lines">@@ -195,28 +195,41 @@
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+static void readRequest(int socket)
+{
+    char readBuffer[1000];
+    auto bytesRead = ::read(socket, readBuffer, sizeof(readBuffer));
+    EXPECT_GT(bytesRead, 0);
+    EXPECT_TRUE(static_cast<size_t>(bytesRead) < sizeof(readBuffer));
+}
+
+static void writeResponse(int socket, NSString *response)
+{
+    const char* bytes = response.UTF8String;
+    auto bytesWritten = ::write(socket, bytes, strlen(bytes));
+    EXPECT_EQ(static_cast<size_t>(bytesWritten), strlen(bytes));
+}
+
</ins><span class="cx"> TEST(WebKit, WKNavigationResponseDownloadAttribute)
</span><span class="cx"> {
</span><span class="cx">     auto getDownloadResponse = [] (RetainPtr<NSString> body) -> RetainPtr<WKNavigationResponse> {
</span><del>-        using namespace TestWebKitAPI;
-        TCPServer server([body](int socket) {
</del><ins>+        TestWebKitAPI::TCPServer server([body](int socket) {
+            readRequest(socket);
</ins><span class="cx">             unsigned bodyLength = [body length];
</span><del>-            NSString *firstResponse = [NSString stringWithFormat:
</del><ins>+            writeResponse(socket, [NSString stringWithFormat:
</ins><span class="cx">                 @"HTTP/1.1 200 OK\r\n"
</span><span class="cx">                 "Content-Length: %d\r\n\r\n"
</span><span class="cx">                 "%@",
</span><span class="cx">                 bodyLength,
</span><span class="cx">                 body.get()
</span><del>-            ];
-            NSString *secondResponse = @"HTTP/1.1 200 OK\r\n"
</del><ins>+            ]);
+            readRequest(socket);
+            writeResponse(socket,
+                @"HTTP/1.1 200 OK\r\n"
</ins><span class="cx">                 "Content-Length: 6\r\n"
</span><span class="cx">                 "Content-Disposition: attachment; filename=fromHeader.txt;\r\n\r\n"
</span><del>-                "Hello!";
-
-            TCPServer::read(socket);
-            TCPServer::write(socket, firstResponse.UTF8String, firstResponse.length);
-            TCPServer::read(socket);
-            TCPServer::write(socket, secondResponse.UTF8String, secondResponse.length);
</del><ins>+                "Hello!"
+            );
</ins><span class="cx">         });
</span><span class="cx">         auto delegate = adoptNS([NavigationResponseTestDelegate new]);
</span><span class="cx">         auto webView = adoptNS([WKWebView new]);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitCocoaWKWebsiteDatastoremm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm (245467 => 245468)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm        2019-05-17 16:39:09 UTC (rev 245467)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm   2019-05-17 17:22:40 UTC (rev 245468)
</span><span class="lines">@@ -110,9 +110,36 @@
</span><span class="cx">     TestWebKitAPI::Util::run(&done);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void respondWithChallengeThenOK(int socket)
+{
+    char readBuffer[1000];
+    auto bytesRead = ::read(socket, readBuffer, sizeof(readBuffer));
+    EXPECT_GT(bytesRead, 0);
+    EXPECT_TRUE(static_cast<size_t>(bytesRead) < sizeof(readBuffer));
+    
+    const char* challengeHeader =
+    "HTTP/1.1 401 Unauthorized\r\n"
+    "Date: Sat, 23 Mar 2019 06:29:01 GMT\r\n"
+    "Content-Length: 0\r\n"
+    "WWW-Authenticate: Basic realm=\"testrealm\"\r\n\r\n";
+    auto bytesWritten = ::write(socket, challengeHeader, strlen(challengeHeader));
+    EXPECT_EQ(static_cast<size_t>(bytesWritten), strlen(challengeHeader));
+    
+    bytesRead = ::read(socket, readBuffer, sizeof(readBuffer));
+    EXPECT_GT(bytesRead, 0);
+    EXPECT_TRUE(static_cast<size_t>(bytesRead) < sizeof(readBuffer));
+    
+    const char* responseHeader =
+    "HTTP/1.1 200 OK\r\n"
+    "Content-Length: 13\r\n\r\n"
+    "Hello, World!";
+    bytesWritten = ::write(socket, responseHeader, strlen(responseHeader));
+    EXPECT_EQ(static_cast<size_t>(bytesWritten), strlen(responseHeader));
+}
+    
</ins><span class="cx"> TEST(WKWebsiteDataStore, FetchNonPersistentCredentials)
</span><span class="cx"> {
</span><del>-    TCPServer server(TCPServer::respondWithChallengeThenOK);
</del><ins>+    TCPServer server(respondWithChallengeThenOK);
</ins><span class="cx">     
</span><span class="cx">     usePersistentCredentialStorage = false;
</span><span class="cx">     auto configuration = adoptNS([WKWebViewConfiguration new]);
</span><span class="lines">@@ -137,7 +164,7 @@
</span><span class="cx"> 
</span><span class="cx"> TEST(WKWebsiteDataStore, FetchPersistentCredentials)
</span><span class="cx"> {
</span><del>-    TCPServer server(TCPServer::respondWithChallengeThenOK);
</del><ins>+    TCPServer server(respondWithChallengeThenOK);
</ins><span class="cx">     
</span><span class="cx">     usePersistentCredentialStorage = true;
</span><span class="cx">     auto websiteDataStore = [WKWebsiteDataStore defaultDataStore];
</span><span class="lines">@@ -175,7 +202,7 @@
</span><span class="cx"> 
</span><span class="cx"> TEST(WKWebsiteDataStore, RemovePersistentCredentials)
</span><span class="cx"> {
</span><del>-    TCPServer server(TCPServer::respondWithChallengeThenOK);
</del><ins>+    TCPServer server(respondWithChallengeThenOK);
</ins><span class="cx"> 
</span><span class="cx">     usePersistentCredentialStorage = true;
</span><span class="cx">     auto websiteDataStore = [WKWebsiteDataStore defaultDataStore];
</span><span class="lines">@@ -226,7 +253,7 @@
</span><span class="cx"> 
</span><span class="cx"> TEST(WKWebsiteDataStore, RemoveNonPersistentCredentials)
</span><span class="cx"> {
</span><del>-    TCPServer server(TCPServer::respondWithChallengeThenOK);
</del><ins>+    TCPServer server(respondWithChallengeThenOK);
</ins><span class="cx"> 
</span><span class="cx">     usePersistentCredentialStorage = false;
</span><span class="cx">     auto configuration = adoptNS([WKWebViewConfiguration new]);
</span></span></pre>
</div>
</div>

</body>
</html>