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 | |
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')
-rw-r--r-- | library/cpp/http/fetch/httpfsm_ut.cpp | 6 | ||||
-rw-r--r-- | library/cpp/http/fetch/httpparser_ut.cpp | 20 | ||||
-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 | ||||
-rw-r--r-- | library/cpp/http/misc/httpcodes.h | 2 | ||||
-rw-r--r-- | library/cpp/http/misc/httpreqdata.cpp | 18 | ||||
-rw-r--r-- | library/cpp/http/misc/httpreqdata_ut.cpp | 2 | ||||
-rw-r--r-- | library/cpp/http/server/http.cpp | 10 | ||||
-rw-r--r-- | library/cpp/http/server/http_ut.cpp | 26 | ||||
-rw-r--r-- | library/cpp/http/server/response.cpp | 8 |
13 files changed, 83 insertions, 83 deletions
diff --git a/library/cpp/http/fetch/httpfsm_ut.cpp b/library/cpp/http/fetch/httpfsm_ut.cpp index b018e80101..575f269af5 100644 --- a/library/cpp/http/fetch/httpfsm_ut.cpp +++ b/library/cpp/http/fetch/httpfsm_ut.cpp @@ -404,7 +404,7 @@ void THttpHeaderParserTestSuite::TestHreflangOnLongInput() { httpHeaderParser->Init(&httpHeader); TStringBuf testInput(hreflang_ut_in); TStringBuf testOut(hreflang_ut_out); - i32 result = httpHeaderParser->Execute(testInput.data(), testInput.size()); + i32 result = httpHeaderParser->Execute(testInput.data(), testInput.size()); UNIT_ASSERT_VALUES_EQUAL(result, 2); UNIT_ASSERT_VALUES_EQUAL(httpHeader.hreflangs, testOut); TestFinish(); @@ -496,11 +496,11 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) { } static THttpChunkParser parseByteByByte(const TStringBuf& blob, const TVector<int>& states) { - UNIT_ASSERT(states.size() <= blob.size()); + 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()); + int code = parser.Execute(d.data(), d.size()); Cout << TString(d).Quote() << " " << code << Endl; UNIT_ASSERT_EQUAL(code, states[n]); } diff --git a/library/cpp/http/fetch/httpparser_ut.cpp b/library/cpp/http/fetch/httpparser_ut.cpp index 3b3b938e7a..067c88f010 100644 --- a/library/cpp/http/fetch/httpparser_ut.cpp +++ b/library/cpp/http/fetch/httpparser_ut.cpp @@ -55,7 +55,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { THttpHeader hdr; THttpParser<> parser; parser.Init(&hdr); - parser.Parse((void*)blob.data(), blob.size()); + parser.Parse((void*)blob.data(), blob.size()); UNIT_ASSERT_EQUAL(parser.GetState(), parser.hp_error); // can't parse request as response } @@ -69,7 +69,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { THttpHeader hdr; TTestHttpParser parser; parser.Init(&hdr); - parser.Parse((void*)blob.data(), blob.size()); + parser.Parse((void*)blob.data(), blob.size()); UNIT_ASSERT_EQUAL(parser.GetState(), parser.hp_eof); UNIT_ASSERT_EQUAL(parser.Body(), "OK"); UNIT_ASSERT_EQUAL(hdr.header_size, strlen( @@ -94,7 +94,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { THttpHeader hdr; TTestHttpParser parser; parser.Init(&hdr); - parser.Parse((void*)blob.data(), blob.size()); + parser.Parse((void*)blob.data(), blob.size()); UNIT_ASSERT_EQUAL(parser.GetState(), parser.hp_eof); UNIT_ASSERT_EQUAL(parser.Body(), "OkAllRight"); UNIT_ASSERT_EQUAL(hdr.header_size, strlen( @@ -135,9 +135,9 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { THttpHeader hdr; TTestHttpParser parser; parser.Init(&hdr); - for (size_t i = 0; i < blob.size(); ++i) { + for (size_t i = 0; i < blob.size(); ++i) { const TStringBuf d{blob, i, 1}; - parser.Parse((void*)d.data(), d.size()); + parser.Parse((void*)d.data(), d.size()); Cout << TString(d).Quote() << " -> " << parser.GetState() << Endl; } AssertPipelineClen(parser, hdr); @@ -151,7 +151,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { THttpHeader hdr; TTestHttpParser parser; parser.Init(&hdr); - parser.Parse((void*)blob.data(), blob.size()); + parser.Parse((void*)blob.data(), blob.size()); AssertPipelineClen(parser, hdr); UNIT_ASSERT_EQUAL(parser.Body(), "OK\r\n" @@ -210,11 +210,11 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { THttpHeader hdr; TTestHttpParser parser; parser.Init(&hdr); - for (size_t i = 0; i < blob.size(); ++i) { + for (size_t i = 0; i < blob.size(); ++i) { const TStringBuf d{blob, i, 1}; - parser.Parse((void*)d.data(), d.size()); + parser.Parse((void*)d.data(), d.size()); Cout << TString(d).Quote() << " -> " << parser.GetState() << Endl; - if (blob.size() / 2 - 1 <= i) // last \n sets EOF + if (blob.size() / 2 - 1 <= i) // last \n sets EOF UNIT_ASSERT_EQUAL(parser.GetState(), parser.hp_eof); } AssertPipelineChunked(parser, hdr); @@ -225,7 +225,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { THttpHeader hdr; TTestHttpParser parser; parser.Init(&hdr); - parser.Parse((void*)blob.data(), blob.size()); + parser.Parse((void*)blob.data(), blob.size()); AssertPipelineChunked(parser, hdr); } } 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; diff --git a/library/cpp/http/misc/httpcodes.h b/library/cpp/http/misc/httpcodes.h index cbfbaa1188..79953dcc22 100644 --- a/library/cpp/http/misc/httpcodes.h +++ b/library/cpp/http/misc/httpcodes.h @@ -82,7 +82,7 @@ inline TStringBuf HttpCodeStr(int code) noexcept { } inline bool IsHttpCode(int code) noexcept { - return HttpCodeStrEx(code).data() != HttpCodeStrEx(0).data(); + return HttpCodeStrEx(code).data() != HttpCodeStrEx(0).data(); } inline bool IsUserError(int code) noexcept { diff --git a/library/cpp/http/misc/httpreqdata.cpp b/library/cpp/http/misc/httpreqdata.cpp index f6951f68cd..3d4c73d0de 100644 --- a/library/cpp/http/misc/httpreqdata.cpp +++ b/library/cpp/http/misc/httpreqdata.cpp @@ -42,8 +42,8 @@ void TBaseServerRequestData::AppendQueryString(const char* str, size_t length) { ModifiedQueryString.Assign(str, length); } ModifiedQueryString.Append('\0'); - Search = ModifiedQueryString.data(); - SearchLength = ModifiedQueryString.size() - 1; // ignore terminator + Search = ModifiedQueryString.data(); + SearchLength = ModifiedQueryString.size() - 1; // ignore terminator } void TBaseServerRequestData::SetRemoteAddr(TStringBuf addr) { @@ -71,7 +71,7 @@ const char* TBaseServerRequestData::HeaderIn(TStringBuf key) const { return nullptr; } - return it->second.data(); + return it->second.data(); } TString TBaseServerRequestData::HeaderByIndex(size_t n) const noexcept { @@ -98,9 +98,9 @@ const char* TBaseServerRequestData::Environment(const char* key) const { } else if (stricmp(key, "QUERY_STRING") == 0) { return QueryString(); } else if (stricmp(key, "SERVER_NAME") == 0) { - return ServerName().data(); + return ServerName().data(); } else if (stricmp(key, "SERVER_PORT") == 0) { - return ServerPort().data(); + return ServerPort().data(); } else if (stricmp(key, "SCRIPT_NAME") == 0) { return ScriptName(); } @@ -133,7 +133,7 @@ const char* TBaseServerRequestData::GetCurPage() const { CurPage += Search; } } - return CurPage.data(); + return CurPage.data(); } bool TBaseServerRequestData::Parse(const char* origReq) { @@ -182,8 +182,8 @@ bool TBaseServerRequestData::Parse(const char* origReq) { void TBaseServerRequestData::AddHeader(const TString& name, const TString& value) { HeadersIn_[name] = value; - if (stricmp(name.data(), "Host") == 0) { - size_t hostLen = strcspn(value.data(), ":"); + if (stricmp(name.data(), "Host") == 0) { + size_t hostLen = strcspn(value.data(), ":"); if (value[hostLen] == ':') Port = value.substr(hostLen + 1); Host = value.substr(0, hostLen); @@ -191,6 +191,6 @@ void TBaseServerRequestData::AddHeader(const TString& name, const TString& value } void TBaseServerRequestData::SetPath(const TString& path) { - PathStorage = TBuffer(path.data(), path.size() + 1); + PathStorage = TBuffer(path.data(), path.size() + 1); Path = PathStorage.Data(); } diff --git a/library/cpp/http/misc/httpreqdata_ut.cpp b/library/cpp/http/misc/httpreqdata_ut.cpp index e7f16ef27c..dcfa2a18fa 100644 --- a/library/cpp/http/misc/httpreqdata_ut.cpp +++ b/library/cpp/http/misc/httpreqdata_ut.cpp @@ -123,7 +123,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) { UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), rd.OrigQueryStringBuf()); constexpr TStringBuf appendix = "gta=true>a=new"; - rd.AppendQueryString(appendix.data(), appendix.size()); + rd.AppendQueryString(appendix.data(), appendix.size()); UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs + '&' + appendix); UNIT_ASSERT_STRINGS_EQUAL(rd.OrigQueryStringBuf(), qs); diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp index 128583bdd7..8aa7ccb08a 100644 --- a/library/cpp/http/server/http.cpp +++ b/library/cpp/http/server/http.cpp @@ -352,7 +352,7 @@ public: for (;;) { try { const TInstant deadline = Options_.PollTimeout == TDuration::Zero() ? TInstant::Max() : now + Options_.PollTimeout; - const size_t ret = Poller->WaitD(events.data(), events.size(), deadline); + const size_t ret = Poller->WaitD(events.data(), events.size(), deadline); now = TInstant::Now(); for (size_t i = 0; i < ret; ++i) { @@ -368,7 +368,7 @@ public: // poller. Thus in this case we can safely process only one // event from the poller at a time. if (!Options_.MaxConnections && Options_.ExpirationTimeout == TDuration::Zero()) { - if (ret >= events.size()) { + if (ret >= events.size()) { events.resize(ret * 2); } } @@ -617,7 +617,7 @@ TClientRequest::~TClientRequest() { } bool TClientRequest::Reply(void* /*ThreadSpecificResource*/) { - if (strnicmp(RequestString.data(), "GET ", 4)) { + if (strnicmp(RequestString.data(), "GET ", 4)) { Output() << "HTTP/1.0 501 Not Implemented\r\n\r\n"; } else { Output() << "HTTP/1.0 200 OK\r\n" @@ -732,9 +732,9 @@ void TClientRequest::ProcessFailRequest(int failstate) { TString url; - if (!strnicmp(RequestString.data(), "GET ", 4)) { + if (!strnicmp(RequestString.data(), "GET ", 4)) { // Trying to extract url... - const char* str = RequestString.data(); + const char* str = RequestString.data(); // Skipping spaces before url... size_t start = 3; diff --git a/library/cpp/http/server/http_ut.cpp b/library/cpp/http/server/http_ut.cpp index cc62bb988e..6c1748b7ad 100644 --- a/library/cpp/http/server/http_ut.cpp +++ b/library/cpp/http/server/http_ut.cpp @@ -25,8 +25,8 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { } 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_; } @@ -153,7 +153,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { for (;;) { TString buf; si.ReadLine(buf); - if (buf.size() == 0) { + if (buf.size() == 0) { break; } ss << buf << CrLf; @@ -189,7 +189,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { r << Type << " / HTTP/1.1" << CrLf; r << "Host: localhost:" + ToString(Port) << CrLf; if (isPost) { - if (ContentEncoding.size()) { + if (ContentEncoding.size()) { r << "Content-Encoding: " << ContentEncoding << CrLf; } else { r << "Transfer-Encoding: chunked" << CrLf; @@ -225,34 +225,34 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { if (isPost && Expect100Continue) { r << "Expect: 100-continue" << CrLf; } - if (isPost && ContentEncoding.size() && Content.size()) { + if (isPost && ContentEncoding.size() && Content.size()) { r << "Content-Encoding: " << ContentEncoding << CrLf; TStringStream compressedContent; { TZLibCompress zlib(&compressedContent); - zlib.Write(Content.data(), Content.size()); + zlib.Write(Content.data(), Content.size()); zlib.Flush(); zlib.Finish(); } r << "Content-Length: " << compressedContent.Size() << CrLf; r << CrLf; - s->Send(r.Data(), r.Size()); + s->Send(r.Data(), r.Size()); CheckContinue(si); Hdr = r.Str(); TString tosend = compressedContent.Str(); - s->Send(tosend.data(), tosend.size()); + s->Send(tosend.data(), tosend.size()); } else { if (isPost) { - r << "Content-Length: " << Content.size() << CrLf; + r << "Content-Length: " << Content.size() << CrLf; r << CrLf; - s->Send(r.Data(), r.Size()); + s->Send(r.Data(), r.Size()); CheckContinue(si); Hdr = r.Str(); - s->Send(Content.data(), Content.size()); + s->Send(Content.data(), Content.size()); } else { r << CrLf; Hdr = r.Str(); - s->Send(r.Data(), r.Size()); + s->Send(r.Data(), r.Size()); } } } @@ -268,7 +268,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { if (UseHttpOutput) { TStringStream ss; ss << (KeepAliveConnection ? "keep-alive " : "") << Type; - if (ContentEncoding.size()) { + if (ContentEncoding.size()) { ss << " with encoding=" << ContentEncoding; } return ss.Str(); diff --git a/library/cpp/http/server/response.cpp b/library/cpp/http/server/response.cpp index 52d64c91ce..0a89709d44 100644 --- a/library/cpp/http/server/response.cpp +++ b/library/cpp/http/server/response.cpp @@ -39,10 +39,10 @@ void THttpResponse::OutTo(IOutputStream& os) const { char buf[50]; - if (!Content.empty()) { + if (!Content.empty()) { TMemoryOutput mo(buf, sizeof(buf)); - mo << Content.size(); + mo << Content.size(); parts.push_back(IOutputStream::TPart(TStringBuf("Content-Length: "))); parts.push_back(IOutputStream::TPart(buf, mo.Buf() - buf)); @@ -52,11 +52,11 @@ void THttpResponse::OutTo(IOutputStream& os) const { // content parts.push_back(IOutputStream::TPart::CrLf()); - if (!Content.empty()) { + if (!Content.empty()) { parts.push_back(IOutputStream::TPart(Content)); } - os.Write(parts.data(), parts.size()); + os.Write(parts.data(), parts.size()); } template <> |