aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/http
diff options
context:
space:
mode:
authorelantsev <elantsev@yandex-team.ru>2022-02-10 16:49:47 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:47 +0300
commit095c2e55a230f89487c2f2caace05e108742d72c (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/http
parentafa1b6e6f8b6ee9f8df080d41bcb19b95c25c261 (diff)
downloadydb-095c2e55a230f89487c2f2caace05e108742d72c.tar.gz
Restoring authorship annotation for <elantsev@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/http')
-rw-r--r--library/cpp/http/io/stream.cpp4
-rw-r--r--library/cpp/http/io/stream_ut.cpp80
2 files changed, 42 insertions, 42 deletions
diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp
index 531a404457..6689be684f 100644
--- a/library/cpp/http/io/stream.cpp
+++ b/library/cpp/http/io/stream.cpp
@@ -649,8 +649,8 @@ private:
return true;
}
return false;
- }
-
+ }
+
inline bool IsHttpResponse() const noexcept {
return IsResponse(FirstLine_);
}
diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp
index 638f1f5df9..1ea35df675 100644
--- a/library/cpp/http/io/stream_ut.cpp
+++ b/library/cpp/http/io/stream_ut.cpp
@@ -613,57 +613,57 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
Y_UNIT_TEST(TestHttpInputHeadRequest) {
class THeadOnlyInput: public IInputStream {
- public:
- THeadOnlyInput() = default;
-
- private:
- size_t DoRead(void* buf, size_t len) override {
- if (Eof_) {
- ythrow yexception() << "should not read after EOF";
- }
-
+ public:
+ THeadOnlyInput() = default;
+
+ private:
+ size_t DoRead(void* buf, size_t len) override {
+ if (Eof_) {
+ ythrow yexception() << "should not read after EOF";
+ }
+
const size_t toWrite = Min(len, Data_.size() - Pos_);
- if (toWrite == 0) {
- Eof_ = true;
- return 0;
- }
-
- memcpy(buf, Data_.data() + Pos_, toWrite);
- Pos_ += toWrite;
- return toWrite;
- }
-
- private:
+ if (toWrite == 0) {
+ Eof_ = true;
+ return 0;
+ }
+
+ memcpy(buf, Data_.data() + Pos_, toWrite);
+ Pos_ += toWrite;
+ return toWrite;
+ }
+
+ private:
TString Data_{TStringBuf("HEAD / HTTP/1.1\r\nHost: yandex.ru\r\n\r\n")};
size_t Pos_{0};
bool Eof_{false};
- };
- THeadOnlyInput input;
- THttpInput httpInput(&input);
-
- UNIT_ASSERT(!httpInput.HasContent());
- UNIT_ASSERT_VALUES_EQUAL(httpInput.ReadAll(), "");
- }
-
+ };
+ THeadOnlyInput input;
+ THttpInput httpInput(&input);
+
+ UNIT_ASSERT(!httpInput.HasContent());
+ UNIT_ASSERT_VALUES_EQUAL(httpInput.ReadAll(), "");
+ }
+
Y_UNIT_TEST(TestHttpOutputResponseToHeadRequestNoZeroChunk) {
- TStringStream request;
+ TStringStream request;
request << "HEAD / HTTP/1.1\r\n"
"Host: yandex.ru\r\n"
"Connection: Keep-Alive\r\n"
"\r\n";
-
- TStringInput input(request.Str());
- THttpInput httpInput(&input);
-
- TStringStream outBuf;
- THttpOutput out(&outBuf, &httpInput);
- out.EnableKeepAlive(true);
- out << "HTTP/1.1 200 OK\r\nConnection: Keep-Alive\r\n\r\n";
- out << "";
- out.Finish();
+
+ TStringInput input(request.Str());
+ THttpInput httpInput(&input);
+
+ TStringStream outBuf;
+ THttpOutput out(&outBuf, &httpInput);
+ out.EnableKeepAlive(true);
+ out << "HTTP/1.1 200 OK\r\nConnection: Keep-Alive\r\n\r\n";
+ out << "";
+ out.Finish();
TString result = outBuf.Str();
UNIT_ASSERT(!result.Contains(TStringBuf("0\r\n")));
- }
+ }
Y_UNIT_TEST(TestHttpOutputDisableCompressionHeader) {
TMemoryInput request("GET / HTTP/1.1\r\nAccept-Encoding: gzip\r\n\r\n");