diff options
author | danlark <danlark@yandex-team.ru> | 2022-02-10 16:46:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:08 +0300 |
commit | 3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (patch) | |
tree | 26154e1e9990f1bb4525d3e3fb5b6dac2c2c1da2 /library/cpp/http/io | |
parent | cb68f224c46a8ee52ac3fdd2a32534b8bb8dc134 (diff) | |
download | ydb-3426a9bc7f169ae9da54cef557ad2a33f6e8eee0.tar.gz |
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/http/io')
-rw-r--r-- | library/cpp/http/io/chunk.cpp | 2 | ||||
-rw-r--r-- | library/cpp/http/io/chunk_ut.cpp | 2 | ||||
-rw-r--r-- | library/cpp/http/io/stream.cpp | 36 | ||||
-rw-r--r-- | library/cpp/http/io/stream_ut.cpp | 32 | ||||
-rw-r--r-- | library/cpp/http/io/stream_ut_medium.cpp | 2 |
5 files changed, 37 insertions, 37 deletions
diff --git a/library/cpp/http/io/chunk.cpp b/library/cpp/http/io/chunk.cpp index 6975d9eac1..631b79c5af 100644 --- a/library/cpp/http/io/chunk.cpp +++ b/library/cpp/http/io/chunk.cpp @@ -30,7 +30,7 @@ static inline size_t ParseHex(const TString& s) { } else if (isspace(ch)) { continue; } else { - ythrow yexception() << "can not parse chunk length(" << s.data() << ")"; + ythrow yexception() << "can not parse chunk length(" << s.data() << ")"; } } diff --git a/library/cpp/http/io/chunk_ut.cpp b/library/cpp/http/io/chunk_ut.cpp index da283f8568..308d98ade0 100644 --- a/library/cpp/http/io/chunk_ut.cpp +++ b/library/cpp/http/io/chunk_ut.cpp @@ -93,7 +93,7 @@ Y_UNIT_TEST_SUITE(TestChunkedIO) { try { TString badChunk = "10\r\nqwerty"; - TMemoryInput mi(badChunk.data(), badChunk.size()); + TMemoryInput mi(badChunk.data(), badChunk.size()); TChunkedInput ci(&mi); TransferData(&ci, &Cnull); } catch (...) { diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp index 6689be684f..8c7729cae2 100644 --- a/library/cpp/http/io/stream.cpp +++ b/library/cpp/http/io/stream.cpp @@ -24,7 +24,7 @@ #define HEADERCMP(header, str) \ case sizeof(str) - 1: \ - if (!stricmp((header).Name().data(), str)) + if (!stricmp((header).Name().data(), str)) namespace { inline size_t SuggestBufferSize() { @@ -274,12 +274,12 @@ private: } inline bool IsRequest() const { - return strnicmp(FirstLine().data(), "get", 3) == 0 || - strnicmp(FirstLine().data(), "post", 4) == 0 || - strnicmp(FirstLine().data(), "put", 3) == 0 || + return strnicmp(FirstLine().data(), "get", 3) == 0 || + strnicmp(FirstLine().data(), "post", 4) == 0 || + strnicmp(FirstLine().data(), "put", 3) == 0 || strnicmp(FirstLine().data(), "patch", 5) == 0 || - strnicmp(FirstLine().data(), "head", 4) == 0 || - strnicmp(FirstLine().data(), "delete", 6) == 0; + strnicmp(FirstLine().data(), "head", 4) == 0 || + strnicmp(FirstLine().data(), "delete", 6) == 0; } inline void BuildInputChain() { @@ -289,13 +289,13 @@ private: // 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) { p.KeepAlive = true; //request - } else if (strnicmp(FirstLine_.data(), "HTTP/1.1", 8) == 0) { + } else if (strnicmp(FirstLine_.data(), "HTTP/1.1", 8) == 0) { p.KeepAlive = true; //reply } for (THttpHeaders::TConstIterator h = Headers_.Begin(); h != Headers_.End(); ++h) { const THttpInputHeader& header = *h; - switch (header.Name().size()) { + switch (header.Name().size()) { HEADERCMP(header, "transfer-encoding") { TTrEnc f = {&p}; ForEach(header.Value(), f); @@ -317,16 +317,16 @@ private: break; HEADERCMP(header, "connection") { // accept header "Connection: Keep-Alive, TE" - if (strnicmp(header.Value().data(), "keep-alive", 10) == 0) { + if (strnicmp(header.Value().data(), "keep-alive", 10) == 0) { p.KeepAlive = true; - } else if (stricmp(header.Value().data(), "close") == 0) { + } else if (stricmp(header.Value().data(), "close") == 0) { p.KeepAlive = false; } } [[fallthrough]]; HEADERCMP(header, "expect") { auto findContinue = [&](const TStringBuf& s) { - if (strnicmp(s.data(), "100-continue", 13) == 0) { + if (strnicmp(s.data(), "100-continue", 13) == 0) { Expect100Continue_ = true; } }; @@ -629,7 +629,7 @@ public: private: static inline bool IsResponse(const TString& s) noexcept { - return strnicmp(s.data(), "HTTP/", 5) == 0; + return strnicmp(s.data(), "HTTP/", 5) == 0; } static inline bool IsRequest(const TString& s) noexcept { @@ -644,7 +644,7 @@ private: if (IsHttpResponse()) { if (Request_ && Request_->FirstLine().StartsWith(TStringBuf("HEAD"))) return false; - if (FirstLine_.size() > 9 && strncmp(FirstLine_.data() + 9, "204", 3) == 0) + if (FirstLine_.size() > 9 && strncmp(FirstLine_.data() + 9, "204", 3) == 0) return false; return true; } @@ -656,9 +656,9 @@ private: } inline bool HasRequestBody() const noexcept { - return strnicmp(FirstLine_.data(), "POST", 4) == 0 || + return strnicmp(FirstLine_.data(), "POST", 4) == 0 || strnicmp(FirstLine_.data(), "PATCH", 5) == 0 || - strnicmp(FirstLine_.data(), "PUT", 3) == 0; + strnicmp(FirstLine_.data(), "PUT", 3) == 0; } static inline size_t ParseHttpVersion(const TString& s) { if (s.empty()) { @@ -668,7 +668,7 @@ private: size_t parsed_version = 0; if (IsResponse(s)) { - const char* b = s.data() + 5; + const char* b = s.data() + 5; while (*b && *b != ' ') { if (*b != '.') { @@ -728,7 +728,7 @@ private: } inline void WriteCachedImpl(IOutputStream* s) const { - s->Write(FirstLine_.data(), FirstLine_.size()); + s->Write(FirstLine_.data(), FirstLine_.size()); s->Write("\r\n", 2); Headers_.OutTo(s); s->Write("\r\n", 2); @@ -969,7 +969,7 @@ size_t THttpOutput::SentSize() const noexcept { unsigned ParseHttpRetCode(const TStringBuf& ret) { const TStringBuf code = StripString(StripString(ret.After(' ')).Before(' ')); - return FromString<unsigned>(code.data(), code.size()); + return FromString<unsigned>(code.data(), code.size()); } void SendMinimalHttpRequest(TSocket& s, const TStringBuf& host, const TStringBuf& request, const TStringBuf& agent, const TStringBuf& from) { diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp index 1ea35df675..d743552762 100644 --- a/library/cpp/http/io/stream_ut.cpp +++ b/library/cpp/http/io/stream_ut.cpp @@ -42,8 +42,8 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { "\r\n"; } else { Output() << "HTTP/1.1 200 Ok\r\n\r\n"; - if (Buf.Size()) { - Output().Write(Buf.AsCharPtr(), Buf.Size()); + if (Buf.Size()) { + Output().Write(Buf.AsCharPtr(), Buf.Size()); } else { Output() << Parent_->Res_; } @@ -79,7 +79,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { }; Y_UNIT_TEST(TestCodings1) { - UNIT_ASSERT(SupportedCodings().size() > 0); + UNIT_ASSERT(SupportedCodings().size() > 0); } Y_UNIT_TEST(TestHttpInput) { @@ -113,7 +113,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { r += "\r\n"; r += "\r\n"; - output.Write(r.data(), r.size()); + output.Write(r.data(), r.size()); output.Finish(); } @@ -159,7 +159,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { r += "\r\n"; r += "\r\n"; - output.Write(r.data(), r.size()); + output.Write(r.data(), r.size()); output.Finish(); } @@ -299,12 +299,12 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { const char* header = "GET / HTTP/1.1\r\nHost: yandex.ru\r\n\r\n"; httpOut << header; - unsigned curLen = str.size(); + unsigned curLen = str.size(); const char* body = "<html>Hello</html>"; httpOut << body; - UNIT_ASSERT_VALUES_EQUAL(curLen, str.size()); + UNIT_ASSERT_VALUES_EQUAL(curLen, str.size()); httpOut.Flush(); - UNIT_ASSERT_VALUES_EQUAL(curLen + strlen(body), str.size()); + UNIT_ASSERT_VALUES_EQUAL(curLen + strlen(body), str.size()); } Y_UNIT_TEST(TestOutputPostFlush) { @@ -322,14 +322,14 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { const char* header = "POST / HTTP/1.1\r\nHost: yandex.ru\r\n\r\n"; httpOut << header; - UNIT_ASSERT_VALUES_EQUAL(str.size(), 0u); + UNIT_ASSERT_VALUES_EQUAL(str.size(), 0u); const char* body = "<html>Hello</html>"; httpOut << body; - UNIT_ASSERT_VALUES_EQUAL(str.size(), 0u); + UNIT_ASSERT_VALUES_EQUAL(str.size(), 0u); httpOut.Flush(); - UNIT_ASSERT_VALUES_EQUAL(checkStr.size(), str.size()); + UNIT_ASSERT_VALUES_EQUAL(checkStr.size(), str.size()); } TString MakeHttpOutputBody(const char* body, bool encodingEnabled) { @@ -348,7 +348,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { httpOut << "Content-Encoding: gzip\r\n"; httpOut << "\r\n"; - UNIT_ASSERT_VALUES_EQUAL(str.size(), 0u); + UNIT_ASSERT_VALUES_EQUAL(str.size(), 0u); httpOut << body; } const char* bodyDelimiter = "\r\n\r\n"; @@ -384,12 +384,12 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { const char* header = "GET / HTTP/1.1\r\nHost: yandex.ru\r\n\r\n"; httpOut << header; - unsigned curLen = str.size(); + unsigned curLen = str.size(); const char* body = "<html>Hello</html>"; httpOut << body; - UNIT_ASSERT_VALUES_EQUAL(curLen, str.size()); + UNIT_ASSERT_VALUES_EQUAL(curLen, str.size()); httpOut.Finish(); - UNIT_ASSERT_VALUES_EQUAL(curLen + strlen(body), str.size()); + UNIT_ASSERT_VALUES_EQUAL(curLen + strlen(body), str.size()); } Y_UNIT_TEST(TestMultilineHeaders) { @@ -622,7 +622,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { ythrow yexception() << "should not read after EOF"; } - const size_t toWrite = Min(len, Data_.size() - Pos_); + const size_t toWrite = Min(len, Data_.size() - Pos_); if (toWrite == 0) { Eof_ = true; return 0; diff --git a/library/cpp/http/io/stream_ut_medium.cpp b/library/cpp/http/io/stream_ut_medium.cpp index 2c125eb21e..7bda54f66b 100644 --- a/library/cpp/http/io/stream_ut_medium.cpp +++ b/library/cpp/http/io/stream_ut_medium.cpp @@ -32,7 +32,7 @@ Y_UNIT_TEST_SUITE(THttpTestMedium) { } try { - UNIT_ASSERT(s.size() > 10); + UNIT_ASSERT(s.size() > 10); UNIT_ASSERT(s.find(data) == TString::npos); } catch (...) { Cerr << codec << " " << s << Endl; |