aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/http/server/http_ut.cpp
diff options
context:
space:
mode:
authorAlexey Bykov <alexei4203@yandex.ru>2022-02-10 16:47:16 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:16 +0300
commitb50730a77e0c38f2fec0ad5d53fb2034d6470221 (patch)
tree9814fbd1c3effac9b8377c5d604b367b14e2db55 /library/cpp/http/server/http_ut.cpp
parent4cadece7a57ab767e762a0bea1995a596aefeb11 (diff)
downloadydb-b50730a77e0c38f2fec0ad5d53fb2034d6470221.tar.gz
Restoring authorship annotation for Alexey Bykov <alexei4203@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/http/server/http_ut.cpp')
-rw-r--r--library/cpp/http/server/http_ut.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/library/cpp/http/server/http_ut.cpp b/library/cpp/http/server/http_ut.cpp
index 027c03ea44..cc62bb988e 100644
--- a/library/cpp/http/server/http_ut.cpp
+++ b/library/cpp/http/server/http_ut.cpp
@@ -558,22 +558,22 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
UNIT_ASSERT_STRINGS_EQUAL(serverImpl.ExceptionMessage, "(yexception) some error");
};
-
+
THttpInput SendRequest(TSocket& socket, ui16 port) {
- TSocketInput si(socket);
- TSocketOutput so(socket);
- THttpOutput out(&so);
- out.EnableKeepAlive(true);
- out << "GET / HTTP/1.1" << CrLf;
- out << "Host: localhost:" + ToString(port) << CrLf;
- out << CrLf;
- out.Flush();
-
- THttpInput input(&si);
- input.ReadAll();
+ TSocketInput si(socket);
+ TSocketOutput so(socket);
+ THttpOutput out(&so);
+ out.EnableKeepAlive(true);
+ out << "GET / HTTP/1.1" << CrLf;
+ out << "Host: localhost:" + ToString(port) << CrLf;
+ out << CrLf;
+ out.Flush();
+
+ THttpInput input(&si);
+ input.ReadAll();
return input;
- }
-
+ }
+
THttpInput SendRequestWithBody(TSocket& socket, ui16 port, TString body) {
TSocketInput si(socket);
TSocketOutput so(socket);
@@ -590,32 +590,32 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
return input;
}
- Y_UNIT_TEST(TTestExpirationTimeout) {
- TPortManager pm;
- const ui16 port = pm.GetPort();
-
- TEchoServer serverImpl("test_data");
- THttpServer::TOptions options(port);
- options.nThreads = 1;
- options.MaxQueueSize = 0;
- options.MaxConnections = 0;
- options.KeepAliveEnabled = true;
- options.ExpirationTimeout = TDuration::Seconds(1);
- options.PollTimeout = TDuration::MilliSeconds(100);
- THttpServer server(&serverImpl, options);
- UNIT_ASSERT(server.Start());
-
- TSocket socket(TNetworkAddress("localhost", port), TDuration::Seconds(10));
-
- SendRequest(socket, port);
- SendRequest(socket, port);
-
- Sleep(TDuration::Seconds(5));
- UNIT_ASSERT_EXCEPTION(SendRequest(socket, port), THttpReadException);
-
- server.Stop();
- }
-
+ Y_UNIT_TEST(TTestExpirationTimeout) {
+ TPortManager pm;
+ const ui16 port = pm.GetPort();
+
+ TEchoServer serverImpl("test_data");
+ THttpServer::TOptions options(port);
+ options.nThreads = 1;
+ options.MaxQueueSize = 0;
+ options.MaxConnections = 0;
+ options.KeepAliveEnabled = true;
+ options.ExpirationTimeout = TDuration::Seconds(1);
+ options.PollTimeout = TDuration::MilliSeconds(100);
+ THttpServer server(&serverImpl, options);
+ UNIT_ASSERT(server.Start());
+
+ TSocket socket(TNetworkAddress("localhost", port), TDuration::Seconds(10));
+
+ SendRequest(socket, port);
+ SendRequest(socket, port);
+
+ Sleep(TDuration::Seconds(5));
+ UNIT_ASSERT_EXCEPTION(SendRequest(socket, port), THttpReadException);
+
+ server.Stop();
+ }
+
Y_UNIT_TEST(TTestContentLengthTooLarge) {
TPortManager pm;
const ui16 port = pm.GetPort();