diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-08-24 06:52:22 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-24 09:29:39 +0200 |
commit | 465d46c66542ca96eceb4e1765518ec6b934afec (patch) | |
tree | db9658942c131a9e7ac2c5ea8c9e09afd09a888c /Userland | |
parent | c9f902d5dec943d8c9c1e62c483b59a6c1ee7a4d (diff) | |
download | serenity-465d46c66542ca96eceb4e1765518ec6b934afec.zip |
Meta+Userland: Run the TLS test too
While this _does_ add a point of failure, it'll be a pretty bad day when
google goes down.
And this is unlikely to put a (positive) dent in their incoming
requests, so let's just roll with it until we have our own TLS server.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/test-crypto.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Userland/test-crypto.cpp b/Userland/test-crypto.cpp index 646c3684c3..47a573abf9 100644 --- a/Userland/test-crypto.cpp +++ b/Userland/test-crypto.cpp @@ -1730,8 +1730,17 @@ static void tls_test_client_hello() if (sent_request) return; sent_request = true; - if (!tls.write("GET / HTTP/1.1\r\nHost: github.com\r\nConnection: close\r\n\r\n"_b)) { - FAIL(write() failed); + if (!tls.write("GET / HTTP/1.1\r\nHost: "_b)) { + FAIL(write(0) failed); + loop.quit(0); + } + auto* the_server = (const u8*)(server ?: DEFAULT_SERVER); + if (!tls.write(ByteBuffer::wrap(const_cast<u8*>(the_server), strlen((const char*)the_server)))) { + FAIL(write(1) failed); + loop.quit(0); + } + if (!tls.write("\r\nConnection : close\r\n\r\n"_b)) { + FAIL(write(2) failed); loop.quit(0); } }; @@ -1761,7 +1770,7 @@ static void tls_test_client_hello() FAIL(Connection failure); loop.quit(1); }; - if (!tls->connect("github.com", 443)) { + if (!tls->connect(server ?: DEFAULT_SERVER, port)) { FAIL(connect() failed); return; } |