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.
This commit is contained in:
AnotherTest 2020-08-24 06:52:22 +04:30 committed by Andreas Kling
parent c9f902d5de
commit 465d46c665
Notes: sideshowbarker 2024-07-19 03:13:45 +09:00
2 changed files with 13 additions and 4 deletions

View File

@ -94,7 +94,7 @@ if (BUILD_LAGOM)
target_link_libraries(test-crypto_lagom stdc++)
add_test(
NAME Crypto
COMMAND test-crypto_lagom test -tc
COMMAND test-crypto_lagom test -t -s google.com
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@ -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;
}