diff options
author | nataxane <nataxane@yandex-team.ru> | 2022-02-10 16:49:37 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:37 +0300 |
commit | c74cff1222c5ff97080e38da5019b2520991a526 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library | |
parent | f20fed3ce6cdb52b09a0d5e53388e293e805ac81 (diff) | |
download | ydb-c74cff1222c5ff97080e38da5019b2520991a526.tar.gz |
Restoring authorship annotation for <nataxane@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library')
-rw-r--r-- | library/cpp/http/io/compression_ut.cpp | 12 | ||||
-rw-r--r-- | library/cpp/http/io/stream_ut.cpp | 96 | ||||
-rw-r--r-- | library/cpp/http/server/http_ex.cpp | 8 |
3 files changed, 58 insertions, 58 deletions
diff --git a/library/cpp/http/io/compression_ut.cpp b/library/cpp/http/io/compression_ut.cpp index 5871f2e9a1..2f3d131f8c 100644 --- a/library/cpp/http/io/compression_ut.cpp +++ b/library/cpp/http/io/compression_ut.cpp @@ -31,18 +31,18 @@ Y_UNIT_TEST_SUITE(THttpCompressionTest) { Y_UNIT_TEST(TestDecoder) { TStringStream buffer; - - { + + { TZLibCompress compressor(TZLibCompress::TParams(&buffer).SetType(ZLib::GZip)); compressor.Write(DATA); - } - + } + auto decoder = TCompressionCodecFactory::Instance().FindDecoder("gzip"); UNIT_ASSERT(decoder); - + auto decodedStream = (*decoder)(&buffer); UNIT_ASSERT_EQUAL(decodedStream->ReadAll(), DATA); - } + } Y_UNIT_TEST(TestChooseBestCompressionScheme) { THashSet<TString> accepted; diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp index 9630ba530a..1ea35df675 100644 --- a/library/cpp/http/io/stream_ut.cpp +++ b/library/cpp/http/io/stream_ut.cpp @@ -27,10 +27,10 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { if (!ProcessHeaders()) { return true; } - - // Check that function will not hang on - Input().ReadAll(); - + + // Check that function will not hang on + Input().ReadAll(); + // "lo" is for "local" if (RD.ServerName() == "yandex.lo") { // do redirect @@ -129,51 +129,51 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { } Y_UNIT_TEST(TestHttpInputDelete) { - TString res = "I'm a teapot"; - TPortManager pm; - const ui16 port = pm.GetPort(); - - TTestHttpServer serverImpl(res); - THttpServer server(&serverImpl, THttpServer::TOptions(port).EnableKeepAlive(true).EnableCompression(true)); - - UNIT_ASSERT(server.Start()); - - TNetworkAddress addr("localhost", port); - TSocket s(addr); - - //TDebugOutput dbg; - TNullOutput dbg; - - { - TSocketOutput so(s); - TTeeOutput out(&so, &dbg); - THttpOutput output(&out); - - output.EnableKeepAlive(true); - output.EnableCompression(true); - - TString r; - r += "DELETE / HTTP/1.1"; - r += "\r\n"; - r += "Host: yandex.lo"; - r += "\r\n"; - r += "\r\n"; - + TString res = "I'm a teapot"; + TPortManager pm; + const ui16 port = pm.GetPort(); + + TTestHttpServer serverImpl(res); + THttpServer server(&serverImpl, THttpServer::TOptions(port).EnableKeepAlive(true).EnableCompression(true)); + + UNIT_ASSERT(server.Start()); + + TNetworkAddress addr("localhost", port); + TSocket s(addr); + + //TDebugOutput dbg; + TNullOutput dbg; + + { + TSocketOutput so(s); + TTeeOutput out(&so, &dbg); + THttpOutput output(&out); + + output.EnableKeepAlive(true); + output.EnableCompression(true); + + TString r; + r += "DELETE / HTTP/1.1"; + r += "\r\n"; + r += "Host: yandex.lo"; + r += "\r\n"; + r += "\r\n"; + output.Write(r.data(), r.size()); - output.Finish(); - } - - { - TSocketInput si(s); - THttpInput input(&si); - unsigned httpCode = ParseHttpRetCode(input.FirstLine()); - UNIT_ASSERT_VALUES_EQUAL(httpCode / 10, 30u); - - TransferData(&input, &dbg); - } - server.Stop(); - } - + output.Finish(); + } + + { + TSocketInput si(s); + THttpInput input(&si); + unsigned httpCode = ParseHttpRetCode(input.FirstLine()); + UNIT_ASSERT_VALUES_EQUAL(httpCode / 10, 30u); + + TransferData(&input, &dbg); + } + server.Stop(); + } + Y_UNIT_TEST(TestParseHttpRetCode) { UNIT_ASSERT_VALUES_EQUAL(ParseHttpRetCode("HTTP/1.1 301"), 301u); } diff --git a/library/cpp/http/server/http_ex.cpp b/library/cpp/http/server/http_ex.cpp index 71f815d276..e07db22bfc 100644 --- a/library/cpp/http/server/http_ex.cpp +++ b/library/cpp/http/server/http_ex.cpp @@ -33,7 +33,7 @@ bool THttpClientRequestExtension::ProcessHeaders(TBaseServerRequestData& rd, TBl Post, Put, Patch, - Delete, + Delete, }; enum EMethod foundMethod; @@ -51,9 +51,9 @@ bool THttpClientRequestExtension::ProcessHeaders(TBaseServerRequestData& rd, TBl } else if (strnicmp(s, "PATCH ", 6) == 0) { foundMethod = Patch; urlStart = s + 6; - } else if (strnicmp(s, "DELETE ", 7) == 0) { - foundMethod = Delete; - urlStart = s + 7; + } else if (strnicmp(s, "DELETE ", 7) == 0) { + foundMethod = Delete; + urlStart = s + 7; } else { foundMethod = NotImplemented; } |