aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/http
diff options
context:
space:
mode:
authoryazevnul <yazevnul@yandex-team.ru>2022-02-10 16:46:48 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:48 +0300
commit9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/http
parent8cbc307de0221f84c80c42dcbe07d40727537e2c (diff)
downloadydb-9abfb1a53b7f7b791444d1378e645d8fad9b06ed.tar.gz
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/http')
-rw-r--r--library/cpp/http/fetch/http_digest.cpp4
-rw-r--r--library/cpp/http/fetch/httpfsm_ut.cpp16
-rw-r--r--library/cpp/http/fetch/httpparser.h4
-rw-r--r--library/cpp/http/fetch/httpparser_ut.cpp18
-rw-r--r--library/cpp/http/fetch/httpzreader.h2
-rw-r--r--library/cpp/http/io/chunk.cpp14
-rw-r--r--library/cpp/http/io/chunk.h10
-rw-r--r--library/cpp/http/io/chunk_ut.cpp16
-rw-r--r--library/cpp/http/io/headers.cpp52
-rw-r--r--library/cpp/http/io/headers.h34
-rw-r--r--library/cpp/http/io/stream.cpp62
-rw-r--r--library/cpp/http/io/stream.h12
-rw-r--r--library/cpp/http/io/stream_ut.cpp46
-rw-r--r--library/cpp/http/io/stream_ut_medium.cpp2
-rw-r--r--library/cpp/http/misc/httpdate.cpp4
-rw-r--r--library/cpp/http/misc/httpdate_ut.cpp6
-rw-r--r--library/cpp/http/misc/httpreqdata.cpp4
-rw-r--r--library/cpp/http/misc/httpreqdata_ut.cpp22
-rw-r--r--library/cpp/http/misc/parsed_request.cpp2
-rw-r--r--library/cpp/http/misc/parsed_request_ut.cpp6
-rw-r--r--library/cpp/http/server/conn.cpp2
-rw-r--r--library/cpp/http/server/http.cpp2
-rw-r--r--library/cpp/http/server/http_ut.cpp16
-rw-r--r--library/cpp/http/server/options.cpp2
-rw-r--r--library/cpp/http/server/response.cpp22
-rw-r--r--library/cpp/http/server/response.h12
-rw-r--r--library/cpp/http/server/response_ut.cpp22
27 files changed, 207 insertions, 207 deletions
diff --git a/library/cpp/http/fetch/http_digest.cpp b/library/cpp/http/fetch/http_digest.cpp
index 480f4b0c51..1eaa02b7f2 100644
--- a/library/cpp/http/fetch/http_digest.cpp
+++ b/library/cpp/http/fetch/http_digest.cpp
@@ -1,8 +1,8 @@
#include "http_digest.h"
#include <library/cpp/digest/md5/md5.h>
-#include <util/stream/output.h>
-#include <util/stream/str.h>
+#include <util/stream/output.h>
+#include <util/stream/str.h>
/************************************************************/
/************************************************************/
diff --git a/library/cpp/http/fetch/httpfsm_ut.cpp b/library/cpp/http/fetch/httpfsm_ut.cpp
index 63790456bc..b018e80101 100644
--- a/library/cpp/http/fetch/httpfsm_ut.cpp
+++ b/library/cpp/http/fetch/httpfsm_ut.cpp
@@ -488,7 +488,7 @@ void THttpHeaderParserTestSuite::TestRepeatedContentEncoding() {
UNIT_TEST_SUITE_REGISTRATION(THttpHeaderParserTestSuite);
-Y_UNIT_TEST_SUITE(TestHttpChunkParser) {
+Y_UNIT_TEST_SUITE(TestHttpChunkParser) {
static THttpChunkParser initParser() {
THttpChunkParser parser;
parser.Init();
@@ -513,7 +513,7 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) {
return parseByteByByte(blob, states);
}
- Y_UNIT_TEST(TestWithoutEolHead) {
+ Y_UNIT_TEST(TestWithoutEolHead) {
const TStringBuf blob{
"4\r\n"
"____\r\n"};
@@ -527,7 +527,7 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) {
parseByteByByte(blob, states);
}
- Y_UNIT_TEST(TestTrivialChunk) {
+ Y_UNIT_TEST(TestTrivialChunk) {
const TStringBuf blob{
"\r\n"
"4\r\n"};
@@ -536,7 +536,7 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) {
UNIT_ASSERT_EQUAL(parser.cnt64, 4);
}
- Y_UNIT_TEST(TestNegative) {
+ Y_UNIT_TEST(TestNegative) {
const TStringBuf blob{
"\r\n"
"-1"};
@@ -547,7 +547,7 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) {
parseByteByByte(blob, states);
}
- Y_UNIT_TEST(TestLeadingZero) {
+ Y_UNIT_TEST(TestLeadingZero) {
const TStringBuf blob{
"\r\n"
"042\r\n"};
@@ -555,7 +555,7 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) {
UNIT_ASSERT_EQUAL(parser.chunk_length, 0x42);
}
- Y_UNIT_TEST(TestIntOverflow) {
+ Y_UNIT_TEST(TestIntOverflow) {
const TStringBuf blob{
"\r\n"
"deadbeef"};
@@ -564,7 +564,7 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) {
UNIT_ASSERT_EQUAL(parser.cnt64, 0xdeadbeef);
}
- Y_UNIT_TEST(TestTrivialChunkWithTail) {
+ Y_UNIT_TEST(TestTrivialChunkWithTail) {
const TStringBuf blob{
"\r\n"
"4\r\n"
@@ -577,7 +577,7 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) {
parseByteByByte(blob, states);
}
- Y_UNIT_TEST(TestLastChunk) {
+ Y_UNIT_TEST(TestLastChunk) {
// NB: current parser does not permit whitespace before `foo`,
// but I've never seen the feature in real-life traffic
const TStringBuf blob{
diff --git a/library/cpp/http/fetch/httpparser.h b/library/cpp/http/fetch/httpparser.h
index 078eb5f99d..769828e4ae 100644
--- a/library/cpp/http/fetch/httpparser.h
+++ b/library/cpp/http/fetch/httpparser.h
@@ -207,7 +207,7 @@ protected:
size -= long(ChunkParser.lastchar - (char*)buf + 1);
buf = ChunkParser.lastchar + 1;
ChunkSize = ChunkParser.chunk_length;
- Y_ASSERT(ChunkSize >= 0);
+ Y_ASSERT(ChunkSize >= 0);
State = ChunkSize ? hp_read_chunk : hp_eof;
} else {
Header->entity_size += size;
@@ -264,7 +264,7 @@ public:
return 0;
}
long Read(void*& buf) {
- Y_ASSERT(Bufsize >= 0);
+ Y_ASSERT(Bufsize >= 0);
if (!Bufsize) {
Bufsize = -1;
return 0;
diff --git a/library/cpp/http/fetch/httpparser_ut.cpp b/library/cpp/http/fetch/httpparser_ut.cpp
index e63964c5f5..3b3b938e7a 100644
--- a/library/cpp/http/fetch/httpparser_ut.cpp
+++ b/library/cpp/http/fetch/httpparser_ut.cpp
@@ -9,7 +9,7 @@
}
template <>
-void Out<THttpParserBase::States>(IOutputStream& out, THttpParserBase::States st) {
+void Out<THttpParserBase::States>(IOutputStream& out, THttpParserBase::States st) {
using type = THttpParserBase::States;
switch (st) {
ENUM_OUT(hp_error)
@@ -46,8 +46,8 @@ namespace {
}
-Y_UNIT_TEST_SUITE(TestHttpParser) {
- Y_UNIT_TEST(TestTrivialRequest) {
+Y_UNIT_TEST_SUITE(TestHttpParser) {
+ Y_UNIT_TEST(TestTrivialRequest) {
const TString blob{
"GET /search?q=hi HTTP/1.1\r\n"
"Host: www.google.ru:8080 \r\n"
@@ -60,7 +60,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) {
}
// XXX: `entity_size` is i32 and `content_length` is i64!
- Y_UNIT_TEST(TestTrivialResponse) {
+ Y_UNIT_TEST(TestTrivialResponse) {
const TString blob{
"HTTP/1.1 200 Ok\r\n"
"Content-Length: 2\r\n"
@@ -80,7 +80,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) {
}
// XXX: `entity_size` is off by one in TE:chunked case.
- Y_UNIT_TEST(TestChunkedResponse) {
+ Y_UNIT_TEST(TestChunkedResponse) {
const TString blob{
"HTTP/1.1 200 OK\r\n"
"Transfer-Encoding: chunked\r\n"
@@ -130,7 +130,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) {
"\r\n"));
}
- Y_UNIT_TEST(TestPipelineClenByteByByte) {
+ Y_UNIT_TEST(TestPipelineClenByteByByte) {
const TString& blob = PipelineClenBlob_;
THttpHeader hdr;
TTestHttpParser parser;
@@ -146,7 +146,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) {
}
// XXX: Content-Length is ignored, Body() looks unexpected!
- Y_UNIT_TEST(TestPipelineClenOneChunk) {
+ Y_UNIT_TEST(TestPipelineClenOneChunk) {
const TString& blob = PipelineClenBlob_;
THttpHeader hdr;
TTestHttpParser parser;
@@ -205,7 +205,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) {
"\r\n"));
}
- Y_UNIT_TEST(TestPipelineChunkedByteByByte) {
+ Y_UNIT_TEST(TestPipelineChunkedByteByByte) {
const TString& blob = PipelineChunkedBlob_;
THttpHeader hdr;
TTestHttpParser parser;
@@ -220,7 +220,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) {
AssertPipelineChunked(parser, hdr);
}
- Y_UNIT_TEST(TestPipelineChunkedOneChunk) {
+ Y_UNIT_TEST(TestPipelineChunkedOneChunk) {
const TString& blob = PipelineChunkedBlob_;
THttpHeader hdr;
TTestHttpParser parser;
diff --git a/library/cpp/http/fetch/httpzreader.h b/library/cpp/http/fetch/httpzreader.h
index fe106dabf7..68eb00853d 100644
--- a/library/cpp/http/fetch/httpzreader.h
+++ b/library/cpp/http/fetch/httpzreader.h
@@ -107,7 +107,7 @@ public:
int err = inflate(&Stream, Z_SYNC_FLUSH);
- //Y_ASSERT(Stream.avail_in == 0);
+ //Y_ASSERT(Stream.avail_in == 0);
switch (err) {
case Z_OK:
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()) {
diff --git a/library/cpp/http/misc/httpdate.cpp b/library/cpp/http/misc/httpdate.cpp
index 563f356787..4a3031bbf4 100644
--- a/library/cpp/http/misc/httpdate.cpp
+++ b/library/cpp/http/misc/httpdate.cpp
@@ -71,13 +71,13 @@ char* format_http_date(time_t when, char* buf, size_t buflen) {
return nullptr;
}
- Y_ASSERT(len > 0 && size_t(len) < buflen);
+ Y_ASSERT(len > 0 && size_t(len) < buflen);
return buf;
}
TString FormatHttpDate(time_t when) {
char str[64] = {0};
- format_http_date(str, Y_ARRAY_SIZE(str), when);
+ format_http_date(str, Y_ARRAY_SIZE(str), when);
return TString(str);
}
diff --git a/library/cpp/http/misc/httpdate_ut.cpp b/library/cpp/http/misc/httpdate_ut.cpp
index 30c8a1b19f..c1a0103501 100644
--- a/library/cpp/http/misc/httpdate_ut.cpp
+++ b/library/cpp/http/misc/httpdate_ut.cpp
@@ -2,14 +2,14 @@
#include "httpdate.h"
-Y_UNIT_TEST_SUITE(TestHttpDate) {
- Y_UNIT_TEST(Test1) {
+Y_UNIT_TEST_SUITE(TestHttpDate) {
+ Y_UNIT_TEST(Test1) {
char buf1[100];
char buf2[100];
UNIT_ASSERT((int)strlen(format_http_date(0, buf1, sizeof(buf1))) == format_http_date(buf2, sizeof(buf2), 0));
}
- Y_UNIT_TEST(Test2) {
+ Y_UNIT_TEST(Test2) {
UNIT_ASSERT_STRINGS_EQUAL(FormatHttpDate(1234567890), "Fri, 13 Feb 2009 23:31:30 GMT");
}
}
diff --git a/library/cpp/http/misc/httpreqdata.cpp b/library/cpp/http/misc/httpreqdata.cpp
index 2ae2c36339..f6951f68cd 100644
--- a/library/cpp/http/misc/httpreqdata.cpp
+++ b/library/cpp/http/misc/httpreqdata.cpp
@@ -29,7 +29,7 @@ TBaseServerRequestData::TBaseServerRequestData(const char* qs, SOCKET s)
void TBaseServerRequestData::AppendQueryString(const char* str, size_t length) {
if (Y_UNLIKELY(Search)) {
- Y_ASSERT(strlen(Search) == SearchLength);
+ Y_ASSERT(strlen(Search) == SearchLength);
ModifiedQueryString.Reserve(SearchLength + length + 2);
ModifiedQueryString.Assign(Search, SearchLength);
if (SearchLength > 0 && Search[SearchLength - 1] != '&' &&
@@ -170,7 +170,7 @@ bool TBaseServerRequestData::Parse(const char* origReq) {
ptrdiff_t delta = fragment - Search;
// indeed, second case is a parse error
SearchLength = (delta >= 0) ? delta : (urlEnd - Search);
- Y_ASSERT(strlen(Search) == SearchLength);
+ Y_ASSERT(strlen(Search) == SearchLength);
} else {
SearchLength = 0;
}
diff --git a/library/cpp/http/misc/httpreqdata_ut.cpp b/library/cpp/http/misc/httpreqdata_ut.cpp
index 88ec48c666..e7f16ef27c 100644
--- a/library/cpp/http/misc/httpreqdata_ut.cpp
+++ b/library/cpp/http/misc/httpreqdata_ut.cpp
@@ -2,8 +2,8 @@
#include <library/cpp/testing/unittest/registar.h>
-Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
- Y_UNIT_TEST(Headers) {
+Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
+ Y_UNIT_TEST(Headers) {
TServerRequestData sd;
sd.AddHeader("x-xx", "y-yy");
@@ -17,7 +17,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XXX")), TStringBuf("y-yyy"));
}
- Y_UNIT_TEST(ComplexHeaders) {
+ Y_UNIT_TEST(ComplexHeaders) {
TServerRequestData sd;
sd.SetHost("zzz", 1);
@@ -42,7 +42,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
UNIT_ASSERT_VALUES_EQUAL(sd.ServerPort(), "678");
}
- Y_UNIT_TEST(ParseScan) {
+ Y_UNIT_TEST(ParseScan) {
TServerRequestData rd;
// Parse parses url without host
@@ -62,7 +62,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
rd.Clear();
}
- Y_UNIT_TEST(Ctor) {
+ Y_UNIT_TEST(Ctor) {
const TString qs("gta=fake&haha=da");
TServerRequestData rd(qs.c_str());
@@ -74,7 +74,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
UNIT_ASSERT(!rd.CgiParam.Has("no-param"));
}
- Y_UNIT_TEST(HashCut) {
+ Y_UNIT_TEST(HashCut) {
const TString qs("&gta=fake&haha=da");
const TString header = " /yandsearch?" + qs + "#&uberParam=yes&q=? HTTP 1.1 OK";
@@ -90,7 +90,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
UNIT_ASSERT(!rd.CgiParam.Has("uberParam"));
}
- Y_UNIT_TEST(MisplacedHashCut) {
+ Y_UNIT_TEST(MisplacedHashCut) {
TServerRequestData rd;
rd.Parse(" /y#ndsearch?&gta=fake&haha=da&uberParam=yes&q=? HTTP 1.1 OK");
@@ -101,7 +101,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
UNIT_ASSERT(rd.CgiParam.empty());
}
- Y_UNIT_TEST(CornerCase) {
+ Y_UNIT_TEST(CornerCase) {
TServerRequestData rd;
rd.Parse(" /yandsearch?#");
@@ -112,7 +112,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
UNIT_ASSERT(rd.CgiParam.empty());
}
- Y_UNIT_TEST(AppendQueryString) {
+ Y_UNIT_TEST(AppendQueryString) {
const TString qs("gta=fake&haha=da");
TServerRequestData rd(qs.c_str());
@@ -134,7 +134,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
UNIT_ASSERT(rd.CgiParam.Has("gta", "new"));
}
- Y_UNIT_TEST(SetRemoteAddrSimple) {
+ Y_UNIT_TEST(SetRemoteAddrSimple) {
static const TString TEST = "abacaba.search.yandex.net";
TServerRequestData rd;
@@ -142,7 +142,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
UNIT_ASSERT_STRINGS_EQUAL(TEST, rd.RemoteAddr());
}
- Y_UNIT_TEST(SetRemoteAddrRandom) {
+ Y_UNIT_TEST(SetRemoteAddrRandom) {
for (size_t size = 0; size < 2 * INET6_ADDRSTRLEN; ++size) {
const TString test = NUnitTest::RandomString(size, size);
TServerRequestData rd;
diff --git a/library/cpp/http/misc/parsed_request.cpp b/library/cpp/http/misc/parsed_request.cpp
index d109239054..e332a24e91 100644
--- a/library/cpp/http/misc/parsed_request.cpp
+++ b/library/cpp/http/misc/parsed_request.cpp
@@ -1,6 +1,6 @@
#include "parsed_request.h"
-#include <util/string/strip.h>
+#include <util/string/strip.h>
#include <util/generic/yexception.h>
#include <util/string/cast.h>
diff --git a/library/cpp/http/misc/parsed_request_ut.cpp b/library/cpp/http/misc/parsed_request_ut.cpp
index 095c7e59c8..da6d95c6ab 100644
--- a/library/cpp/http/misc/parsed_request_ut.cpp
+++ b/library/cpp/http/misc/parsed_request_ut.cpp
@@ -2,8 +2,8 @@
#include <library/cpp/testing/unittest/registar.h>
-Y_UNIT_TEST_SUITE(THttpParse) {
- Y_UNIT_TEST(TestParse) {
+Y_UNIT_TEST_SUITE(THttpParse) {
+ Y_UNIT_TEST(TestParse) {
TParsedHttpFull h("GET /yandsearch?text=nokia HTTP/1.1");
UNIT_ASSERT_EQUAL(h.Method, "GET");
@@ -14,7 +14,7 @@ Y_UNIT_TEST_SUITE(THttpParse) {
UNIT_ASSERT_EQUAL(h.Cgi, "text=nokia");
}
- Y_UNIT_TEST(TestError) {
+ Y_UNIT_TEST(TestError) {
bool wasError = false;
try {
diff --git a/library/cpp/http/server/conn.cpp b/library/cpp/http/server/conn.cpp
index 801656dc88..38a76c4c30 100644
--- a/library/cpp/http/server/conn.cpp
+++ b/library/cpp/http/server/conn.cpp
@@ -1,7 +1,7 @@
#include "conn.h"
#include <util/network/socket.h>
-#include <util/stream/buffered.h>
+#include <util/stream/buffered.h>
class THttpServerConn::TImpl {
public:
diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp
index b8d634edec..128583bdd7 100644
--- a/library/cpp/http/server/http.cpp
+++ b/library/cpp/http/server/http.cpp
@@ -15,7 +15,7 @@
#include <util/system/defaults.h>
#include <util/system/event.h>
#include <util/system/mutex.h>
-#include <util/system/pipe.h>
+#include <util/system/pipe.h>
#include <util/system/thread.h>
#include <util/thread/factory.h>
diff --git a/library/cpp/http/server/http_ut.cpp b/library/cpp/http/server/http_ut.cpp
index e60d67673d..cc62bb988e 100644
--- a/library/cpp/http/server/http_ut.cpp
+++ b/library/cpp/http/server/http_ut.cpp
@@ -5,12 +5,12 @@
#include <library/cpp/testing/unittest/tests_data.h>
#include <util/generic/cast.h>
-#include <util/stream/output.h>
+#include <util/stream/output.h>
#include <util/stream/zlib.h>
#include <util/system/datetime.h>
#include <util/system/sem.h>
-Y_UNIT_TEST_SUITE(THttpServerTest) {
+Y_UNIT_TEST_SUITE(THttpServerTest) {
class TEchoServer: public THttpServer::ICallBack {
class TRequest: public THttpClientRequestEx {
public:
@@ -320,7 +320,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
return res;
}
- Y_UNIT_TEST(TestEchoServer) {
+ Y_UNIT_TEST(TestEchoServer) {
TString res = TestData();
TPortManager pm;
const ui16 port = pm.GetPort();
@@ -368,7 +368,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
}
}
- Y_UNIT_TEST(TestReusePortEnabled) {
+ Y_UNIT_TEST(TestReusePortEnabled) {
if (!IsReusePortAvailable()) {
return; // skip test
}
@@ -403,7 +403,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
}
}
- Y_UNIT_TEST(TestReusePortDisabled) {
+ Y_UNIT_TEST(TestReusePortDisabled) {
// check that with the ReusePort option disabled it's impossible to start two servers on the same port
// check that ReusePort option is disabled by default (don't set it explicitly in the test)
TPortManager pm;
@@ -422,7 +422,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
UNIT_ASSERT(false == server1.Start());
}
- Y_UNIT_TEST(TestFailServer) {
+ Y_UNIT_TEST(TestFailServer) {
/**
* Emulate request processing failures
* Data should be large enough not to fit into socket buffer
@@ -541,7 +541,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
server.Stop();
};
- Y_UNIT_TEST(TTestReleaseConnection) {
+ Y_UNIT_TEST(TTestReleaseConnection) {
TPortManager pm;
const ui16 port = pm.GetPort();
@@ -685,7 +685,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
};
#if 0
- Y_UNIT_TEST(TestSocketsLeak) {
+ Y_UNIT_TEST(TestSocketsLeak) {
const bool trueFalse[] = {true, false};
TPortManager portManager;
const ui16 port = portManager.GetPort();
diff --git a/library/cpp/http/server/options.cpp b/library/cpp/http/server/options.cpp
index 3aed3757ed..05c954384a 100644
--- a/library/cpp/http/server/options.cpp
+++ b/library/cpp/http/server/options.cpp
@@ -24,7 +24,7 @@ static inline TNetworkAddress ToNetworkAddr(const TString& address, ui16 port) {
void THttpServerOptions::BindAddresses(TBindAddresses& ret) const {
THashSet<TString> check;
- for (auto addr : BindSockaddr) {
+ for (auto addr : BindSockaddr) {
if (!addr.Port) {
addr.Port = Port;
}
diff --git a/library/cpp/http/server/response.cpp b/library/cpp/http/server/response.cpp
index cbdb29aab7..52d64c91ce 100644
--- a/library/cpp/http/server/response.cpp
+++ b/library/cpp/http/server/response.cpp
@@ -17,7 +17,7 @@ THttpResponse& THttpResponse::SetContentType(const TStringBuf& contentType) {
return *this;
}
-void THttpResponse::OutTo(IOutputStream& os) const {
+void THttpResponse::OutTo(IOutputStream& os) const {
TVector<IOutputStream::TPart> parts;
const size_t FIRST_LINE_PARTS = 3;
const size_t HEADERS_PARTS = Headers.Count() * 4;
@@ -26,15 +26,15 @@ void THttpResponse::OutTo(IOutputStream& os) const {
// first line
parts.push_back(IOutputStream::TPart(TStringBuf("HTTP/1.1 ")));
- parts.push_back(IOutputStream::TPart(HttpCodeStrEx(Code)));
- parts.push_back(IOutputStream::TPart::CrLf());
+ parts.push_back(IOutputStream::TPart(HttpCodeStrEx(Code)));
+ parts.push_back(IOutputStream::TPart::CrLf());
// headers
for (THttpHeaders::TConstIterator i = Headers.Begin(); i != Headers.End(); ++i) {
- parts.push_back(IOutputStream::TPart(i->Name()));
+ parts.push_back(IOutputStream::TPart(i->Name()));
parts.push_back(IOutputStream::TPart(TStringBuf(": ")));
- parts.push_back(IOutputStream::TPart(i->Value()));
- parts.push_back(IOutputStream::TPart::CrLf());
+ parts.push_back(IOutputStream::TPart(i->Value()));
+ parts.push_back(IOutputStream::TPart::CrLf());
}
char buf[50];
@@ -45,21 +45,21 @@ void THttpResponse::OutTo(IOutputStream& os) const {
mo << Content.size();
parts.push_back(IOutputStream::TPart(TStringBuf("Content-Length: ")));
- parts.push_back(IOutputStream::TPart(buf, mo.Buf() - buf));
- parts.push_back(IOutputStream::TPart::CrLf());
+ parts.push_back(IOutputStream::TPart(buf, mo.Buf() - buf));
+ parts.push_back(IOutputStream::TPart::CrLf());
}
// content
- parts.push_back(IOutputStream::TPart::CrLf());
+ parts.push_back(IOutputStream::TPart::CrLf());
if (!Content.empty()) {
- parts.push_back(IOutputStream::TPart(Content));
+ parts.push_back(IOutputStream::TPart(Content));
}
os.Write(parts.data(), parts.size());
}
template <>
-void Out<THttpResponse>(IOutputStream& os, const THttpResponse& resp) {
+void Out<THttpResponse>(IOutputStream& os, const THttpResponse& resp) {
resp.OutTo(os);
}
diff --git a/library/cpp/http/server/response.h b/library/cpp/http/server/response.h
index 2e68d873ac..a75cb85605 100644
--- a/library/cpp/http/server/response.h
+++ b/library/cpp/http/server/response.h
@@ -7,7 +7,7 @@
#include <util/string/cast.h>
class THttpHeaders;
-class IOutputStream;
+class IOutputStream;
class THttpResponse {
public:
@@ -42,8 +42,8 @@ public:
/**
* @note If @arg content isn't empty its size is automatically added as a
- * "Content-Length" header during output to IOutputStream.
- * @see IOutputStream& operator << (IOutputStream&, const THttpResponse&)
+ * "Content-Length" header during output to IOutputStream.
+ * @see IOutputStream& operator << (IOutputStream&, const THttpResponse&)
*/
THttpResponse& SetContent(const TString& content) {
Content = content;
@@ -57,8 +57,8 @@ public:
/**
* @note If @arg content isn't empty its size is automatically added as a
- * "Content-Length" header during output to IOutputStream.
- * @see IOutputStream& operator << (IOutputStream&, const THttpResponse&)
+ * "Content-Length" header during output to IOutputStream.
+ * @see IOutputStream& operator << (IOutputStream&, const THttpResponse&)
*/
THttpResponse& SetContent(const TString& content, const TStringBuf& contentType) {
return SetContent(content).SetContentType(contentType);
@@ -73,7 +73,7 @@ public:
return *this;
}
- void OutTo(IOutputStream& out) const;
+ void OutTo(IOutputStream& out) const;
private:
HttpCodes Code;
diff --git a/library/cpp/http/server/response_ut.cpp b/library/cpp/http/server/response_ut.cpp
index eb40ce6701..73e2112ad3 100644
--- a/library/cpp/http/server/response_ut.cpp
+++ b/library/cpp/http/server/response_ut.cpp
@@ -4,20 +4,20 @@
#include <util/string/cast.h>
-Y_UNIT_TEST_SUITE(TestHttpResponse) {
- Y_UNIT_TEST(TestCodeOnly) {
+Y_UNIT_TEST_SUITE(TestHttpResponse) {
+ Y_UNIT_TEST(TestCodeOnly) {
UNIT_ASSERT_STRINGS_EQUAL(ToString(THttpResponse()), "HTTP/1.1 200 Ok\r\n\r\n");
UNIT_ASSERT_STRINGS_EQUAL(ToString(THttpResponse(HTTP_NOT_FOUND)), "HTTP/1.1 404 Not found\r\n\r\n");
}
- Y_UNIT_TEST(TestRedirect) {
+ Y_UNIT_TEST(TestRedirect) {
THttpResponse resp = THttpResponse(HTTP_FOUND).AddHeader("Location", "yandex.ru");
UNIT_ASSERT_STRINGS_EQUAL(ToString(resp), "HTTP/1.1 302 Moved temporarily\r\n"
"Location: yandex.ru\r\n"
"\r\n");
}
- Y_UNIT_TEST(TestAddHeader) {
+ Y_UNIT_TEST(TestAddHeader) {
THttpResponse resp(HTTP_FORBIDDEN);
resp.AddHeader(THttpInputHeader("X-Header-1", "ValueOne"));
resp.AddHeader("X-Header-2", 10);
@@ -31,7 +31,7 @@ Y_UNIT_TEST_SUITE(TestHttpResponse) {
UNIT_ASSERT_STRINGS_EQUAL(ToString(resp), EXPECTED);
}
- Y_UNIT_TEST(TestAddMultipleHeaders) {
+ Y_UNIT_TEST(TestAddMultipleHeaders) {
THttpHeaders headers;
headers.AddHeader(THttpInputHeader("X-Header-1", "ValueOne"));
headers.AddHeader(THttpInputHeader("X-Header-2", "ValueTwo"));
@@ -65,7 +65,7 @@ Y_UNIT_TEST_SUITE(TestHttpResponse) {
}
- Y_UNIT_TEST(TestSetContent) {
+ Y_UNIT_TEST(TestSetContent) {
const char* EXPECTED = "HTTP/1.1 200 Ok\r\n"
"Content-Length: 10\r\n"
"\r\n"
@@ -74,7 +74,7 @@ Y_UNIT_TEST_SUITE(TestHttpResponse) {
EXPECTED);
}
- Y_UNIT_TEST(TestSetContentWithContentType) {
+ Y_UNIT_TEST(TestSetContentWithContentType) {
const char* EXPECTED = "HTTP/1.1 200 Ok\r\n"
"Content-Type: text/xml\r\n"
"Content-Length: 28\r\n"
@@ -85,7 +85,7 @@ Y_UNIT_TEST_SUITE(TestHttpResponse) {
UNIT_ASSERT_STRINGS_EQUAL(ToString(resp), EXPECTED);
}
- Y_UNIT_TEST(TestCopyConstructor) {
+ Y_UNIT_TEST(TestCopyConstructor) {
THttpResponse resp(HTTP_FORBIDDEN);
resp.AddHeader(THttpInputHeader("X-Header-1", "ValueOne"))
.AddHeader("X-Header-2", "ValueTwo")
@@ -97,7 +97,7 @@ Y_UNIT_TEST_SUITE(TestHttpResponse) {
UNIT_ASSERT_STRINGS_EQUAL(ToString(copy), ToString(resp));
}
- Y_UNIT_TEST(TestAssignment) {
+ Y_UNIT_TEST(TestAssignment) {
THttpResponse resp(HTTP_FORBIDDEN);
resp.AddHeader(THttpInputHeader("X-Header-1", "ValueOne"));
resp.AddHeader(THttpInputHeader("X-Header-2", "ValueTwo"));
@@ -109,11 +109,11 @@ Y_UNIT_TEST_SUITE(TestHttpResponse) {
UNIT_ASSERT_STRINGS_EQUAL(ToString(copy), ToString(resp));
}
- Y_UNIT_TEST(TestEmptyContent) {
+ Y_UNIT_TEST(TestEmptyContent) {
UNIT_ASSERT_STRINGS_EQUAL(ToString(THttpResponse().SetContent("")), "HTTP/1.1 200 Ok\r\n\r\n");
}
- Y_UNIT_TEST(TestReturnReference) {
+ Y_UNIT_TEST(TestReturnReference) {
THttpResponse resp;
UNIT_ASSERT_EQUAL(&resp, &resp.AddHeader("Header1", 1));
UNIT_ASSERT_EQUAL(&resp, &resp.AddHeader(THttpInputHeader("Header2", "2")));