diff options
author | Vlad Yaroslavlev <vladon@vladon.com> | 2022-02-10 16:46:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:23 +0300 |
commit | 706b83ed7de5a473436620367af31fc0ceecde07 (patch) | |
tree | 103305d30dec77e8f6367753367f59b3cd68f9f1 /library/cpp/http/fetch | |
parent | 918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff) | |
download | ydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz |
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/http/fetch')
-rw-r--r-- | library/cpp/http/fetch/exthttpcodes.cpp | 2 | ||||
-rw-r--r-- | library/cpp/http/fetch/exthttpcodes.h | 2 | ||||
-rw-r--r-- | library/cpp/http/fetch/http_digest.cpp | 2 | ||||
-rw-r--r-- | library/cpp/http/fetch/httpfsm.rl6 | 6 | ||||
-rw-r--r-- | library/cpp/http/fetch/httpfsm_ut.cpp | 16 | ||||
-rw-r--r-- | library/cpp/http/fetch/httpheader.h | 6 | ||||
-rw-r--r-- | library/cpp/http/fetch/httpload.cpp | 2 | ||||
-rw-r--r-- | library/cpp/http/fetch/httpparser_ut.cpp | 22 |
8 files changed, 29 insertions, 29 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); |