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 | f20fed3ce6cdb52b09a0d5e53388e293e805ac81 (patch) | |
tree | 67422579185c14e02357ae67f49d1fac9433d601 | |
parent | 2091a6649bd6d42b9c8fd5f480948d0959fda869 (diff) | |
download | ydb-f20fed3ce6cdb52b09a0d5e53388e293e805ac81.tar.gz |
Restoring authorship annotation for <nataxane@yandex-team.ru>. Commit 1 of 2.
-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 2f3d131f8c..5871f2e9a1 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 1ea35df675..9630ba530a 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 e07db22bfc..71f815d276 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; } |