aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/http
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:23 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:23 +0300
commit706b83ed7de5a473436620367af31fc0ceecde07 (patch)
tree103305d30dec77e8f6367753367f59b3cd68f9f1 /library/cpp/http
parent918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff)
downloadydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/http')
-rw-r--r--library/cpp/http/fetch/exthttpcodes.cpp2
-rw-r--r--library/cpp/http/fetch/exthttpcodes.h2
-rw-r--r--library/cpp/http/fetch/http_digest.cpp2
-rw-r--r--library/cpp/http/fetch/httpfsm.rl66
-rw-r--r--library/cpp/http/fetch/httpfsm_ut.cpp16
-rw-r--r--library/cpp/http/fetch/httpheader.h6
-rw-r--r--library/cpp/http/fetch/httpload.cpp2
-rw-r--r--library/cpp/http/fetch/httpparser_ut.cpp22
-rw-r--r--library/cpp/http/io/chunk.cpp14
-rw-r--r--library/cpp/http/io/chunk.h4
-rw-r--r--library/cpp/http/io/chunk_ut.cpp18
-rw-r--r--library/cpp/http/io/headers.cpp8
-rw-r--r--library/cpp/http/io/headers.h22
-rw-r--r--library/cpp/http/io/headers_ut.cpp12
-rw-r--r--library/cpp/http/io/stream.cpp92
-rw-r--r--library/cpp/http/io/stream.h28
-rw-r--r--library/cpp/http/io/stream_ut.cpp56
-rw-r--r--library/cpp/http/misc/httpcodes.cpp2
-rw-r--r--library/cpp/http/misc/httpcodes.h10
-rw-r--r--library/cpp/http/misc/httpdate.cpp4
-rw-r--r--library/cpp/http/misc/httpdate.h4
-rw-r--r--library/cpp/http/misc/httpreqdata.cpp6
-rw-r--r--library/cpp/http/misc/httpreqdata.h26
-rw-r--r--library/cpp/http/misc/parsed_request.cpp2
-rw-r--r--library/cpp/http/server/conn.cpp12
-rw-r--r--library/cpp/http/server/conn.h12
-rw-r--r--library/cpp/http/server/http.cpp32
-rw-r--r--library/cpp/http/server/http.h16
-rw-r--r--library/cpp/http/server/http_ut.cpp46
-rw-r--r--library/cpp/http/server/options.cpp8
-rw-r--r--library/cpp/http/server/options.h30
-rw-r--r--library/cpp/http/server/response.cpp2
-rw-r--r--library/cpp/http/server/response.h12
33 files changed, 268 insertions, 268 deletions
diff --git a/library/cpp/http/fetch/exthttpcodes.cpp b/library/cpp/http/fetch/exthttpcodes.cpp
index acc05650c8..9c9fbc86b9 100644
--- a/library/cpp/http/fetch/exthttpcodes.cpp
+++ b/library/cpp/http/fetch/exthttpcodes.cpp
@@ -172,7 +172,7 @@ static ui16* prepare_flags(http_flag* arg) {
ui16* http2status = prepare_flags(HTTP_FLAG);
-TStringBuf ExtHttpCodeStr(int code) noexcept {
+TStringBuf ExtHttpCodeStr(int code) noexcept {
if (code < HTTP_CODE_MAX) {
return HttpCodeStr(code);
}
diff --git a/library/cpp/http/fetch/exthttpcodes.h b/library/cpp/http/fetch/exthttpcodes.h
index 6b525052cd..e5f8c42295 100644
--- a/library/cpp/http/fetch/exthttpcodes.h
+++ b/library/cpp/http/fetch/exthttpcodes.h
@@ -138,4 +138,4 @@ static inline int Http2Status(int code) {
return http2status[code & (EXT_HTTP_CODE_MAX - 1)];
}
-TStringBuf ExtHttpCodeStr(int code) noexcept;
+TStringBuf ExtHttpCodeStr(int code) noexcept;
diff --git a/library/cpp/http/fetch/http_digest.cpp b/library/cpp/http/fetch/http_digest.cpp
index 1eaa02b7f2..4955ada67c 100644
--- a/library/cpp/http/fetch/http_digest.cpp
+++ b/library/cpp/http/fetch/http_digest.cpp
@@ -196,7 +196,7 @@ bool httpDigestHandler::processHeader(const THttpAuthHeader* header,
out << ", opaque=\"" << header->opaque << "\"";
out << "\r\n";
- TString s_out = out.Str();
+ TString s_out = out.Str();
HeaderInstruction_ = strdup(s_out.c_str());
return true;
diff --git a/library/cpp/http/fetch/httpfsm.rl6 b/library/cpp/http/fetch/httpfsm.rl6
index eab0328b18..d0e8aab8fe 100644
--- a/library/cpp/http/fetch/httpfsm.rl6
+++ b/library/cpp/http/fetch/httpfsm.rl6
@@ -312,8 +312,8 @@ rel_canonical = "link"i def '<' url ">;"i lws "rel"i lws '=' lws "\"canonical\""
################# hreflang ###############
action set_hreflang {
bool first = (hreflangpos == hd->hreflangs);
- size_t len2 = (first ? 0 : 1) + langlen + 1 + buflen;
- if (langlen && len2 < hreflangspace) {
+ size_t len2 = (first ? 0 : 1) + langlen + 1 + buflen;
+ if (langlen && len2 < hreflangspace) {
if (!first) {
*(hreflangpos++) = '\t';
}
@@ -323,7 +323,7 @@ action set_hreflang {
memcpy(hreflangpos, buf, buflen);
hreflangpos += buflen;
*(hreflangpos) = 0;
- hreflangspace -= len2;
+ hreflangspace -= len2;
}
}
diff --git a/library/cpp/http/fetch/httpfsm_ut.cpp b/library/cpp/http/fetch/httpfsm_ut.cpp
index b018e80101..3545b25cb6 100644
--- a/library/cpp/http/fetch/httpfsm_ut.cpp
+++ b/library/cpp/http/fetch/httpfsm_ut.cpp
@@ -107,7 +107,7 @@ void THttpHeaderParserTestSuite::TestSplitRequestHeader() {
for (size_t n1 = 0; n1 < rlen; n1++) {
for (size_t n2 = n1; n2 < rlen; n2++) {
- TString s1{request, 0, n1};
+ TString s1{request, 0, n1};
TString s2{request, n1, n2 - n1};
TString s3{request, n2, rlen - n2};
UNIT_ASSERT_EQUAL(s1 + s2 + s3, request);
@@ -144,7 +144,7 @@ void THttpHeaderParserTestSuite::TestTrailingData() {
UNIT_ASSERT_EQUAL(httpRequestHeader.http_method, HTTP_METHOD_GET);
UNIT_ASSERT_EQUAL(strcmp(httpRequestHeader.host, "www.google.ru:8080"), 0);
UNIT_ASSERT_EQUAL(httpRequestHeader.request_uri, "/search?q=hi");
- UNIT_ASSERT_EQUAL(TString(httpHeaderParser->lastchar + 1), "high.ru");
+ UNIT_ASSERT_EQUAL(TString(httpHeaderParser->lastchar + 1), "high.ru");
UNIT_ASSERT_EQUAL(httpRequestHeader.http_minor, 1);
UNIT_ASSERT_EQUAL(httpRequestHeader.transfer_chunked, -1);
UNIT_ASSERT_EQUAL(httpRequestHeader.content_length, -1);
@@ -495,20 +495,20 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) {
return parser;
}
- static THttpChunkParser parseByteByByte(const TStringBuf& blob, const TVector<int>& states) {
+ static THttpChunkParser parseByteByByte(const TStringBuf& blob, const TVector<int>& states) {
UNIT_ASSERT(states.size() <= blob.size());
THttpChunkParser parser{initParser()};
for (size_t n = 0; n < states.size(); n++) {
const TStringBuf d{blob, n, 1};
int code = parser.Execute(d.data(), d.size());
- Cout << TString(d).Quote() << " " << code << Endl;
+ Cout << TString(d).Quote() << " " << code << Endl;
UNIT_ASSERT_EQUAL(code, states[n]);
}
return parser;
}
static THttpChunkParser parseBytesWithLastState(const TStringBuf& blob, const int last_state) {
- TVector<int> states(blob.size() - 1, 1);
+ TVector<int> states(blob.size() - 1, 1);
states.push_back(last_state);
return parseByteByByte(blob, states);
}
@@ -517,7 +517,7 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) {
const TStringBuf blob{
"4\r\n"
"____\r\n"};
- TVector<int> states{
+ TVector<int> states{
-1, /* 1, -1,
1, -1, 1, -1, 1, -1 */};
// as soon as error happens parser state should be considered
@@ -540,7 +540,7 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) {
const TStringBuf blob{
"\r\n"
"-1"};
- TVector<int> states{
+ TVector<int> states{
1, 1,
-1,
/* 1 */};
@@ -570,7 +570,7 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) {
"4\r\n"
"_" // first byte of the chunk
};
- TVector<int> states{
+ TVector<int> states{
1, 1,
1, 1, 2,
-1};
diff --git a/library/cpp/http/fetch/httpheader.h b/library/cpp/http/fetch/httpheader.h
index b2810bbd41..071ce6fe8d 100644
--- a/library/cpp/http/fetch/httpheader.h
+++ b/library/cpp/http/fetch/httpheader.h
@@ -6,7 +6,7 @@
#include <util/system/defaults.h>
#include <util/system/compat.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/ylimits.h>
#include <util/system/maxlen.h>
@@ -217,8 +217,8 @@ public:
/// It doesn't care about errors in request or headers, where
/// request_uri equals to '*'.
/// This returns copy of the string, which you have to delete.
- TString GetUrl() {
- TString url;
+ TString GetUrl() {
+ TString url;
if (host[0] == 0 || !strcmp(host, "")) {
url = request_uri;
} else {
diff --git a/library/cpp/http/fetch/httpload.cpp b/library/cpp/http/fetch/httpload.cpp
index 82ea8900b5..e96ec13a80 100644
--- a/library/cpp/http/fetch/httpload.cpp
+++ b/library/cpp/http/fetch/httpload.cpp
@@ -336,7 +336,7 @@ bool httpLoadAgent::doStartRequest() {
return false;
}
- TString urlBaseStr = URL_.PrintS(THttpURL::FlagNoFrag);
+ TString urlBaseStr = URL_.PrintS(THttpURL::FlagNoFrag);
clearReader();
Reader_ = new httpAgentReader(*this, urlBaseStr.c_str(),
diff --git a/library/cpp/http/fetch/httpparser_ut.cpp b/library/cpp/http/fetch/httpparser_ut.cpp
index 3b3b938e7a..1ccc667bb4 100644
--- a/library/cpp/http/fetch/httpparser_ut.cpp
+++ b/library/cpp/http/fetch/httpparser_ut.cpp
@@ -48,7 +48,7 @@ namespace {
Y_UNIT_TEST_SUITE(TestHttpParser) {
Y_UNIT_TEST(TestTrivialRequest) {
- const TString blob{
+ const TString blob{
"GET /search?q=hi HTTP/1.1\r\n"
"Host: www.google.ru:8080 \r\n"
"\r\n"};
@@ -61,7 +61,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) {
// XXX: `entity_size` is i32 and `content_length` is i64!
Y_UNIT_TEST(TestTrivialResponse) {
- const TString blob{
+ const TString blob{
"HTTP/1.1 200 Ok\r\n"
"Content-Length: 2\r\n"
"\r\n"
@@ -81,7 +81,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) {
// XXX: `entity_size` is off by one in TE:chunked case.
Y_UNIT_TEST(TestChunkedResponse) {
- const TString blob{
+ const TString blob{
"HTTP/1.1 200 OK\r\n"
"Transfer-Encoding: chunked\r\n"
"\r\n"
@@ -111,7 +111,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) {
"\r\n"));
}
- static const TString PipelineClenBlob_{
+ static const TString PipelineClenBlob_{
"HTTP/1.1 200 Ok\r\n"
"Content-Length: 4\r\n"
"\r\n"
@@ -131,14 +131,14 @@ Y_UNIT_TEST_SUITE(TestHttpParser) {
}
Y_UNIT_TEST(TestPipelineClenByteByByte) {
- const TString& blob = PipelineClenBlob_;
+ const TString& blob = PipelineClenBlob_;
THttpHeader hdr;
TTestHttpParser parser;
parser.Init(&hdr);
for (size_t i = 0; i < blob.size(); ++i) {
const TStringBuf d{blob, i, 1};
parser.Parse((void*)d.data(), d.size());
- Cout << TString(d).Quote() << " -> " << parser.GetState() << Endl;
+ Cout << TString(d).Quote() << " -> " << parser.GetState() << Endl;
}
AssertPipelineClen(parser, hdr);
UNIT_ASSERT_EQUAL(parser.Body(), "OK\r\n");
@@ -147,7 +147,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) {
// XXX: Content-Length is ignored, Body() looks unexpected!
Y_UNIT_TEST(TestPipelineClenOneChunk) {
- const TString& blob = PipelineClenBlob_;
+ const TString& blob = PipelineClenBlob_;
THttpHeader hdr;
TTestHttpParser parser;
parser.Init(&hdr);
@@ -167,7 +167,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) {
"ZZ\r\n"));
}
- static const TString PipelineChunkedBlob_{
+ static const TString PipelineChunkedBlob_{
"HTTP/1.1 200 OK\r\n"
"Transfer-Encoding: chunked\r\n"
"\r\n"
@@ -206,14 +206,14 @@ Y_UNIT_TEST_SUITE(TestHttpParser) {
}
Y_UNIT_TEST(TestPipelineChunkedByteByByte) {
- const TString& blob = PipelineChunkedBlob_;
+ const TString& blob = PipelineChunkedBlob_;
THttpHeader hdr;
TTestHttpParser parser;
parser.Init(&hdr);
for (size_t i = 0; i < blob.size(); ++i) {
const TStringBuf d{blob, i, 1};
parser.Parse((void*)d.data(), d.size());
- Cout << TString(d).Quote() << " -> " << parser.GetState() << Endl;
+ Cout << TString(d).Quote() << " -> " << parser.GetState() << Endl;
if (blob.size() / 2 - 1 <= i) // last \n sets EOF
UNIT_ASSERT_EQUAL(parser.GetState(), parser.hp_eof);
}
@@ -221,7 +221,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) {
}
Y_UNIT_TEST(TestPipelineChunkedOneChunk) {
- const TString& blob = PipelineChunkedBlob_;
+ const TString& blob = PipelineChunkedBlob_;
THttpHeader hdr;
TTestHttpParser parser;
parser.Init(&hdr);
diff --git a/library/cpp/http/io/chunk.cpp b/library/cpp/http/io/chunk.cpp
index 6975d9eac1..181a6cec11 100644
--- a/library/cpp/http/io/chunk.cpp
+++ b/library/cpp/http/io/chunk.cpp
@@ -6,14 +6,14 @@
#include <util/generic/utility.h>
#include <util/generic/yexception.h>
-static inline size_t ParseHex(const TString& s) {
+static inline size_t ParseHex(const TString& s) {
if (s.empty()) {
ythrow yexception() << "can not parse chunk length(empty string)";
}
size_t ret = 0;
- for (TString::const_iterator c = s.begin(); c != s.end(); ++c) {
+ for (TString::const_iterator c = s.begin(); c != s.end(); ++c) {
const char ch = *c;
if (ch >= '0' && ch <= '9') {
@@ -61,7 +61,7 @@ public:
}
}
- inline ~TImpl() {
+ inline ~TImpl() {
}
inline size_t Read(void* buf, size_t len) {
@@ -111,7 +111,7 @@ private:
}
inline bool ProceedToNextChunk() {
- TString len(Slave_->ReadLine());
+ TString len(Slave_->ReadLine());
if (len.empty()) {
/*
@@ -147,7 +147,7 @@ TChunkedInput::TChunkedInput(IInputStream* slave, TMaybe<THttpHeaders>* trailers
{
}
-TChunkedInput::~TChunkedInput() {
+TChunkedInput::~TChunkedInput() {
}
size_t TChunkedInput::DoRead(void* buf, size_t len) {
@@ -167,7 +167,7 @@ public:
{
}
- inline ~TImpl() {
+ inline ~TImpl() {
}
inline void Write(const void* buf, size_t len) {
@@ -217,7 +217,7 @@ TChunkedOutput::TChunkedOutput(IOutputStream* slave)
{
}
-TChunkedOutput::~TChunkedOutput() {
+TChunkedOutput::~TChunkedOutput() {
try {
Finish();
} catch (...) {
diff --git a/library/cpp/http/io/chunk.h b/library/cpp/http/io/chunk.h
index 88d89fafda..d73cbf1523 100644
--- a/library/cpp/http/io/chunk.h
+++ b/library/cpp/http/io/chunk.h
@@ -16,7 +16,7 @@ public:
/// Если передан указатель на trailers, то туда будут записаны HTTP trailer'ы (возможно пустые),
/// которые идут после чанков.
TChunkedInput(IInputStream* slave, TMaybe<THttpHeaders>* trailers = nullptr);
- ~TChunkedInput() override;
+ ~TChunkedInput() override;
private:
size_t DoRead(void* buf, size_t len) override;
@@ -33,7 +33,7 @@ private:
class TChunkedOutput: public IOutputStream {
public:
TChunkedOutput(IOutputStream* slave);
- ~TChunkedOutput() override;
+ ~TChunkedOutput() override;
private:
void DoWrite(const void* buf, size_t len) override;
diff --git a/library/cpp/http/io/chunk_ut.cpp b/library/cpp/http/io/chunk_ut.cpp
index da283f8568..2fb65a92f5 100644
--- a/library/cpp/http/io/chunk_ut.cpp
+++ b/library/cpp/http/io/chunk_ut.cpp
@@ -11,8 +11,8 @@
Y_UNIT_TEST_SUITE(TestChunkedIO) {
static const char test_data[] = "87s6cfbsudg cuisg s igasidftasiy tfrcua6s";
- TString CombString(const TString& s, size_t chunkSize) {
- TString result;
+ TString CombString(const TString& s, size_t chunkSize) {
+ TString result;
for (size_t pos = 0; pos < s.size(); pos += 2 * chunkSize)
result += s.substr(pos, chunkSize);
return result;
@@ -59,18 +59,18 @@ Y_UNIT_TEST_SUITE(TestChunkedIO) {
Y_UNIT_TEST(TestChunkedIo) {
TTempFile tmpFile(CDATA);
- TString tmp;
+ TString tmp;
{
- TUnbufferedFileOutput fo(CDATA);
+ TUnbufferedFileOutput fo(CDATA);
TChunkedOutput co(&fo);
WriteTestData(&co, &tmp);
}
{
- TUnbufferedFileInput fi(CDATA);
+ TUnbufferedFileInput fi(CDATA);
TChunkedInput ci(&fi);
- TString r;
+ TString r;
ReadInSmallChunks(&ci, &r);
@@ -78,9 +78,9 @@ Y_UNIT_TEST_SUITE(TestChunkedIO) {
}
{
- TUnbufferedFileInput fi(CDATA);
+ TUnbufferedFileInput fi(CDATA);
TChunkedInput ci(&fi);
- TString r;
+ TString r;
ReadCombed(&ci, &r, 11);
@@ -92,7 +92,7 @@ Y_UNIT_TEST_SUITE(TestChunkedIO) {
bool hasError = false;
try {
- TString badChunk = "10\r\nqwerty";
+ TString badChunk = "10\r\nqwerty";
TMemoryInput mi(badChunk.data(), badChunk.size());
TChunkedInput ci(&mi);
TransferData(&ci, &Cnull);
diff --git a/library/cpp/http/io/headers.cpp b/library/cpp/http/io/headers.cpp
index 4ec27a29e8..3647828946 100644
--- a/library/cpp/http/io/headers.cpp
+++ b/library/cpp/http/io/headers.cpp
@@ -8,14 +8,14 @@
#include <util/string/cast.h>
#include <util/string/strip.h>
-static inline TStringBuf Trim(const char* b, const char* e) noexcept {
+static inline TStringBuf Trim(const char* b, const char* e) noexcept {
return StripString(TStringBuf(b, e));
}
THttpInputHeader::THttpInputHeader(const TStringBuf header) {
size_t pos = header.find(':');
- if (pos == TString::npos) {
+ if (pos == TString::npos) {
ythrow THttpParseException() << "can not parse http header(" << TString{header}.Quote() << ")";
}
@@ -43,8 +43,8 @@ void THttpInputHeader::OutTo(IOutputStream* stream) const {
}
THttpHeaders::THttpHeaders(IInputStream* stream) {
- TString header;
- TString line;
+ TString header;
+ TString line;
bool rdOk = stream->ReadLine(header);
while (rdOk && !header.empty()) {
diff --git a/library/cpp/http/io/headers.h b/library/cpp/http/io/headers.h
index a71793d1c6..139aab2f81 100644
--- a/library/cpp/http/io/headers.h
+++ b/library/cpp/http/io/headers.h
@@ -1,6 +1,6 @@
#pragma once
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/strbuf.h>
#include <util/generic/deque.h>
#include <util/generic/vector.h>
@@ -21,12 +21,12 @@ public:
THttpInputHeader(TString name, TString value);
/// Возвращает имя параметра.
- inline const TString& Name() const noexcept {
+ inline const TString& Name() const noexcept {
return Name_;
}
/// Возвращает значение параметра.
- inline const TString& Value() const noexcept {
+ inline const TString& Value() const noexcept {
return Value_;
}
@@ -34,13 +34,13 @@ public:
void OutTo(IOutputStream* stream) const;
/// Возвращает строку "имя параметра: значение".
- inline TString ToString() const {
+ inline TString ToString() const {
return Name_ + TStringBuf(": ") + Value_;
}
private:
- TString Name_;
- TString Value_;
+ TString Name_;
+ TString Value_;
};
/// Контейнер для хранения HTTP-заголовков
@@ -56,7 +56,7 @@ public:
THttpHeaders(IInputStream* stream);
/// Стандартный итератор.
- inline TConstIterator Begin() const noexcept {
+ inline TConstIterator Begin() const noexcept {
return Headers_.begin();
}
inline TConstIterator begin() const noexcept {
@@ -64,7 +64,7 @@ public:
}
/// Стандартный итератор.
- inline TConstIterator End() const noexcept {
+ inline TConstIterator End() const noexcept {
return Headers_.end();
}
inline TConstIterator end() const noexcept {
@@ -72,12 +72,12 @@ public:
}
/// Возвращает количество заголовков в контейнере.
- inline size_t Count() const noexcept {
+ inline size_t Count() const noexcept {
return Headers_.size();
}
/// Проверяет, содержит ли контейнер хотя бы один заголовок.
- inline bool Empty() const noexcept {
+ inline bool Empty() const noexcept {
return Headers_.empty();
}
@@ -114,7 +114,7 @@ public:
void OutTo(IOutputStream* stream) const;
/// Обменивает наборы заголовков двух контейнеров.
- void Swap(THttpHeaders& headers) noexcept {
+ void Swap(THttpHeaders& headers) noexcept {
Headers_.swap(headers.Headers_);
}
diff --git a/library/cpp/http/io/headers_ut.cpp b/library/cpp/http/io/headers_ut.cpp
index 1d23ef8fdc..12c45b3b7f 100644
--- a/library/cpp/http/io/headers_ut.cpp
+++ b/library/cpp/http/io/headers_ut.cpp
@@ -1,5 +1,5 @@
#include <util/generic/set.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/strbuf.h>
#include <utility>
@@ -21,7 +21,7 @@ namespace {
public:
void Add(TStringBuf name, TStringBuf value) {
- Impl.emplace(TString(name), TString(value));
+ Impl.emplace(TString(name), TString(value));
}
bool operator==(const THeadersExistence& rhs) const {
@@ -29,7 +29,7 @@ namespace {
}
private:
- typedef TMultiSet<std::pair<TString, TString>> TImpl;
+ typedef TMultiSet<std::pair<TString, TString>> TImpl;
TImpl Impl;
};
}
@@ -66,11 +66,11 @@ public:
private:
static void AddHeaderImpl1Arg(THttpHeaders& headers, TStringBuf name, TStringBuf value) {
- headers.AddHeader(THttpInputHeader(TString(name), TString(value)));
+ headers.AddHeader(THttpInputHeader(TString(name), TString(value)));
}
static void AddHeaderImpl2Args(THttpHeaders& headers, TStringBuf name, TStringBuf value) {
- headers.AddHeader(TString(name), TString(value));
+ headers.AddHeader(TString(name), TString(value));
}
static void AddOrReplaceHeaderImpl1Arg(THttpHeaders& headers, TStringBuf name, TStringBuf value) {
@@ -154,7 +154,7 @@ void THttpHeadersTest::DoTestAddOrReplaceOperation(TAddHeaderFunction addHeader,
void THttpHeadersTest::TestAddHeaderTemplateness() {
THttpHeaders h1;
h1.AddHeader("h1", "v1");
- h1.AddHeader("h2", TString("v2"));
+ h1.AddHeader("h2", TString("v2"));
h1.AddHeader("h3", TStringBuf("v3"));
h1.AddHeader("h4", TStringBuf("v4"));
diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp
index 6689be684f..25859087c3 100644
--- a/library/cpp/http/io/stream.cpp
+++ b/library/cpp/http/io/stream.cpp
@@ -17,7 +17,7 @@
#include <util/string/cast.h>
#include <util/string/strip.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/utility.h>
#include <util/generic/hash_set.h>
#include <util/generic/yexception.h>
@@ -131,7 +131,7 @@ namespace {
}
class THttpInput::TImpl {
- typedef THashSet<TString> TAcceptCodings;
+ typedef THashSet<TString> TAcceptCodings;
public:
inline TImpl(IInputStream* slave)
@@ -157,7 +157,7 @@ public:
return s;
}
- inline ~TImpl() {
+ inline ~TImpl() {
}
inline size_t Read(void* buf, size_t len) {
@@ -168,11 +168,11 @@ public:
return Perform(len, [this](size_t toSkip) { return Input_->Skip(toSkip); });
}
- inline const TString& FirstLine() const noexcept {
+ inline const TString& FirstLine() const noexcept {
return FirstLine_;
}
- inline const THttpHeaders& Headers() const noexcept {
+ inline const THttpHeaders& Headers() const noexcept {
return Headers_;
}
@@ -180,15 +180,15 @@ public:
return Trailers_;
}
- inline bool IsKeepAlive() const noexcept {
+ inline bool IsKeepAlive() const noexcept {
return KeepAlive_;
}
- inline bool AcceptEncoding(const TString& s) const {
+ inline bool AcceptEncoding(const TString& s) const {
return Codings_.find(to_lower(s)) != Codings_.end();
}
- inline bool GetContentLength(ui64& value) const noexcept {
+ inline bool GetContentLength(ui64& value) const noexcept {
if (HasContentLength_) {
value = ContentLength_;
return true;
@@ -196,7 +196,7 @@ public:
return false;
}
- inline bool ContentEncoded() const noexcept {
+ inline bool ContentEncoded() const noexcept {
return ContentEncoded_;
}
@@ -252,7 +252,7 @@ private:
};
template <class Functor>
- inline void ForEach(TString in, Functor& f) {
+ inline void ForEach(TString in, Functor& f) {
in.to_lower();
const char* b = in.begin();
@@ -287,7 +287,7 @@ private:
size_t pos = FirstLine_.rfind(' ');
// In HTTP/1.1 Keep-Alive is turned on by default
- if (pos != TString::npos && strcmp(FirstLine_.c_str() + pos + 1, "HTTP/1.1") == 0) {
+ if (pos != TString::npos && strcmp(FirstLine_.c_str() + pos + 1, "HTTP/1.1") == 0) {
p.KeepAlive = true; //request
} else if (strnicmp(FirstLine_.data(), "HTTP/1.1", 8) == 0) {
p.KeepAlive = true; //reply
@@ -375,7 +375,7 @@ private:
*/
IInputStream* Input_;
- TString FirstLine_;
+ TString FirstLine_;
THttpHeaders Headers_;
TMaybe<THttpHeaders> Trailers_;
bool KeepAlive_;
@@ -396,7 +396,7 @@ THttpInput::THttpInput(IInputStream* slave)
THttpInput::THttpInput(THttpInput&& httpInput) = default;
-THttpInput::~THttpInput() {
+THttpInput::~THttpInput() {
}
size_t THttpInput::DoRead(void* buf, size_t len) {
@@ -407,7 +407,7 @@ size_t THttpInput::DoSkip(size_t len) {
return Impl_->Skip(len);
}
-const THttpHeaders& THttpInput::Headers() const noexcept {
+const THttpHeaders& THttpInput::Headers() const noexcept {
return Impl_->Headers();
}
@@ -415,15 +415,15 @@ const TMaybe<THttpHeaders>& THttpInput::Trailers() const noexcept {
return Impl_->Trailers();
}
-const TString& THttpInput::FirstLine() const noexcept {
+const TString& THttpInput::FirstLine() const noexcept {
return Impl_->FirstLine();
}
-bool THttpInput::IsKeepAlive() const noexcept {
+bool THttpInput::IsKeepAlive() const noexcept {
return Impl_->IsKeepAlive();
}
-bool THttpInput::AcceptEncoding(const TString& coding) const {
+bool THttpInput::AcceptEncoding(const TString& coding) const {
return Impl_->AcceptEncoding(coding);
}
@@ -440,11 +440,11 @@ TString THttpInput::BestCompressionScheme() const {
return BestCompressionScheme(TCompressionCodecFactory::Instance().GetBestCodecs());
}
-bool THttpInput::GetContentLength(ui64& value) const noexcept {
+bool THttpInput::GetContentLength(ui64& value) const noexcept {
return Impl_->GetContentLength(value);
}
-bool THttpInput::ContentEncoded() const noexcept {
+bool THttpInput::ContentEncoded() const noexcept {
return Impl_->ContentEncoded();
}
@@ -459,17 +459,17 @@ bool THttpInput::HasExpect100Continue() const noexcept {
class THttpOutput::TImpl {
class TSizeCalculator: public IOutputStream {
public:
- inline TSizeCalculator() noexcept {
+ inline TSizeCalculator() noexcept {
}
- ~TSizeCalculator() override {
+ ~TSizeCalculator() override {
}
void DoWrite(const void* /*buf*/, size_t len) override {
Length_ += len;
}
- inline size_t Length() const noexcept {
+ inline size_t Length() const noexcept {
return Length_;
}
@@ -509,7 +509,7 @@ public:
{
}
- inline ~TImpl() {
+ inline ~TImpl() {
}
inline void SendContinue() {
@@ -579,7 +579,7 @@ public:
Finished_ = true;
}
- inline const THttpHeaders& SentHeaders() const noexcept {
+ inline const THttpHeaders& SentHeaders() const noexcept {
return Headers_;
}
@@ -599,11 +599,11 @@ public:
CompressionHeaderEnabled_ = enable;
}
- inline bool IsCompressionEnabled() const noexcept {
+ inline bool IsCompressionEnabled() const noexcept {
return !ComprSchemas_.empty();
}
- inline bool IsKeepAliveEnabled() const noexcept {
+ inline bool IsKeepAliveEnabled() const noexcept {
return KeepAliveEnabled_;
}
@@ -615,7 +615,7 @@ public:
return CompressionHeaderEnabled_;
}
- inline bool CanBeKeepAlive() const noexcept {
+ inline bool CanBeKeepAlive() const noexcept {
return SupportChunkedTransfer() && IsKeepAliveEnabled() && (Request_ ? Request_->IsKeepAlive() : true);
}
@@ -628,15 +628,15 @@ public:
}
private:
- static inline bool IsResponse(const TString& s) noexcept {
+ static inline bool IsResponse(const TString& s) noexcept {
return strnicmp(s.data(), "HTTP/", 5) == 0;
}
- static inline bool IsRequest(const TString& s) noexcept {
+ static inline bool IsRequest(const TString& s) noexcept {
return !IsResponse(s);
}
- inline bool IsHttpRequest() const noexcept {
+ inline bool IsHttpRequest() const noexcept {
return IsRequest(FirstLine_);
}
@@ -651,16 +651,16 @@ private:
return false;
}
- inline bool IsHttpResponse() const noexcept {
+ inline bool IsHttpResponse() const noexcept {
return IsResponse(FirstLine_);
}
- inline bool HasRequestBody() const noexcept {
+ inline bool HasRequestBody() const noexcept {
return strnicmp(FirstLine_.data(), "POST", 4) == 0 ||
strnicmp(FirstLine_.data(), "PATCH", 5) == 0 ||
strnicmp(FirstLine_.data(), "PUT", 3) == 0;
}
- static inline size_t ParseHttpVersion(const TString& s) {
+ static inline size_t ParseHttpVersion(const TString& s) {
if (s.empty()) {
ythrow THttpParseException() << "malformed http stream";
}
@@ -709,7 +709,7 @@ private:
Version_ = parsed_version;
}
- inline void Process(const TString& s) {
+ inline void Process(const TString& s) {
Y_ASSERT(State_ != HeadersSent);
if (State_ == Begin) {
@@ -760,7 +760,7 @@ private:
}
}
- inline bool SupportChunkedTransfer() const noexcept {
+ inline bool SupportChunkedTransfer() const noexcept {
return Version_ >= 1100;
}
@@ -791,8 +791,8 @@ private:
}
}
- inline TString BuildAcceptEncoding() const {
- TString ret;
+ inline TString BuildAcceptEncoding() const {
+ TString ret;
for (const auto& coding : ComprSchemas_) {
if (ret) {
@@ -813,7 +813,7 @@ private:
for (THttpHeaders::TConstIterator h = Headers_.Begin(); h != Headers_.End(); ++h) {
const THttpInputHeader& header = *h;
- const TString hl = to_lower(header.Name());
+ const TString hl = to_lower(header.Name());
if (hl == TStringBuf("connection")) {
keepAlive = to_lower(header.Value()) == TStringBuf("keep-alive");
@@ -850,7 +850,7 @@ private:
Headers_.AddOrReplaceHeader(hdr);
}
- inline void RemoveHeader(const TString& hdr) {
+ inline void RemoveHeader(const TString& hdr) {
Headers_.RemoveHeader(hdr);
}
@@ -859,8 +859,8 @@ private:
TState State_;
IOutputStream* Output_;
TStreams<IOutputStream, 8> Streams_;
- TString Line_;
- TString FirstLine_;
+ TString Line_;
+ TString FirstLine_;
THttpHeaders Headers_;
THttpInput* Request_;
size_t Version_;
@@ -886,7 +886,7 @@ THttpOutput::THttpOutput(IOutputStream* slave, THttpInput* request)
{
}
-THttpOutput::~THttpOutput() {
+THttpOutput::~THttpOutput() {
try {
Finish();
} catch (...) {
@@ -905,7 +905,7 @@ void THttpOutput::DoFinish() {
Impl_->Finish();
}
-const THttpHeaders& THttpOutput::SentHeaders() const noexcept {
+const THttpHeaders& THttpOutput::SentHeaders() const noexcept {
return Impl_->SentHeaders();
}
@@ -934,7 +934,7 @@ void THttpOutput::EnableCompressionHeader(bool enable) {
Impl_->EnableCompressionHeader(enable);
}
-bool THttpOutput::IsKeepAliveEnabled() const noexcept {
+bool THttpOutput::IsKeepAliveEnabled() const noexcept {
return Impl_->IsKeepAliveEnabled();
}
@@ -942,7 +942,7 @@ bool THttpOutput::IsBodyEncodingEnabled() const noexcept {
return Impl_->IsBodyEncodingEnabled();
}
-bool THttpOutput::IsCompressionEnabled() const noexcept {
+bool THttpOutput::IsCompressionEnabled() const noexcept {
return Impl_->IsCompressionEnabled();
}
@@ -950,7 +950,7 @@ bool THttpOutput::IsCompressionHeaderEnabled() const noexcept {
return Impl_->IsCompressionHeaderEnabled();
}
-bool THttpOutput::CanBeKeepAlive() const noexcept {
+bool THttpOutput::CanBeKeepAlive() const noexcept {
return Impl_->CanBeKeepAlive();
}
diff --git a/library/cpp/http/io/stream.h b/library/cpp/http/io/stream.h
index 78ca4fc814..1ad69a0329 100644
--- a/library/cpp/http/io/stream.h
+++ b/library/cpp/http/io/stream.h
@@ -5,7 +5,7 @@
#include <util/stream/output.h>
#include <util/generic/maybe.h>
#include <util/generic/ptr.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/strbuf.h>
#include <util/generic/yexception.h>
#include <util/generic/array_ref.h>
@@ -26,13 +26,13 @@ class THttpInput: public IInputStream {
public:
THttpInput(IInputStream* slave);
THttpInput(THttpInput&& httpInput);
- ~THttpInput() override;
+ ~THttpInput() override;
/*
* parsed http headers
*/
/// Возвращает контейнер с заголовками ответа HTTP-сервера.
- const THttpHeaders& Headers() const noexcept;
+ const THttpHeaders& Headers() const noexcept;
/*
* parsed http trailers
@@ -49,7 +49,7 @@ public:
/// Возвращает первую строку ответа HTTP-сервера.
/// @details Первая строка HTTP-сервера - строка состояния,
/// содержащая три поля: версию HTTP, код состояния и описание.
- const TString& FirstLine() const noexcept;
+ const TString& FirstLine() const noexcept;
/*
* connection can be keep-alive
@@ -57,29 +57,29 @@ public:
/// Проверяет, не завершено ли соединение с сервером.
/// @details Транзакция считается завершенной, если не передан заголовок
/// "Connection: Keep Alive".
- bool IsKeepAlive() const noexcept;
+ bool IsKeepAlive() const noexcept;
/*
* output data can be encoded
*/
/// Проверяет, поддерживается ли данный тип кодирования содержимого
/// ответа HTTP-сервера.
- bool AcceptEncoding(const TString& coding) const;
+ bool AcceptEncoding(const TString& coding) const;
/// Пытается определить наилучший тип кодирования ответа HTTP-сервера.
/// @details Если ответ сервера говорит о том, что поддерживаются
/// любые типы кодирования, выбирается gzip. В противном случае
/// из списка типов кодирования выбирается лучший из поддерживаемых сервером.
- TString BestCompressionScheme() const;
+ TString BestCompressionScheme() const;
TString BestCompressionScheme(TArrayRef<const TStringBuf> codings) const;
/// Если заголовки содержат Content-Length, возвращает true и
/// записывает значение из заголовка в value
- bool GetContentLength(ui64& value) const noexcept;
+ bool GetContentLength(ui64& value) const noexcept;
/// Признак запакованности данных, - если выставлен, то Content-Length, при наличии в заголовках,
/// показывает объём запакованных данных, а из THttpInput мы будем вычитывать уже распакованные.
- bool ContentEncoded() const noexcept;
+ bool ContentEncoded() const noexcept;
/// Returns true if Content-Length or Transfer-Encoding header received
bool HasContent() const noexcept;
@@ -100,13 +100,13 @@ class THttpOutput: public IOutputStream {
public:
THttpOutput(IOutputStream* slave);
THttpOutput(IOutputStream* slave, THttpInput* request);
- ~THttpOutput() override;
+ ~THttpOutput() override;
/*
* sent http headers
*/
/// Возвращает контейнер с заголовками запроса к HTTP-серверу.
- const THttpHeaders& SentHeaders() const noexcept;
+ const THttpHeaders& SentHeaders() const noexcept;
/// Устанавливает режим, при котором сервер выдает ответ в упакованном виде.
void EnableCompression(bool enable);
@@ -125,10 +125,10 @@ public:
void EnableCompressionHeader(bool enable);
/// Проверяет, производится ли выдача ответов в упакованном виде.
- bool IsCompressionEnabled() const noexcept;
+ bool IsCompressionEnabled() const noexcept;
/// Проверяет, не завершается ли соединение с сервером после окончания транзакции.
- bool IsKeepAliveEnabled() const noexcept;
+ bool IsKeepAliveEnabled() const noexcept;
/// Проверяет, преобразуется ли тело HTTP-запроса/ответа в соответствии
/// с заголовками Content-Encoding и Transfer-Encoding
@@ -143,7 +143,7 @@ public:
*/
/// Проверяет, можно ли установить режим, при котором соединение с сервером
/// не завершается после окончания транзакции.
- bool CanBeKeepAlive() const noexcept;
+ bool CanBeKeepAlive() const noexcept;
void SendContinue();
diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp
index 1ea35df675..c67d6ce48c 100644
--- a/library/cpp/http/io/stream_ut.cpp
+++ b/library/cpp/http/io/stream_ut.cpp
@@ -60,7 +60,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
};
public:
- inline TTestHttpServer(const TString& res)
+ inline TTestHttpServer(const TString& res)
: Res_(res)
{
}
@@ -74,7 +74,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
}
private:
- TString Res_;
+ TString Res_;
size_t LastRequestSentSize_ = 0;
};
@@ -83,7 +83,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
}
Y_UNIT_TEST(TestHttpInput) {
- TString res = "I'm a teapot";
+ TString res = "I'm a teapot";
TPortManager pm;
const ui16 port = pm.GetPort();
@@ -106,7 +106,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
output.EnableKeepAlive(true);
output.EnableCompression(true);
- TString r;
+ TString r;
r += "GET / HTTP/1.1";
r += "\r\n";
r += "Host: yandex.lo";
@@ -180,56 +180,56 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
Y_UNIT_TEST(TestKeepAlive) {
{
- TString s = "GET / HTTP/1.0\r\n\r\n";
+ TString s = "GET / HTTP/1.0\r\n\r\n";
TStringInput si(s);
THttpInput in(&si);
UNIT_ASSERT(!in.IsKeepAlive());
}
{
- TString s = "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
+ TString s = "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
TStringInput si(s);
THttpInput in(&si);
UNIT_ASSERT(in.IsKeepAlive());
}
{
- TString s = "GET / HTTP/1.1\r\n\r\n";
+ TString s = "GET / HTTP/1.1\r\n\r\n";
TStringInput si(s);
THttpInput in(&si);
UNIT_ASSERT(in.IsKeepAlive());
}
{
- TString s = "GET / HTTP/1.1\r\nConnection: close\r\n\r\n";
+ TString s = "GET / HTTP/1.1\r\nConnection: close\r\n\r\n";
TStringInput si(s);
THttpInput in(&si);
UNIT_ASSERT(!in.IsKeepAlive());
}
{
- TString s = "HTTP/1.0 200 Ok\r\n\r\n";
+ TString s = "HTTP/1.0 200 Ok\r\n\r\n";
TStringInput si(s);
THttpInput in(&si);
UNIT_ASSERT(!in.IsKeepAlive());
}
{
- TString s = "HTTP/1.0 200 Ok\r\nConnection: keep-alive\r\n\r\n";
+ TString s = "HTTP/1.0 200 Ok\r\nConnection: keep-alive\r\n\r\n";
TStringInput si(s);
THttpInput in(&si);
UNIT_ASSERT(in.IsKeepAlive());
}
{
- TString s = "HTTP/1.1 200 Ok\r\n\r\n";
+ TString s = "HTTP/1.1 200 Ok\r\n\r\n";
TStringInput si(s);
THttpInput in(&si);
UNIT_ASSERT(in.IsKeepAlive());
}
{
- TString s = "HTTP/1.1 200 Ok\r\nConnection: close\r\n\r\n";
+ TString s = "HTTP/1.1 200 Ok\r\nConnection: close\r\n\r\n";
TStringInput si(s);
THttpInput in(&si);
UNIT_ASSERT(!in.IsKeepAlive());
@@ -237,7 +237,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
}
Y_UNIT_TEST(TestMinRequest) {
- TString res = "qqqqqq";
+ TString res = "qqqqqq";
TPortManager pm;
const ui16 port = pm.GetPort();
@@ -263,7 +263,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
}
Y_UNIT_TEST(TestResponseWithBlanks) {
- TString res = "qqqqqq\r\n\r\nsdasdsad\r\n";
+ TString res = "qqqqqq\r\n\r\nsdasdsad\r\n";
TPortManager pm;
const ui16 port = pm.GetPort();
@@ -282,13 +282,13 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
THttpInput input(&si);
unsigned httpCode = ParseHttpRetCode(input.FirstLine());
UNIT_ASSERT_VALUES_EQUAL(httpCode, 200u);
- TString reply = input.ReadAll();
+ TString reply = input.ReadAll();
UNIT_ASSERT_VALUES_EQUAL(reply, res);
server.Stop();
}
Y_UNIT_TEST(TestOutputFlush) {
- TString str;
+ TString str;
TStringOutput strOut(str);
TBufferedOutput bufOut(&strOut, 8192);
THttpOutput httpOut(&bufOut);
@@ -308,8 +308,8 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
}
Y_UNIT_TEST(TestOutputPostFlush) {
- TString str;
- TString checkStr;
+ TString str;
+ TString checkStr;
TStringOutput strOut(str);
TStringOutput checkOut(checkStr);
TBufferedOutput bufOut(&strOut, 8192);
@@ -333,7 +333,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
}
TString MakeHttpOutputBody(const char* body, bool encodingEnabled) {
- TString str;
+ TString str;
TStringOutput strOut(str);
{
TBufferedOutput bufOut(&strOut, 8192);
@@ -353,7 +353,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
}
const char* bodyDelimiter = "\r\n\r\n";
size_t bodyPos = str.find(bodyDelimiter);
- UNIT_ASSERT(bodyPos != TString::npos);
+ UNIT_ASSERT(bodyPos != TString::npos);
return str.substr(bodyPos + strlen(bodyDelimiter));
};
@@ -373,7 +373,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
}
Y_UNIT_TEST(TestOutputFinish) {
- TString str;
+ TString str;
TStringOutput strOut(str);
TBufferedOutput bufOut(&strOut, 8192);
THttpOutput httpOut(&bufOut);
@@ -399,8 +399,8 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
const char* headerLine3 = "\tAccept-Language";
const char* headerLine4 = "Content-Length: 18";
- TString endLine("\r\n");
- TString r;
+ TString endLine("\r\n");
+ TString r;
r += headerLine0 + endLine;
r += headerLine1 + endLine;
r += headerLine2 + endLine;
@@ -414,15 +414,15 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
UNIT_ASSERT_VALUES_EQUAL(httpHeaders.Count(), 3u);
THttpHeaders::TConstIterator it = httpHeaders.Begin();
- UNIT_ASSERT_VALUES_EQUAL(it->ToString(), TString(headerLine1));
- UNIT_ASSERT_VALUES_EQUAL((++it)->ToString(), TString::Join(headerLine2, headerLine3));
- UNIT_ASSERT_VALUES_EQUAL((++it)->ToString(), TString(headerLine4));
+ UNIT_ASSERT_VALUES_EQUAL(it->ToString(), TString(headerLine1));
+ UNIT_ASSERT_VALUES_EQUAL((++it)->ToString(), TString::Join(headerLine2, headerLine3));
+ UNIT_ASSERT_VALUES_EQUAL((++it)->ToString(), TString(headerLine4));
}
Y_UNIT_TEST(ContentLengthRemoval) {
TMemoryInput request("GET / HTTP/1.1\r\nAccept-Encoding: gzip\r\n\r\n");
THttpInput i(&request);
- TString result;
+ TString result;
TStringOutput out(result);
THttpOutput httpOut(&out, &i);
@@ -661,7 +661,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
out << "HTTP/1.1 200 OK\r\nConnection: Keep-Alive\r\n\r\n";
out << "";
out.Finish();
- TString result = outBuf.Str();
+ TString result = outBuf.Str();
UNIT_ASSERT(!result.Contains(TStringBuf("0\r\n")));
}
diff --git a/library/cpp/http/misc/httpcodes.cpp b/library/cpp/http/misc/httpcodes.cpp
index ad8c80ac1e..40208b7d18 100644
--- a/library/cpp/http/misc/httpcodes.cpp
+++ b/library/cpp/http/misc/httpcodes.cpp
@@ -1,6 +1,6 @@
#include "httpcodes.h"
-TStringBuf HttpCodeStrEx(int code) noexcept {
+TStringBuf HttpCodeStrEx(int code) noexcept {
switch (code) {
case HTTP_CONTINUE:
return TStringBuf("100 Continue");
diff --git a/library/cpp/http/misc/httpcodes.h b/library/cpp/http/misc/httpcodes.h
index cbfbaa1188..e655dd5bd1 100644
--- a/library/cpp/http/misc/httpcodes.h
+++ b/library/cpp/http/misc/httpcodes.h
@@ -75,20 +75,20 @@ enum HttpCodes {
HTTP_CODE_MAX
};
-TStringBuf HttpCodeStrEx(int code) noexcept;
+TStringBuf HttpCodeStrEx(int code) noexcept;
-inline TStringBuf HttpCodeStr(int code) noexcept {
+inline TStringBuf HttpCodeStr(int code) noexcept {
return HttpCodeStrEx(code).Skip(4);
}
-inline bool IsHttpCode(int code) noexcept {
+inline bool IsHttpCode(int code) noexcept {
return HttpCodeStrEx(code).data() != HttpCodeStrEx(0).data();
}
-inline bool IsUserError(int code) noexcept {
+inline bool IsUserError(int code) noexcept {
return code >= 400 && code < 500;
}
-inline bool IsServerError(int code) noexcept {
+inline bool IsServerError(int code) noexcept {
return code >= 500;
}
diff --git a/library/cpp/http/misc/httpdate.cpp b/library/cpp/http/misc/httpdate.cpp
index 4a3031bbf4..8fcfc002e6 100644
--- a/library/cpp/http/misc/httpdate.cpp
+++ b/library/cpp/http/misc/httpdate.cpp
@@ -76,8 +76,8 @@ char* format_http_date(time_t when, char* buf, size_t buflen) {
return buf;
}
-TString FormatHttpDate(time_t when) {
+TString FormatHttpDate(time_t when) {
char str[64] = {0};
format_http_date(str, Y_ARRAY_SIZE(str), when);
- return TString(str);
+ return TString(str);
}
diff --git a/library/cpp/http/misc/httpdate.h b/library/cpp/http/misc/httpdate.h
index 04876f38fe..2d66154243 100644
--- a/library/cpp/http/misc/httpdate.h
+++ b/library/cpp/http/misc/httpdate.h
@@ -1,7 +1,7 @@
#pragma once
#include <util/datetime/base.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <ctime>
@@ -18,4 +18,4 @@ inline time_t parse_http_date(const TStringBuf& datestring) {
int format_http_date(char buf[], size_t size, time_t when);
char* format_http_date(time_t when, char* buf, size_t len);
-TString FormatHttpDate(time_t when);
+TString FormatHttpDate(time_t when);
diff --git a/library/cpp/http/misc/httpreqdata.cpp b/library/cpp/http/misc/httpreqdata.cpp
index f6951f68cd..27fa66f9c6 100644
--- a/library/cpp/http/misc/httpreqdata.cpp
+++ b/library/cpp/http/misc/httpreqdata.cpp
@@ -74,7 +74,7 @@ const char* TBaseServerRequestData::HeaderIn(TStringBuf key) const {
return it->second.data();
}
-TString TBaseServerRequestData::HeaderByIndex(size_t n) const noexcept {
+TString TBaseServerRequestData::HeaderByIndex(size_t n) const noexcept {
if (n >= HeadersCount()) {
return nullptr;
}
@@ -179,7 +179,7 @@ bool TBaseServerRequestData::Parse(const char* origReq) {
return true;
}
-void TBaseServerRequestData::AddHeader(const TString& name, const TString& value) {
+void TBaseServerRequestData::AddHeader(const TString& name, const TString& value) {
HeadersIn_[name] = value;
if (stricmp(name.data(), "Host") == 0) {
@@ -190,7 +190,7 @@ void TBaseServerRequestData::AddHeader(const TString& name, const TString& value
}
}
-void TBaseServerRequestData::SetPath(const TString& path) {
+void TBaseServerRequestData::SetPath(const TString& path) {
PathStorage = TBuffer(path.data(), path.size() + 1);
Path = PathStorage.Data();
}
diff --git a/library/cpp/http/misc/httpreqdata.h b/library/cpp/http/misc/httpreqdata.h
index 16e59c4d78..74448db8d7 100644
--- a/library/cpp/http/misc/httpreqdata.h
+++ b/library/cpp/http/misc/httpreqdata.h
@@ -11,7 +11,7 @@
#include <util/network/socket.h>
#include <util/generic/hash.h>
#include <util/system/yassert.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/datetime/base.h>
#include <util/generic/buffer.h>
@@ -22,12 +22,12 @@ public:
TBaseServerRequestData(SOCKET s = INVALID_SOCKET);
TBaseServerRequestData(const char* qs, SOCKET s = INVALID_SOCKET);
- void SetHost(const TString& host, ui16 port) {
+ void SetHost(const TString& host, ui16 port) {
Host = host;
Port = ToString(port);
}
- const TString& ServerName() const {
+ const TString& ServerName() const {
return Host;
}
@@ -35,7 +35,7 @@ public:
return NAddr::GetSockAddr(Socket);
}
- const TString& ServerPort() const {
+ const TString& ServerPort() const {
return Port;
}
@@ -64,33 +64,33 @@ public:
return HeadersIn_;
}
- inline size_t HeadersCount() const noexcept {
+ inline size_t HeadersCount() const noexcept {
return HeadersIn_.size();
}
- TString HeaderByIndex(size_t n) const noexcept;
+ TString HeaderByIndex(size_t n) const noexcept;
const char* Environment(const char* key) const;
void Clear();
- void SetSocket(SOCKET s) noexcept {
+ void SetSocket(SOCKET s) noexcept {
Socket = s;
}
- ui64 RequestBeginTime() const noexcept {
+ ui64 RequestBeginTime() const noexcept {
return BeginTime;
}
- void SetPath(const TString& path);
+ void SetPath(const TString& path);
const char* GetCurPage() const;
bool Parse(const char* req);
- void AddHeader(const TString& name, const TString& value);
+ void AddHeader(const TString& name, const TString& value);
private:
TBuffer PathStorage;
mutable char* Addr;
- TString Host;
- TString Port;
+ TString Host;
+ TString Port;
char* Path;
char* Search;
size_t SearchLength; // length of Search
@@ -99,7 +99,7 @@ private:
mutable char AddrData[INET6_ADDRSTRLEN];
SOCKET Socket;
ui64 BeginTime;
- mutable TString CurPage;
+ mutable TString CurPage;
TBuffer ParseBuf;
TBuffer ModifiedQueryString;
};
diff --git a/library/cpp/http/misc/parsed_request.cpp b/library/cpp/http/misc/parsed_request.cpp
index e332a24e91..3bc94a4d33 100644
--- a/library/cpp/http/misc/parsed_request.cpp
+++ b/library/cpp/http/misc/parsed_request.cpp
@@ -4,7 +4,7 @@
#include <util/generic/yexception.h>
#include <util/string/cast.h>
-static inline TStringBuf StripLeft(const TStringBuf& s) noexcept {
+static inline TStringBuf StripLeft(const TStringBuf& s) noexcept {
const char* b = s.begin();
const char* e = s.end();
diff --git a/library/cpp/http/server/conn.cpp b/library/cpp/http/server/conn.cpp
index 38a76c4c30..4e285874ed 100644
--- a/library/cpp/http/server/conn.cpp
+++ b/library/cpp/http/server/conn.cpp
@@ -15,14 +15,14 @@ public:
{
}
- inline ~TImpl() {
+ inline ~TImpl() {
}
- inline THttpInput* Input() noexcept {
+ inline THttpInput* Input() noexcept {
return &HI_;
}
- inline THttpOutput* Output() noexcept {
+ inline THttpOutput* Output() noexcept {
return &HO_;
}
@@ -53,14 +53,14 @@ THttpServerConn::THttpServerConn(const TSocket& s, size_t outputBufferSize)
{
}
-THttpServerConn::~THttpServerConn() {
+THttpServerConn::~THttpServerConn() {
}
-THttpInput* THttpServerConn::Input() noexcept {
+THttpInput* THttpServerConn::Input() noexcept {
return Impl_->Input();
}
-THttpOutput* THttpServerConn::Output() noexcept {
+THttpOutput* THttpServerConn::Output() noexcept {
return Impl_->Output();
}
diff --git a/library/cpp/http/server/conn.h b/library/cpp/http/server/conn.h
index 3aa5329af4..44d6f8be28 100644
--- a/library/cpp/http/server/conn.h
+++ b/library/cpp/http/server/conn.h
@@ -10,22 +10,22 @@ class THttpServerConn {
public:
explicit THttpServerConn(const TSocket& s);
THttpServerConn(const TSocket& s, size_t outputBufferSize);
- ~THttpServerConn();
+ ~THttpServerConn();
- THttpInput* Input() noexcept;
- THttpOutput* Output() noexcept;
+ THttpInput* Input() noexcept;
+ THttpOutput* Output() noexcept;
- inline const THttpInput* Input() const noexcept {
+ inline const THttpInput* Input() const noexcept {
return const_cast<THttpServerConn*>(this)->Input();
}
- inline const THttpOutput* Output() const noexcept {
+ inline const THttpOutput* Output() const noexcept {
return const_cast<THttpServerConn*>(this)->Output();
}
/// Проверяет, можно ли установить режим, при котором соединение с сервером
/// не завершается после окончания транзакции.
- inline bool CanBeKeepAlive() const noexcept {
+ inline bool CanBeKeepAlive() const noexcept {
return Output()->CanBeKeepAlive();
}
diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp
index 128583bdd7..4a122d1a0a 100644
--- a/library/cpp/http/server/http.cpp
+++ b/library/cpp/http/server/http.cpp
@@ -31,7 +31,7 @@ using namespace NAddr;
namespace {
class IPollAble {
public:
- inline IPollAble() noexcept {
+ inline IPollAble() noexcept {
}
virtual ~IPollAble() {
@@ -53,7 +53,7 @@ namespace {
class TClientConnection: public IPollAble, public TIntrusiveListItem<TClientConnection> {
public:
TClientConnection(const TSocket& s, THttpServer::TImpl* serv, NAddr::IRemoteAddrRef listenerSockAddrRef);
- ~TClientConnection() override;
+ ~TClientConnection() override;
void OnPollEvent(TInstant now) override;
@@ -81,10 +81,10 @@ public:
{
}
- inline ~TConnections() {
+ inline ~TConnections() {
}
- inline void Add(TClientConnection* c) noexcept {
+ inline void Add(TClientConnection* c) noexcept {
TGuard<TMutex> g(Mutex_);
Conns_.PushBack(c);
@@ -99,7 +99,7 @@ public:
}
}
- inline void Clear() noexcept {
+ inline void Clear() noexcept {
TGuard<TMutex> g(Mutex_);
Conns_.Clear();
@@ -297,7 +297,7 @@ public:
{
}
- ~TListenSocket() override {
+ ~TListenSocket() override {
}
void OnPollEvent(TInstant) override {
@@ -310,7 +310,7 @@ public:
Server_->AddRequestFromSocket(s, TInstant::Now(), SockAddrRef_);
}
- SOCKET GetSocket() const noexcept {
+ SOCKET GetSocket() const noexcept {
return S_;
}
@@ -345,7 +345,7 @@ public:
ListenerRunningOK = true;
ListenStartEvent.Signal();
- TVector<void*> events;
+ TVector<void*> events;
events.resize(1);
TInstant now = TInstant::Now();
@@ -422,15 +422,15 @@ public:
}
}
- inline const TOptions& Options() const noexcept {
+ inline const TOptions& Options() const noexcept {
return Options_;
}
- inline void DecreaseConnections() noexcept {
+ inline void DecreaseConnections() noexcept {
AtomicDecrement(ConnectionCount);
}
- inline void IncreaseConnections() noexcept {
+ inline void IncreaseConnections() noexcept {
AtomicIncrement(ConnectionCount);
}
@@ -527,7 +527,7 @@ void THttpServer::RestartRequestThreads(ui32 n, ui32 queue) {
Impl_->RestartRequestThreads(n, queue);
}
-const THttpServer::TOptions& THttpServer::Options() const noexcept {
+const THttpServer::TOptions& THttpServer::Options() const noexcept {
return Impl_->Options();
}
@@ -566,7 +566,7 @@ TClientConnection::TClientConnection(const TSocket& s, THttpServer::TImpl* serv,
HttpServ_->IncreaseConnections();
}
-TClientConnection::~TClientConnection() {
+TClientConnection::~TClientConnection() {
HttpServ_->DecreaseConnections();
}
@@ -730,7 +730,7 @@ void TClientRequest::ProcessFailRequest(int failstate) {
"\r\n"
"Service Unavailable\r\n";
- TString url;
+ TString url;
if (!strnicmp(RequestString.data(), "GET ", 4)) {
// Trying to extract url...
@@ -764,11 +764,11 @@ void TClientRequest::ProcessFailRequest(int failstate) {
Output().Flush();
}
-THttpServer* TClientRequest::HttpServ() const noexcept {
+THttpServer* TClientRequest::HttpServ() const noexcept {
return Conn_->HttpServ_->Parent_;
}
-const TSocket& TClientRequest::Socket() const noexcept {
+const TSocket& TClientRequest::Socket() const noexcept {
return Conn_->Socket_;
}
diff --git a/library/cpp/http/server/http.h b/library/cpp/http/server/http.h
index b292d38f27..e36a27ca25 100644
--- a/library/cpp/http/server/http.h
+++ b/library/cpp/http/server/http.h
@@ -23,7 +23,7 @@ public:
public:
struct TFailLogData {
int failstate;
- TString url;
+ TString url;
};
virtual ~ICallBack() {
@@ -80,7 +80,7 @@ public:
int GetErrorCode();
const char* GetError();
void RestartRequestThreads(ui32 nTh, ui32 maxQS);
- const TOptions& Options() const noexcept;
+ const TOptions& Options() const noexcept;
i64 GetClientCount() const;
class TImpl;
@@ -109,16 +109,16 @@ public:
TClientRequest();
~TClientRequest() override;
- inline THttpInput& Input() noexcept {
+ inline THttpInput& Input() noexcept {
return *HttpConn_->Input();
}
- inline THttpOutput& Output() noexcept {
+ inline THttpOutput& Output() noexcept {
return *HttpConn_->Output();
}
- THttpServer* HttpServ() const noexcept;
- const TSocket& Socket() const noexcept;
+ THttpServer* HttpServ() const noexcept;
+ const TSocket& Socket() const noexcept;
NAddr::IRemoteAddrRef GetListenerSockAddrRef() const noexcept;
TInstant AcceptMoment() const noexcept;
@@ -140,8 +140,8 @@ private:
void Process(void* ThreadSpecificResource) override;
public:
- TVector<std::pair<TString, TString>> ParsedHeaders;
- TString RequestString;
+ TVector<std::pair<TString, TString>> ParsedHeaders;
+ TString RequestString;
private:
THolder<TClientConnection> Conn_;
diff --git a/library/cpp/http/server/http_ut.cpp b/library/cpp/http/server/http_ut.cpp
index cc62bb988e..f72fde0cc2 100644
--- a/library/cpp/http/server/http_ut.cpp
+++ b/library/cpp/http/server/http_ut.cpp
@@ -40,7 +40,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
};
public:
- inline TEchoServer(const TString& res)
+ inline TEchoServer(const TString& res)
: Res_(res)
{
}
@@ -50,7 +50,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
}
private:
- TString Res_;
+ TString Res_;
};
class TSleepingServer: public THttpServer::ICallBack {
@@ -136,7 +136,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
THolder<TAtomicCounter> MaxConns;
};
- static const TString CrLf = "\r\n";
+ static const TString CrLf = "\r\n";
struct TTestRequest {
TTestRequest(ui16 port, TString content = TString())
@@ -148,10 +148,10 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
void CheckContinue(TSocketInput& si) {
if (Expect100Continue) {
TStringStream ss;
- TString firstLine;
+ TString firstLine;
si.ReadLine(firstLine);
for (;;) {
- TString buf;
+ TString buf;
si.ReadLine(buf);
if (buf.size() == 0) {
break;
@@ -162,7 +162,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
}
}
- TString Execute() {
+ TString Execute() {
TSocket* s = nullptr;
THolder<TSocket> singleReqSocket;
if (KeepAliveConnection) {
@@ -239,7 +239,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
s->Send(r.Data(), r.Size());
CheckContinue(si);
Hdr = r.Str();
- TString tosend = compressedContent.Str();
+ TString tosend = compressedContent.Str();
s->Send(tosend.data(), tosend.size());
} else {
if (isPost) {
@@ -264,7 +264,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
return ss.Str();
}
- TString GetDescription() const {
+ TString GetDescription() const {
if (UseHttpOutput) {
TStringStream ss;
ss << (KeepAliveConnection ? "keep-alive " : "") << Type;
@@ -279,13 +279,13 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
ui16 Port = 0;
bool UseHttpOutput = true;
- TString Type = "GET";
- TString ContentEncoding;
- TString Content;
+ TString Type = "GET";
+ TString ContentEncoding;
+ TString Content;
bool KeepAliveConnection = false;
THolder<TSocket> KeepAlivedSocket;
bool EnableResponseEncoding = false;
- TString Hdr;
+ TString Hdr;
bool Expect100Continue = false;
};
@@ -311,8 +311,8 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
}
};
- TString TestData(size_t size = 5 * 4096) {
- TString res;
+ TString TestData(size_t size = 5 * 4096) {
+ TString res;
for (size_t i = 0; i < size; ++i) {
res += (char)i;
@@ -321,7 +321,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
}
Y_UNIT_TEST(TestEchoServer) {
- TString res = TestData();
+ TString res = TestData();
TPortManager pm;
const ui16 port = pm.GetPort();
const bool trueFalse[] = {true, false};
@@ -345,17 +345,17 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
for (bool enableResponseEncoding : trueFalse) {
r.EnableResponseEncoding = enableResponseEncoding;
- const TString reqTypes[] = {"GET", "POST"};
- for (const TString& reqType : reqTypes) {
+ const TString reqTypes[] = {"GET", "POST"};
+ for (const TString& reqType : reqTypes) {
r.Type = reqType;
- const TString encoders[] = {"", "deflate"};
- for (const TString& encoder : encoders) {
+ const TString encoders[] = {"", "deflate"};
+ for (const TString& encoder : encoders) {
r.ContentEncoding = encoder;
for (bool expect100Continue : trueFalse) {
r.Expect100Continue = expect100Continue;
- TString resp = r.Execute();
+ TString resp = r.Execute();
UNIT_ASSERT_C(resp == res, "diff echo response for request:\n" + r.GetDescription());
}
}
@@ -377,7 +377,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
const ui16 port = pm.GetPort();
TEchoServer serverImpl(res);
- TVector<THolder<THttpServer>> servers;
+ TVector<THolder<THttpServer>> servers;
for (ui32 i = 0; i < 10; i++) {
servers.push_back(MakeHolder<THttpServer>(&serverImpl, THttpServer::TOptions(port).EnableReusePort(true)));
}
@@ -427,7 +427,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
* Emulate request processing failures
* Data should be large enough not to fit into socket buffer
**/
- TString res = TestData(10 * 1024 * 1024);
+ TString res = TestData(10 * 1024 * 1024);
TPortManager portManager;
const ui16 port = portManager.GetPort();
TEchoServer serverImpl(res);
@@ -446,7 +446,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
TTestRequest r(port);
r.Content = res;
r.Type = "POST";
- TString resp = r.Execute();
+ TString resp = r.Execute();
if (i == 1) {
UNIT_ASSERT(resp.Contains("Service Unavailable"));
} else {
diff --git a/library/cpp/http/server/options.cpp b/library/cpp/http/server/options.cpp
index 05c954384a..e1f85d22c3 100644
--- a/library/cpp/http/server/options.cpp
+++ b/library/cpp/http/server/options.cpp
@@ -9,11 +9,11 @@
using TAddr = THttpServerOptions::TAddr;
-static inline TString AddrToString(const TAddr& addr) {
+static inline TString AddrToString(const TAddr& addr) {
return addr.Addr + ":" + ToString(addr.Port);
}
-static inline TNetworkAddress ToNetworkAddr(const TString& address, ui16 port) {
+static inline TNetworkAddress ToNetworkAddr(const TString& address, ui16 port) {
if (address.empty() || address == TStringBuf("*")) {
return TNetworkAddress(port);
}
@@ -22,14 +22,14 @@ static inline TNetworkAddress ToNetworkAddr(const TString& address, ui16 port) {
}
void THttpServerOptions::BindAddresses(TBindAddresses& ret) const {
- THashSet<TString> check;
+ THashSet<TString> check;
for (auto addr : BindSockaddr) {
if (!addr.Port) {
addr.Port = Port;
}
- const TString straddr = AddrToString(addr);
+ const TString straddr = AddrToString(addr);
if (check.find(straddr) == check.end()) {
check.insert(straddr);
diff --git a/library/cpp/http/server/options.h b/library/cpp/http/server/options.h
index 38eda0e5e7..3354578db2 100644
--- a/library/cpp/http/server/options.h
+++ b/library/cpp/http/server/options.h
@@ -4,18 +4,18 @@
#include <util/network/init.h>
#include <util/network/address.h>
#include <util/generic/size_literals.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/vector.h>
#include <util/datetime/base.h>
class THttpServerOptions {
public:
- inline THttpServerOptions(ui16 port = 17000) noexcept
+ inline THttpServerOptions(ui16 port = 17000) noexcept
: Port(port)
{
}
- using TBindAddresses = TVector<TNetworkAddress>;
+ using TBindAddresses = TVector<TNetworkAddress>;
void BindAddresses(TBindAddresses& ret) const;
inline THttpServerOptions& AddBindAddress(const TString& address, ui16 port) {
@@ -32,13 +32,13 @@ public:
return AddBindAddress(address, 0);
}
- inline THttpServerOptions& EnableKeepAlive(bool enable) noexcept {
+ inline THttpServerOptions& EnableKeepAlive(bool enable) noexcept {
KeepAliveEnabled = enable;
return *this;
}
- inline THttpServerOptions& EnableCompression(bool enable) noexcept {
+ inline THttpServerOptions& EnableCompression(bool enable) noexcept {
CompressionEnabled = enable;
return *this;
@@ -62,51 +62,51 @@ public:
return *this;
}
- inline THttpServerOptions& SetThreads(ui32 threads) noexcept {
+ inline THttpServerOptions& SetThreads(ui32 threads) noexcept {
nThreads = threads;
return *this;
}
/// Default interface name to bind the server. Used when none of BindAddress are provided.
- inline THttpServerOptions& SetHost(const TString& host) noexcept {
+ inline THttpServerOptions& SetHost(const TString& host) noexcept {
Host = host;
return *this;
}
/// Default port to bind the server. Used when none of BindAddress are provided.
- inline THttpServerOptions& SetPort(ui16 port) noexcept {
+ inline THttpServerOptions& SetPort(ui16 port) noexcept {
Port = port;
return *this;
}
- inline THttpServerOptions& SetMaxConnections(ui32 mc = 0) noexcept {
+ inline THttpServerOptions& SetMaxConnections(ui32 mc = 0) noexcept {
MaxConnections = mc;
return *this;
}
- inline THttpServerOptions& SetMaxQueueSize(ui32 mqs = 0) noexcept {
+ inline THttpServerOptions& SetMaxQueueSize(ui32 mqs = 0) noexcept {
MaxQueueSize = mqs;
return *this;
}
- inline THttpServerOptions& SetClientTimeout(const TDuration& timeout) noexcept {
+ inline THttpServerOptions& SetClientTimeout(const TDuration& timeout) noexcept {
ClientTimeout = timeout;
return *this;
}
- inline THttpServerOptions& SetListenBacklog(int val) noexcept {
+ inline THttpServerOptions& SetListenBacklog(int val) noexcept {
ListenBacklog = val;
return *this;
}
- inline THttpServerOptions& SetOutputBufferSize(size_t val) noexcept {
+ inline THttpServerOptions& SetOutputBufferSize(size_t val) noexcept {
OutputBufferSize = val;
return *this;
@@ -140,11 +140,11 @@ public:
}
struct TAddr {
- TString Addr;
+ TString Addr;
ui16 Port;
};
- typedef TVector<TAddr> TAddrs;
+ typedef TVector<TAddr> TAddrs;
bool KeepAliveEnabled = true;
bool CompressionEnabled = false;
diff --git a/library/cpp/http/server/response.cpp b/library/cpp/http/server/response.cpp
index 52d64c91ce..64ad7fceb3 100644
--- a/library/cpp/http/server/response.cpp
+++ b/library/cpp/http/server/response.cpp
@@ -18,7 +18,7 @@ THttpResponse& THttpResponse::SetContentType(const TStringBuf& contentType) {
}
void THttpResponse::OutTo(IOutputStream& os) const {
- TVector<IOutputStream::TPart> parts;
+ TVector<IOutputStream::TPart> parts;
const size_t FIRST_LINE_PARTS = 3;
const size_t HEADERS_PARTS = Headers.Count() * 4;
const size_t CONTENT_PARTS = 5;
diff --git a/library/cpp/http/server/response.h b/library/cpp/http/server/response.h
index a75cb85605..a6a92c89d0 100644
--- a/library/cpp/http/server/response.h
+++ b/library/cpp/http/server/response.h
@@ -11,18 +11,18 @@ class IOutputStream;
class THttpResponse {
public:
- THttpResponse() noexcept
+ THttpResponse() noexcept
: Code(HTTP_OK)
{
}
- explicit THttpResponse(HttpCodes code) noexcept
+ explicit THttpResponse(HttpCodes code) noexcept
: Code(code)
{
}
template <typename ValueType>
- THttpResponse& AddHeader(const TString& name, const ValueType& value) {
+ THttpResponse& AddHeader(const TString& name, const ValueType& value) {
return AddHeader(THttpInputHeader(name, ToString(value)));
}
@@ -45,7 +45,7 @@ public:
* "Content-Length" header during output to IOutputStream.
* @see IOutputStream& operator << (IOutputStream&, const THttpResponse&)
*/
- THttpResponse& SetContent(const TString& content) {
+ THttpResponse& SetContent(const TString& content) {
Content = content;
return *this;
@@ -60,7 +60,7 @@ public:
* "Content-Length" header during output to IOutputStream.
* @see IOutputStream& operator << (IOutputStream&, const THttpResponse&)
*/
- THttpResponse& SetContent(const TString& content, const TStringBuf& contentType) {
+ THttpResponse& SetContent(const TString& content, const TStringBuf& contentType) {
return SetContent(content).SetContentType(contentType);
}
@@ -78,5 +78,5 @@ public:
private:
HttpCodes Code;
THttpHeaders Headers;
- TString Content;
+ TString Content;
};