diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:48 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:48 +0300 |
commit | 9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/http/io | |
parent | 8cbc307de0221f84c80c42dcbe07d40727537e2c (diff) | |
download | ydb-9abfb1a53b7f7b791444d1378e645d8fad9b06ed.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/http/io')
-rw-r--r-- | library/cpp/http/io/chunk.cpp | 14 | ||||
-rw-r--r-- | library/cpp/http/io/chunk.h | 10 | ||||
-rw-r--r-- | library/cpp/http/io/chunk_ut.cpp | 16 | ||||
-rw-r--r-- | library/cpp/http/io/headers.cpp | 52 | ||||
-rw-r--r-- | library/cpp/http/io/headers.h | 34 | ||||
-rw-r--r-- | library/cpp/http/io/stream.cpp | 62 | ||||
-rw-r--r-- | library/cpp/http/io/stream.h | 12 | ||||
-rw-r--r-- | library/cpp/http/io/stream_ut.cpp | 46 | ||||
-rw-r--r-- | library/cpp/http/io/stream_ut_medium.cpp | 2 |
9 files changed, 124 insertions, 124 deletions
diff --git a/library/cpp/http/io/chunk.cpp b/library/cpp/http/io/chunk.cpp index b43ca235f5..6975d9eac1 100644 --- a/library/cpp/http/io/chunk.cpp +++ b/library/cpp/http/io/chunk.cpp @@ -50,7 +50,7 @@ static inline char* ToHex(size_t len, char* buf) { class TChunkedInput::TImpl { public: - inline TImpl(IInputStream* slave, TMaybe<THttpHeaders>* trailers) + inline TImpl(IInputStream* slave, TMaybe<THttpHeaders>* trailers) : Slave_(slave) , Trailers_(trailers) , Pending_(0) @@ -136,13 +136,13 @@ private: } private: - IInputStream* Slave_; + IInputStream* Slave_; TMaybe<THttpHeaders>* Trailers_; size_t Pending_; bool LastChunkReaded_; }; -TChunkedInput::TChunkedInput(IInputStream* slave, TMaybe<THttpHeaders>* trailers) +TChunkedInput::TChunkedInput(IInputStream* slave, TMaybe<THttpHeaders>* trailers) : Impl_(new TImpl(slave, trailers)) { } @@ -159,10 +159,10 @@ size_t TChunkedInput::DoSkip(size_t len) { } class TChunkedOutput::TImpl { - typedef IOutputStream::TPart TPart; + typedef IOutputStream::TPart TPart; public: - inline TImpl(IOutputStream* slave) + inline TImpl(IOutputStream* slave) : Slave_(slave) { } @@ -209,10 +209,10 @@ public: } private: - IOutputStream* Slave_; + IOutputStream* Slave_; }; -TChunkedOutput::TChunkedOutput(IOutputStream* slave) +TChunkedOutput::TChunkedOutput(IOutputStream* slave) : Impl_(new TImpl(slave)) { } diff --git a/library/cpp/http/io/chunk.h b/library/cpp/http/io/chunk.h index 340515b2f7..88d89fafda 100644 --- a/library/cpp/http/io/chunk.h +++ b/library/cpp/http/io/chunk.h @@ -1,6 +1,6 @@ #pragma once -#include <util/stream/output.h> +#include <util/stream/output.h> #include <util/generic/maybe.h> #include <util/generic/ptr.h> @@ -11,11 +11,11 @@ class THttpHeaders; /// Ввод данных порциями. /// @details Последовательное чтение блоков данных. Предполагается, что /// данные записаны в виде <длина блока><блок данных>. -class TChunkedInput: public IInputStream { +class TChunkedInput: public IInputStream { public: /// Если передан указатель на trailers, то туда будут записаны HTTP trailer'ы (возможно пустые), /// которые идут после чанков. - TChunkedInput(IInputStream* slave, TMaybe<THttpHeaders>* trailers = nullptr); + TChunkedInput(IInputStream* slave, TMaybe<THttpHeaders>* trailers = nullptr); ~TChunkedInput() override; private: @@ -30,9 +30,9 @@ private: /// Вывод данных порциями. /// @details Вывод данных блоками в виде <длина блока><блок данных>. Если объем /// данных превышает 64K, они записываются в виде n блоков по 64K + то, что осталось. -class TChunkedOutput: public IOutputStream { +class TChunkedOutput: public IOutputStream { public: - TChunkedOutput(IOutputStream* slave); + TChunkedOutput(IOutputStream* slave); ~TChunkedOutput() override; private: diff --git a/library/cpp/http/io/chunk_ut.cpp b/library/cpp/http/io/chunk_ut.cpp index 44b2b9a66a..da283f8568 100644 --- a/library/cpp/http/io/chunk_ut.cpp +++ b/library/cpp/http/io/chunk_ut.cpp @@ -4,11 +4,11 @@ #include <util/stream/file.h> #include <util/system/tempfile.h> -#include <util/stream/null.h> +#include <util/stream/null.h> #define CDATA "./chunkedio" -Y_UNIT_TEST_SUITE(TestChunkedIO) { +Y_UNIT_TEST_SUITE(TestChunkedIO) { static const char test_data[] = "87s6cfbsudg cuisg s igasidftasiy tfrcua6s"; TString CombString(const TString& s, size_t chunkSize) { @@ -18,7 +18,7 @@ Y_UNIT_TEST_SUITE(TestChunkedIO) { return result; } - void WriteTestData(IOutputStream * stream, TString * contents) { + void WriteTestData(IOutputStream * stream, TString * contents) { contents->clear(); for (size_t i = 0; i < sizeof(test_data); ++i) { stream->Write(test_data, i); @@ -26,7 +26,7 @@ Y_UNIT_TEST_SUITE(TestChunkedIO) { } } - void ReadInSmallChunks(IInputStream * stream, TString * contents) { + void ReadInSmallChunks(IInputStream * stream, TString * contents) { char buf[11]; size_t read = 0; @@ -37,8 +37,8 @@ Y_UNIT_TEST_SUITE(TestChunkedIO) { } while (read > 0); } - void ReadCombed(IInputStream * stream, TString * contents, size_t chunkSize) { - Y_ASSERT(chunkSize < 128); + void ReadCombed(IInputStream * stream, TString * contents, size_t chunkSize) { + Y_ASSERT(chunkSize < 128); char buf[128]; contents->clear(); @@ -57,7 +57,7 @@ Y_UNIT_TEST_SUITE(TestChunkedIO) { } } - Y_UNIT_TEST(TestChunkedIo) { + Y_UNIT_TEST(TestChunkedIo) { TTempFile tmpFile(CDATA); TString tmp; @@ -88,7 +88,7 @@ Y_UNIT_TEST_SUITE(TestChunkedIO) { } } - Y_UNIT_TEST(TestBadChunk) { + Y_UNIT_TEST(TestBadChunk) { bool hasError = false; try { diff --git a/library/cpp/http/io/headers.cpp b/library/cpp/http/io/headers.cpp index 6358d23f01..4ec27a29e8 100644 --- a/library/cpp/http/io/headers.cpp +++ b/library/cpp/http/io/headers.cpp @@ -1,10 +1,10 @@ #include "headers.h" #include "stream.h" -#include <util/generic/strbuf.h> +#include <util/generic/strbuf.h> #include <util/generic/yexception.h> -#include <util/stream/output.h> -#include <util/string/ascii.h> +#include <util/stream/output.h> +#include <util/string/ascii.h> #include <util/string/cast.h> #include <util/string/strip.h> @@ -12,25 +12,25 @@ static inline TStringBuf Trim(const char* b, const char* e) noexcept { return StripString(TStringBuf(b, e)); } -THttpInputHeader::THttpInputHeader(const TStringBuf header) { +THttpInputHeader::THttpInputHeader(const TStringBuf header) { size_t pos = header.find(':'); if (pos == TString::npos) { ythrow THttpParseException() << "can not parse http header(" << TString{header}.Quote() << ")"; } - Name_ = TString(header.cbegin(), header.cbegin() + pos); - Value_ = ::ToString(Trim(header.cbegin() + pos + 1, header.cend())); + Name_ = TString(header.cbegin(), header.cbegin() + pos); + Value_ = ::ToString(Trim(header.cbegin() + pos + 1, header.cend())); } -THttpInputHeader::THttpInputHeader(TString name, TString value) - : Name_(std::move(name)) - , Value_(std::move(value)) +THttpInputHeader::THttpInputHeader(TString name, TString value) + : Name_(std::move(name)) + , Value_(std::move(value)) { } -void THttpInputHeader::OutTo(IOutputStream* stream) const { - typedef IOutputStream::TPart TPart; +void THttpInputHeader::OutTo(IOutputStream* stream) const { + typedef IOutputStream::TPart TPart; const TPart parts[] = { TPart(Name_), @@ -42,7 +42,7 @@ void THttpInputHeader::OutTo(IOutputStream* stream) const { stream->Write(parts, sizeof(parts) / sizeof(*parts)); } -THttpHeaders::THttpHeaders(IInputStream* stream) { +THttpHeaders::THttpHeaders(IInputStream* stream) { TString header; TString line; @@ -53,28 +53,28 @@ THttpHeaders::THttpHeaders(IInputStream* stream) { if (rdOk && ((line[0] == ' ') || (line[0] == '\t'))) { header += line; } else { - AddHeader(THttpInputHeader(header)); + AddHeader(THttpInputHeader(header)); header = line; } } } -bool THttpHeaders::HasHeader(const TStringBuf header) const { +bool THttpHeaders::HasHeader(const TStringBuf header) const { return FindHeader(header); } -const THttpInputHeader* THttpHeaders::FindHeader(const TStringBuf header) const { +const THttpInputHeader* THttpHeaders::FindHeader(const TStringBuf header) const { for (const auto& hdr : Headers_) { - if (AsciiCompareIgnoreCase(hdr.Name(), header) == 0) { + if (AsciiCompareIgnoreCase(hdr.Name(), header) == 0) { return &hdr; } } return nullptr; } -void THttpHeaders::RemoveHeader(const TStringBuf header) { - for (auto h = Headers_.begin(); h != Headers_.end(); ++h) { - if (AsciiCompareIgnoreCase(h->Name(), header) == 0) { +void THttpHeaders::RemoveHeader(const TStringBuf header) { + for (auto h = Headers_.begin(); h != Headers_.end(); ++h) { + if (AsciiCompareIgnoreCase(h->Name(), header) == 0) { Headers_.erase(h); return; } @@ -82,9 +82,9 @@ void THttpHeaders::RemoveHeader(const TStringBuf header) { } void THttpHeaders::AddOrReplaceHeader(const THttpInputHeader& header) { - for (auto& hdr : Headers_) { - if (AsciiCompareIgnoreCase(hdr.Name(), header.Name()) == 0) { - hdr = header; + for (auto& hdr : Headers_) { + if (AsciiCompareIgnoreCase(hdr.Name(), header.Name()) == 0) { + hdr = header; return; } } @@ -92,17 +92,17 @@ void THttpHeaders::AddOrReplaceHeader(const THttpInputHeader& header) { AddHeader(header); } -void THttpHeaders::AddHeader(THttpInputHeader header) { - Headers_.push_back(std::move(header)); +void THttpHeaders::AddHeader(THttpInputHeader header) { + Headers_.push_back(std::move(header)); } -void THttpHeaders::OutTo(IOutputStream* stream) const { +void THttpHeaders::OutTo(IOutputStream* stream) const { for (TConstIterator header = Begin(); header != End(); ++header) { header->OutTo(stream); } } template <> -void Out<THttpHeaders>(IOutputStream& out, const THttpHeaders& h) { +void Out<THttpHeaders>(IOutputStream& out, const THttpHeaders& h) { h.OutTo(&out); } diff --git a/library/cpp/http/io/headers.h b/library/cpp/http/io/headers.h index 43c6818cd6..a71793d1c6 100644 --- a/library/cpp/http/io/headers.h +++ b/library/cpp/http/io/headers.h @@ -6,8 +6,8 @@ #include <util/generic/vector.h> #include <util/string/cast.h> -class IInputStream; -class IOutputStream; +class IInputStream; +class IOutputStream; /// @addtogroup Streams_HTTP /// @{ @@ -15,10 +15,10 @@ class IOutputStream; class THttpInputHeader { public: /// @param[in] header - строка вида 'параметр: значение'. - THttpInputHeader(TStringBuf header); + THttpInputHeader(TStringBuf header); /// @param[in] name - имя параметра. /// @param[in] value - значение параметра. - THttpInputHeader(TString name, TString value); + THttpInputHeader(TString name, TString value); /// Возвращает имя параметра. inline const TString& Name() const noexcept { @@ -31,7 +31,7 @@ public: } /// Записывает заголовок вида "имя параметра: значение\r\n" в поток. - void OutTo(IOutputStream* stream) const; + void OutTo(IOutputStream* stream) const; /// Возвращает строку "имя параметра: значение". inline TString ToString() const { @@ -45,15 +45,15 @@ private: /// Контейнер для хранения HTTP-заголовков class THttpHeaders { - using THeaders = TDeque<THttpInputHeader>; + using THeaders = TDeque<THttpInputHeader>; public: - using TConstIterator = THeaders::const_iterator; + using TConstIterator = THeaders::const_iterator; + + THttpHeaders() = default; - THttpHeaders() = default; - /// Добавляет каждую строку из потока в контейнер, считая ее правильным заголовком. - THttpHeaders(IInputStream* stream); + THttpHeaders(IInputStream* stream); /// Стандартный итератор. inline TConstIterator Begin() const noexcept { @@ -82,11 +82,11 @@ public: } /// Добавляет заголовок в контейнер. - void AddHeader(THttpInputHeader header); + void AddHeader(THttpInputHeader header); template <typename ValueType> - void AddHeader(TString name, const ValueType& value) { - AddHeader(THttpInputHeader(std::move(name), ToString(value))); + void AddHeader(TString name, const ValueType& value) { + AddHeader(THttpInputHeader(std::move(name), ToString(value))); } /// Добавляет заголовок в контейнер, если тот не содержит заголовка @@ -100,18 +100,18 @@ public: } // Проверяет, есть ли такой заголовок - bool HasHeader(TStringBuf header) const; + bool HasHeader(TStringBuf header) const; /// Удаляет заголовок, если он есть. - void RemoveHeader(TStringBuf header); + void RemoveHeader(TStringBuf header); /// Ищет заголовок по указанному имени /// Возвращает nullptr, если не нашел - const THttpInputHeader* FindHeader(TStringBuf header) const; + const THttpInputHeader* FindHeader(TStringBuf header) const; /// Записывает все заголовки контейнера в поток. /// @details Каждый заголовк записывается в виде "имя параметра: значение\r\n". - void OutTo(IOutputStream* stream) const; + void OutTo(IOutputStream* stream) const; /// Обменивает наборы заголовков двух контейнеров. void Swap(THttpHeaders& headers) noexcept { diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp index 317ce6a215..6689be684f 100644 --- a/library/cpp/http/io/stream.cpp +++ b/library/cpp/http/io/stream.cpp @@ -6,7 +6,7 @@ #include <util/stream/buffered.h> #include <util/stream/length.h> #include <util/stream/multi.h> -#include <util/stream/null.h> +#include <util/stream/null.h> #include <util/stream/tee.h> #include <util/system/compat.h> @@ -15,7 +15,7 @@ #include <util/network/socket.h> #include <util/string/cast.h> -#include <util/string/strip.h> +#include <util/string/strip.h> #include <util/generic/string.h> #include <util/generic/utility.h> @@ -134,7 +134,7 @@ class THttpInput::TImpl { typedef THashSet<TString> TAcceptCodings; public: - inline TImpl(IInputStream* slave) + inline TImpl(IInputStream* slave) : Slave_(slave) , Buffered_(Slave_, SuggestBufferSize()) , ChunkedInput_(nullptr) @@ -148,7 +148,7 @@ public: , Expect100Continue_(false) { BuildInputChain(); - Y_ASSERT(Input_); + Y_ASSERT(Input_); } static TString ReadFirstLine(TBufferedInput& in) { @@ -361,19 +361,19 @@ private: } private: - IInputStream* Slave_; + IInputStream* Slave_; /* * input helpers */ TBufferedInput Buffered_; - TStreams<IInputStream, 8> Streams_; - IInputStream* ChunkedInput_; + TStreams<IInputStream, 8> Streams_; + IInputStream* ChunkedInput_; /* * final input stream */ - IInputStream* Input_; + IInputStream* Input_; TString FirstLine_; THttpHeaders Headers_; @@ -389,7 +389,7 @@ private: bool Expect100Continue_; }; -THttpInput::THttpInput(IInputStream* slave) +THttpInput::THttpInput(IInputStream* slave) : Impl_(new TImpl(slave)) { } @@ -457,7 +457,7 @@ bool THttpInput::HasExpect100Continue() const noexcept { } class THttpOutput::TImpl { - class TSizeCalculator: public IOutputStream { + class TSizeCalculator: public IOutputStream { public: inline TSizeCalculator() noexcept { } @@ -484,19 +484,19 @@ class THttpOutput::TImpl { }; struct TFlush { - inline void operator()(IOutputStream* s) { + inline void operator()(IOutputStream* s) { s->Flush(); } }; struct TFinish { - inline void operator()(IOutputStream* s) { + inline void operator()(IOutputStream* s) { s->Finish(); } }; public: - inline TImpl(IOutputStream* slave, THttpInput* request) + inline TImpl(IOutputStream* slave, THttpInput* request) : Slave_(slave) , State_(Begin) , Output_(Slave_) @@ -710,7 +710,7 @@ private: } inline void Process(const TString& s) { - Y_ASSERT(State_ != HeadersSent); + Y_ASSERT(State_ != HeadersSent); if (State_ == Begin) { FirstLine_ = s; @@ -722,12 +722,12 @@ private: WriteCached(); State_ = HeadersSent; } else { - AddHeader(THttpInputHeader(s)); + AddHeader(THttpInputHeader(s)); } } } - inline void WriteCachedImpl(IOutputStream* s) const { + inline void WriteCachedImpl(IOutputStream* s) const { s->Write(FirstLine_.data(), FirstLine_.size()); s->Write("\r\n", 2); Headers_.OutTo(s); @@ -855,10 +855,10 @@ private: } private: - IOutputStream* Slave_; + IOutputStream* Slave_; TState State_; - IOutputStream* Output_; - TStreams<IOutputStream, 8> Streams_; + IOutputStream* Output_; + TStreams<IOutputStream, 8> Streams_; TString Line_; TString FirstLine_; THttpHeaders Headers_; @@ -876,12 +876,12 @@ private: TSizeCalculator SizeCalculator_; }; -THttpOutput::THttpOutput(IOutputStream* slave) +THttpOutput::THttpOutput(IOutputStream* slave) : Impl_(new TImpl(slave, nullptr)) { } -THttpOutput::THttpOutput(IOutputStream* slave, THttpInput* request) +THttpOutput::THttpOutput(IOutputStream* slave, THttpInput* request) : Impl_(new TImpl(slave, request)) { } @@ -979,21 +979,21 @@ void SendMinimalHttpRequest(TSocket& s, const TStringBuf& host, const TStringBuf output.EnableKeepAlive(false); output.EnableCompression(false); - const IOutputStream::TPart parts[] = { + const IOutputStream::TPart parts[] = { IOutputStream::TPart(TStringBuf("GET ")), - IOutputStream::TPart(request), + IOutputStream::TPart(request), IOutputStream::TPart(TStringBuf(" HTTP/1.1")), - IOutputStream::TPart::CrLf(), + IOutputStream::TPart::CrLf(), IOutputStream::TPart(TStringBuf("Host: ")), - IOutputStream::TPart(host), - IOutputStream::TPart::CrLf(), + IOutputStream::TPart(host), + IOutputStream::TPart::CrLf(), IOutputStream::TPart(TStringBuf("User-Agent: ")), - IOutputStream::TPart(agent), - IOutputStream::TPart::CrLf(), + IOutputStream::TPart(agent), + IOutputStream::TPart::CrLf(), IOutputStream::TPart(TStringBuf("From: ")), - IOutputStream::TPart(from), - IOutputStream::TPart::CrLf(), - IOutputStream::TPart::CrLf(), + IOutputStream::TPart(from), + IOutputStream::TPart::CrLf(), + IOutputStream::TPart::CrLf(), }; output.Write(parts, sizeof(parts) / sizeof(*parts)); diff --git a/library/cpp/http/io/stream.h b/library/cpp/http/io/stream.h index 1003042281..78ca4fc814 100644 --- a/library/cpp/http/io/stream.h +++ b/library/cpp/http/io/stream.h @@ -2,7 +2,7 @@ #include "headers.h" -#include <util/stream/output.h> +#include <util/stream/output.h> #include <util/generic/maybe.h> #include <util/generic/ptr.h> #include <util/generic/string.h> @@ -22,9 +22,9 @@ struct THttpReadException: public THttpException { }; /// Чтение ответа HTTP-сервера. -class THttpInput: public IInputStream { +class THttpInput: public IInputStream { public: - THttpInput(IInputStream* slave); + THttpInput(IInputStream* slave); THttpInput(THttpInput&& httpInput); ~THttpInput() override; @@ -96,10 +96,10 @@ private: }; /// Передача запроса HTTP-серверу. -class THttpOutput: public IOutputStream { +class THttpOutput: public IOutputStream { public: - THttpOutput(IOutputStream* slave); - THttpOutput(IOutputStream* slave, THttpInput* request); + THttpOutput(IOutputStream* slave); + THttpOutput(IOutputStream* slave, THttpInput* request); ~THttpOutput() override; /* diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp index 9578b4e7e0..1ea35df675 100644 --- a/library/cpp/http/io/stream_ut.cpp +++ b/library/cpp/http/io/stream_ut.cpp @@ -8,11 +8,11 @@ #include <util/string/printf.h> #include <util/network/socket.h> -#include <util/stream/file.h> -#include <util/stream/output.h> -#include <util/stream/tee.h> +#include <util/stream/file.h> +#include <util/stream/output.h> +#include <util/stream/tee.h> #include <util/stream/zlib.h> -#include <util/stream/null.h> +#include <util/stream/null.h> Y_UNIT_TEST_SUITE(THttpStreamTest) { class TTestHttpServer: public THttpServer::ICallBack { @@ -78,11 +78,11 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { size_t LastRequestSentSize_ = 0; }; - Y_UNIT_TEST(TestCodings1) { + Y_UNIT_TEST(TestCodings1) { UNIT_ASSERT(SupportedCodings().size() > 0); } - Y_UNIT_TEST(TestHttpInput) { + Y_UNIT_TEST(TestHttpInput) { TString res = "I'm a teapot"; TPortManager pm; const ui16 port = pm.GetPort(); @@ -128,7 +128,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { server.Stop(); } - Y_UNIT_TEST(TestHttpInputDelete) { + Y_UNIT_TEST(TestHttpInputDelete) { TString res = "I'm a teapot"; TPortManager pm; const ui16 port = pm.GetPort(); @@ -174,11 +174,11 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { server.Stop(); } - Y_UNIT_TEST(TestParseHttpRetCode) { + Y_UNIT_TEST(TestParseHttpRetCode) { UNIT_ASSERT_VALUES_EQUAL(ParseHttpRetCode("HTTP/1.1 301"), 301u); } - Y_UNIT_TEST(TestKeepAlive) { + Y_UNIT_TEST(TestKeepAlive) { { TString s = "GET / HTTP/1.0\r\n\r\n"; TStringInput si(s); @@ -236,7 +236,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { } } - Y_UNIT_TEST(TestMinRequest) { + Y_UNIT_TEST(TestMinRequest) { TString res = "qqqqqq"; TPortManager pm; const ui16 port = pm.GetPort(); @@ -262,7 +262,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { server.Stop(); } - Y_UNIT_TEST(TestResponseWithBlanks) { + Y_UNIT_TEST(TestResponseWithBlanks) { TString res = "qqqqqq\r\n\r\nsdasdsad\r\n"; TPortManager pm; const ui16 port = pm.GetPort(); @@ -287,7 +287,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { server.Stop(); } - Y_UNIT_TEST(TestOutputFlush) { + Y_UNIT_TEST(TestOutputFlush) { TString str; TStringOutput strOut(str); TBufferedOutput bufOut(&strOut, 8192); @@ -307,7 +307,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { UNIT_ASSERT_VALUES_EQUAL(curLen + strlen(body), str.size()); } - Y_UNIT_TEST(TestOutputPostFlush) { + Y_UNIT_TEST(TestOutputPostFlush) { TString str; TString checkStr; TStringOutput strOut(str); @@ -372,7 +372,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { UNIT_ASSERT(MakeHttpOutputBody(body, true) == SimulateBodyEncoding(body)); } - Y_UNIT_TEST(TestOutputFinish) { + Y_UNIT_TEST(TestOutputFinish) { TString str; TStringOutput strOut(str); TBufferedOutput bufOut(&strOut, 8192); @@ -392,7 +392,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { UNIT_ASSERT_VALUES_EQUAL(curLen + strlen(body), str.size()); } - Y_UNIT_TEST(TestMultilineHeaders) { + Y_UNIT_TEST(TestMultilineHeaders) { const char* headerLine0 = "HTTP/1.1 200 OK"; const char* headerLine1 = "Content-Language: en"; const char* headerLine2 = "Vary: Accept-Encoding, "; @@ -419,7 +419,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { UNIT_ASSERT_VALUES_EQUAL((++it)->ToString(), TString(headerLine4)); } - Y_UNIT_TEST(ContentLengthRemoval) { + Y_UNIT_TEST(ContentLengthRemoval) { TMemoryInput request("GET / HTTP/1.1\r\nAccept-Encoding: gzip\r\n\r\n"); THttpInput i(&request); TString result; @@ -487,7 +487,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { UNIT_ASSERT(result.Contains("content-encoding: gzip")); } - Y_UNIT_TEST(HasTrailers) { + Y_UNIT_TEST(HasTrailers) { TMemoryInput response( "HTTP/1.1 200 OK\r\n" "Transfer-Encoding: chunked\r\n" @@ -506,7 +506,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { UNIT_ASSERT_VALUES_EQUAL(trailers.GetRef().Begin()->ToString(), "Bar: baz"); } - Y_UNIT_TEST(NoTrailersWithChunks) { + Y_UNIT_TEST(NoTrailersWithChunks) { TMemoryInput response( "HTTP/1.1 200 OK\r\n" "Transfer-Encoding: chunked\r\n" @@ -523,7 +523,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { UNIT_ASSERT_VALUES_EQUAL(trailers.GetRef().Count(), 0); } - Y_UNIT_TEST(NoTrailersNoChunks) { + Y_UNIT_TEST(NoTrailersNoChunks) { TMemoryInput response( "HTTP/1.1 200 OK\r\n" "Content-Length: 3\r\n" @@ -537,7 +537,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { UNIT_ASSERT_VALUES_EQUAL(trailers.GetRef().Count(), 0); } - Y_UNIT_TEST(RequestWithoutContentLength) { + Y_UNIT_TEST(RequestWithoutContentLength) { TStringStream request; { THttpOutput httpOutput(&request); @@ -565,7 +565,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { } } - Y_UNIT_TEST(TestInputHasContent) { + Y_UNIT_TEST(TestInputHasContent) { { TStringStream request; request << "POST / HTTP/1.1\r\n" @@ -611,7 +611,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { } } - Y_UNIT_TEST(TestHttpInputHeadRequest) { + Y_UNIT_TEST(TestHttpInputHeadRequest) { class THeadOnlyInput: public IInputStream { public: THeadOnlyInput() = default; @@ -645,7 +645,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { UNIT_ASSERT_VALUES_EQUAL(httpInput.ReadAll(), ""); } - Y_UNIT_TEST(TestHttpOutputResponseToHeadRequestNoZeroChunk) { + Y_UNIT_TEST(TestHttpOutputResponseToHeadRequestNoZeroChunk) { TStringStream request; request << "HEAD / HTTP/1.1\r\n" "Host: yandex.ru\r\n" diff --git a/library/cpp/http/io/stream_ut_medium.cpp b/library/cpp/http/io/stream_ut_medium.cpp index fb5c425b02..2c125eb21e 100644 --- a/library/cpp/http/io/stream_ut_medium.cpp +++ b/library/cpp/http/io/stream_ut_medium.cpp @@ -3,7 +3,7 @@ #include <util/stream/zlib.h> Y_UNIT_TEST_SUITE(THttpTestMedium) { - Y_UNIT_TEST(TestCodings2) { + Y_UNIT_TEST(TestCodings2) { TStringBuf data = "aaaaaaaaaaaaaaaaaaaaaaa"; for (auto codec : SupportedCodings()) { |