⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 266100 in webkit


Ignore:
Timestamp:
Aug 24, 2020, 8:36:45 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Make TLSVersion.DefaultBehavior more robust
https://bugs.webkit.org/show_bug.cgi?id=215791

Patch by Alex Christensen <achristensen@webkit.org> on 2020-08-24
Reviewed by Darin Adler.

After r265573 sometimes it would assert, which is not a problem because it was failing the first connection
then succeeding the second connection as intended and as happens in the real internet.
Use HTTPServer which accepts a variable number of connections to keep the test coverage.

  • TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm:

(TestWebKitAPI::TEST):

  • TestWebKitAPI/cocoa/HTTPServer.h:
  • TestWebKitAPI/cocoa/HTTPServer.mm:

(TestWebKitAPI::HTTPServer::respondWithChallengeThenOK):
(TestWebKitAPI::HTTPServer::respondWithOK):

Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r266090 r266100  
     12020-08-24  Alex Christensen  <achristensen@webkit.org>
     2
     3        Make TLSVersion.DefaultBehavior more robust
     4        https://bugs.webkit.org/show_bug.cgi?id=215791
     5
     6        Reviewed by Darin Adler.
     7
     8        After r265573 sometimes it would assert, which is not a problem because it was failing the first connection
     9        then succeeding the second connection as intended and as happens in the real internet.
     10        Use HTTPServer which accepts a variable number of connections to keep the test coverage.
     11
     12        * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm:
     13        (TestWebKitAPI::TEST):
     14        * TestWebKitAPI/cocoa/HTTPServer.h:
     15        * TestWebKitAPI/cocoa/HTTPServer.mm:
     16        (TestWebKitAPI::HTTPServer::respondWithChallengeThenOK):
     17        (TestWebKitAPI::HTTPServer::respondWithOK):
     18
    1192020-08-24  Wenson Hsieh  <wenson_hsieh@apple.com>
    220
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm

    r265857 r266100  
    145145static NSString *defaultsKey = @"WebKitEnableLegacyTLS";
    146146
     147#if HAVE(NETWORK_FRAMEWORK)
     148
    147149TEST(TLSVersion, DefaultBehavior)
    148150{
    149     TCPServer server(TCPServer::Protocol::HTTPS, TCPServer::respondWithOK, tls1_1);
     151    HTTPServer server(HTTPServer::respondWithOK, HTTPServer::Protocol::HttpsWithLegacyTLS);
    150152    auto delegate = adoptNS([TestNavigationDelegate new]);
    151153    auto webView = adoptNS([WKWebView new]);
     
    158160    [delegate waitForDidFinishNavigation];
    159161}
     162
     163#endif // HAVE(NETWORK_FRAMEWORK)
    160164
    161165#if HAVE(TLS_VERSION_DURING_CHALLENGE)
  • trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.h

    r265150 r266100  
    5555    void cancel();
    5656
     57    static void respondWithOK(Connection);
    5758    static void respondWithChallengeThenOK(Connection);
    58    
     59
    5960private:
    6061    static RetainPtr<nw_parameters_t> listenerParameters(Protocol, CertificateVerifier&&, RetainPtr<SecIdentityRef>&&, Optional<uint16_t> port);
  • trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.mm

    r265150 r266100  
    151151        "WWW-Authenticate: Basic realm=\"testrealm\"\r\n\r\n";
    152152        connection.send(challengeHeader, [connection] {
    153             connection.receiveHTTPRequest([connection] (Vector<char>&&) {
    154                 connection.send(
    155                     "HTTP/1.1 200 OK\r\n"
    156                     "Content-Length: 13\r\n\r\n"
    157                     "Hello, World!"
    158                 );
    159             });
     153            respondWithOK(connection);
    160154        });
     155    });
     156}
     157
     158void HTTPServer::respondWithOK(Connection connection)
     159{
     160    connection.receiveHTTPRequest([connection] (Vector<char>&&) {
     161        connection.send(
     162            "HTTP/1.1 200 OK\r\n"
     163            "Content-Length: 13\r\n\r\n"
     164            "Hello, World!"
     165        );
    161166    });
    162167}
Note: See TracChangeset for help on using the changeset viewer.