aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpanch <panch@yandex-team.ru>2022-02-10 16:49:46 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:46 +0300
commita27ec9dbf04ab9972fd470b53b8bdd41153226e5 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8
parentd1745921955862f856896f8b5947304e212345c3 (diff)
downloadydb-a27ec9dbf04ab9972fd470b53b8bdd41153226e5.tar.gz
Restoring authorship annotation for <panch@yandex-team.ru>. Commit 2 of 2.
-rw-r--r--library/cpp/http/io/stream.cpp42
-rw-r--r--library/cpp/http/io/stream.h16
-rw-r--r--library/cpp/http/io/stream_ut.cpp36
3 files changed, 47 insertions, 47 deletions
diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp
index 1f4fa5154e..6689be684f 100644
--- a/library/cpp/http/io/stream.cpp
+++ b/library/cpp/http/io/stream.cpp
@@ -503,7 +503,7 @@ public:
, Request_(request)
, Version_(1100)
, KeepAliveEnabled_(false)
- , BodyEncodingEnabled_(true)
+ , BodyEncodingEnabled_(true)
, CompressionHeaderEnabled_(true)
, Finished_(false)
{
@@ -591,10 +591,10 @@ public:
KeepAliveEnabled_ = enable;
}
- inline void EnableBodyEncoding(bool enable) {
- BodyEncodingEnabled_ = enable;
- }
-
+ inline void EnableBodyEncoding(bool enable) {
+ BodyEncodingEnabled_ = enable;
+ }
+
inline void EnableCompressionHeader(bool enable) {
CompressionHeaderEnabled_ = enable;
}
@@ -607,10 +607,10 @@ public:
return KeepAliveEnabled_;
}
- inline bool IsBodyEncodingEnabled() const noexcept {
- return BodyEncodingEnabled_;
- }
-
+ inline bool IsBodyEncodingEnabled() const noexcept {
+ return BodyEncodingEnabled_;
+ }
+
inline bool IsCompressionHeaderEnabled() const noexcept {
return CompressionHeaderEnabled_;
}
@@ -831,13 +831,13 @@ private:
chunked = true;
}
- if (IsBodyEncodingEnabled() && chunked) {
+ if (IsBodyEncodingEnabled() && chunked) {
Output_ = Streams_.Add(new TChunkedOutput(Output_));
}
Output_ = Streams_.Add(new TTeeOutput(Output_, &SizeCalculator_));
- if (IsBodyEncodingEnabled() && encoder) {
+ if (IsBodyEncodingEnabled() && encoder) {
Output_ = Streams_.Add((*encoder)(Output_).Release());
}
}
@@ -868,9 +868,9 @@ private:
TArrayRef<const TStringBuf> ComprSchemas_;
bool KeepAliveEnabled_;
- bool BodyEncodingEnabled_;
+ bool BodyEncodingEnabled_;
bool CompressionHeaderEnabled_;
-
+
bool Finished_;
TSizeCalculator SizeCalculator_;
@@ -926,10 +926,10 @@ void THttpOutput::EnableKeepAlive(bool enable) {
Impl_->EnableKeepAlive(enable);
}
-void THttpOutput::EnableBodyEncoding(bool enable) {
- Impl_->EnableBodyEncoding(enable);
-}
-
+void THttpOutput::EnableBodyEncoding(bool enable) {
+ Impl_->EnableBodyEncoding(enable);
+}
+
void THttpOutput::EnableCompressionHeader(bool enable) {
Impl_->EnableCompressionHeader(enable);
}
@@ -938,10 +938,10 @@ bool THttpOutput::IsKeepAliveEnabled() const noexcept {
return Impl_->IsKeepAliveEnabled();
}
-bool THttpOutput::IsBodyEncodingEnabled() const noexcept {
- return Impl_->IsBodyEncodingEnabled();
-}
-
+bool THttpOutput::IsBodyEncodingEnabled() const noexcept {
+ return Impl_->IsBodyEncodingEnabled();
+}
+
bool THttpOutput::IsCompressionEnabled() const noexcept {
return Impl_->IsCompressionEnabled();
}
diff --git a/library/cpp/http/io/stream.h b/library/cpp/http/io/stream.h
index 4d8fa8bd68..78ca4fc814 100644
--- a/library/cpp/http/io/stream.h
+++ b/library/cpp/http/io/stream.h
@@ -116,10 +116,10 @@ public:
/// после окончания транзакции.
void EnableKeepAlive(bool enable);
- /// Устанавливает режим, при котором тело HTTP-запроса/ответа преобразуется в соответствии
- /// с заголовками Content-Encoding и Transfer-Encoding (включен по умолчанию)
- void EnableBodyEncoding(bool enable);
-
+ /// Устанавливает режим, при котором тело HTTP-запроса/ответа преобразуется в соответствии
+ /// с заголовками Content-Encoding и Transfer-Encoding (включен по умолчанию)
+ void EnableBodyEncoding(bool enable);
+
/// Устанавливает режим, при котором тело HTTP-ответа сжимается кодеком
/// указанным в Content-Encoding (включен по умолчанию)
void EnableCompressionHeader(bool enable);
@@ -130,10 +130,10 @@ public:
/// Проверяет, не завершается ли соединение с сервером после окончания транзакции.
bool IsKeepAliveEnabled() const noexcept;
- /// Проверяет, преобразуется ли тело HTTP-запроса/ответа в соответствии
- /// с заголовками Content-Encoding и Transfer-Encoding
- bool IsBodyEncodingEnabled() const noexcept;
-
+ /// Проверяет, преобразуется ли тело HTTP-запроса/ответа в соответствии
+ /// с заголовками Content-Encoding и Transfer-Encoding
+ bool IsBodyEncodingEnabled() const noexcept;
+
/// Проверяет, сжимается ли тело HTTP-ответа кодеком
/// указанным в Content-Encoding
bool IsCompressionHeaderEnabled() const noexcept;
diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp
index 6f0eec67b6..1ea35df675 100644
--- a/library/cpp/http/io/stream_ut.cpp
+++ b/library/cpp/http/io/stream_ut.cpp
@@ -332,7 +332,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
UNIT_ASSERT_VALUES_EQUAL(checkStr.size(), str.size());
}
- TString MakeHttpOutputBody(const char* body, bool encodingEnabled) {
+ TString MakeHttpOutputBody(const char* body, bool encodingEnabled) {
TString str;
TStringOutput strOut(str);
{
@@ -341,7 +341,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
httpOut.EnableKeepAlive(true);
httpOut.EnableCompression(true);
- httpOut.EnableBodyEncoding(encodingEnabled);
+ httpOut.EnableBodyEncoding(encodingEnabled);
httpOut << "POST / HTTP/1.1\r\n";
httpOut << "Host: yandex.ru\r\n";
@@ -354,22 +354,22 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
const char* bodyDelimiter = "\r\n\r\n";
size_t bodyPos = str.find(bodyDelimiter);
UNIT_ASSERT(bodyPos != TString::npos);
- return str.substr(bodyPos + strlen(bodyDelimiter));
- };
-
- TString SimulateBodyEncoding(const char* body) {
- TString bodyStr;
- TStringOutput bodyOut(bodyStr);
- TChunkedOutput chunkOut(&bodyOut);
- TZLibCompress comprOut(&chunkOut, ZLib::GZip);
- comprOut << body;
- return bodyStr;
- };
-
- Y_UNIT_TEST(TestRebuildStreamOnPost) {
- const char* body = "<html>Hello</html>";
- UNIT_ASSERT(MakeHttpOutputBody(body, false) == body);
- UNIT_ASSERT(MakeHttpOutputBody(body, true) == SimulateBodyEncoding(body));
+ return str.substr(bodyPos + strlen(bodyDelimiter));
+ };
+
+ TString SimulateBodyEncoding(const char* body) {
+ TString bodyStr;
+ TStringOutput bodyOut(bodyStr);
+ TChunkedOutput chunkOut(&bodyOut);
+ TZLibCompress comprOut(&chunkOut, ZLib::GZip);
+ comprOut << body;
+ return bodyStr;
+ };
+
+ Y_UNIT_TEST(TestRebuildStreamOnPost) {
+ const char* body = "<html>Hello</html>";
+ UNIT_ASSERT(MakeHttpOutputBody(body, false) == body);
+ UNIT_ASSERT(MakeHttpOutputBody(body, true) == SimulateBodyEncoding(body));
}
Y_UNIT_TEST(TestOutputFinish) {