Skip to content

Commit f521a63

Browse files
committed
a hotfix to ssl test which depends also on the length of crow version due to literal length use
1 parent 8aba54e commit f521a63

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

tests/ssl/ssltest.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,36 +42,29 @@ TEST_CASE("SSL")
4242

4343
asio::ssl::context ctx(asio::ssl::context::sslv23);
4444

45-
asio::io_service is;
45+
asio::io_context ioc;
4646
{
47-
asio::ssl::stream<asio::ip::tcp::socket> c(is, ctx);
47+
asio::ssl::stream<asio::ip::tcp::socket> c(ioc, ctx);
4848
c.lowest_layer().connect(asio::ip::tcp::endpoint(asio::ip::address::from_string(LOCALHOST_ADDRESS), 45460));
4949

5050
c.handshake(asio::ssl::stream_base::client);
5151
c.write_some(asio::buffer(sendmsg));
5252

5353
size_t x = 0;
5454
size_t y = 0;
55-
long z = 0;
56-
57-
while (x < 121)
58-
{
55+
//while (x==0)
56+
//{
5957
y = c.read_some(asio::buffer(buf, 2048));
6058
x += y;
6159
buf[y] = '\0';
62-
}
60+
//}
6361

6462
std::string to_test(buf);
6563

66-
if ((z = to_test.length() - 24) >= 0)
67-
{
64+
auto start_body = to_test.find("\r\n\r\n");
65+
CHECK(start_body!=std::string::npos);
6866

69-
CHECK(std::string("Hello world, I'm keycrt.") == to_test.substr(z));
70-
}
71-
else
72-
{
73-
CHECK(std::string("Hello world, I'm keycrt.").substr((z * -1)) == to_test);
74-
}
67+
CHECK(std::string("Hello world, I'm keycrt.") == to_test.substr(start_body+4));
7568

7669
asio::error_code ec;
7770
c.lowest_layer().shutdown(asio::socket_base::shutdown_type::shutdown_both, ec);

0 commit comments

Comments
 (0)