diff options
author | vartyukh <vartyukh@yandex-team.ru> | 2022-02-10 16:50:16 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:16 +0300 |
commit | 18f9abdade80b500b7ea1ef2d286e2465a1c8466 (patch) | |
tree | d2bebd1789fee0b44b94e11ee90b1634b9fcdfbe /library/cpp/messagebus/rain_check | |
parent | c0fb261e6889e12b418ebcdfdb3c990a4b39fd75 (diff) | |
download | ydb-18f9abdade80b500b7ea1ef2d286e2465a1c8466.tar.gz |
Restoring authorship annotation for <vartyukh@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/messagebus/rain_check')
6 files changed, 36 insertions, 36 deletions
diff --git a/library/cpp/messagebus/rain_check/http/client.cpp b/library/cpp/messagebus/rain_check/http/client.cpp index 5ef5ceeece..eec4b619af 100644 --- a/library/cpp/messagebus/rain_check/http/client.cpp +++ b/library/cpp/messagebus/rain_check/http/client.cpp @@ -1,7 +1,7 @@ #include "client.h" -#include "http_code_extractor.h" - +#include "http_code_extractor.h" + #include <library/cpp/http/io/stream.h> #include <library/cpp/neh/factory.h> #include <library/cpp/neh/http_common.h> @@ -9,7 +9,7 @@ #include <library/cpp/neh/neh.h> #include <util/generic/ptr.h> -#include <util/generic/strbuf.h> +#include <util/generic/strbuf.h> #include <util/network/socket.h> #include <util/stream/str.h> @@ -129,7 +129,7 @@ namespace NRainCheck { return Response->Data; } - + void THttpFuture::SetDoneAndSchedule(TAutoPtr<NNeh::TResponse> response) { if (!response->IsError()) { ErrorCode = THttpFuture::NoError; diff --git a/library/cpp/messagebus/rain_check/http/client.h b/library/cpp/messagebus/rain_check/http/client.h index d4199c4c98..343205ade4 100644 --- a/library/cpp/messagebus/rain_check/http/client.h +++ b/library/cpp/messagebus/rain_check/http/client.h @@ -4,7 +4,7 @@ #include <library/cpp/http/misc/httpcodes.h> -#include <util/generic/maybe.h> +#include <util/generic/maybe.h> #include <util/generic/ptr.h> #include <util/generic/string.h> #include <util/system/defaults.h> @@ -45,7 +45,7 @@ namespace NRainCheck { ui32 GetHttpCode() const; TString GetResponseBody() const; - + bool HasError() const; EError GetErrorCode() const; TString GetErrorDescription() const; diff --git a/library/cpp/messagebus/rain_check/http/client_ut.cpp b/library/cpp/messagebus/rain_check/http/client_ut.cpp index 1628114391..ef1712a03d 100644 --- a/library/cpp/messagebus/rain_check/http/client_ut.cpp +++ b/library/cpp/messagebus/rain_check/http/client_ut.cpp @@ -1,7 +1,7 @@ #include <library/cpp/testing/unittest/registar.h> #include "client.h" -#include "http_code_extractor.h" +#include "http_code_extractor.h" #include <library/cpp/messagebus/rain_check/test/ut/test.h> @@ -173,26 +173,26 @@ Y_UNIT_TEST_SUITE(RainCheckHttpClient) { env.TestSync.WaitForAndIncrement(1); } - + Y_UNIT_TEST(HttpCodeExtraction) { // Find "request failed(" string, then copy len("HTTP/1.X NNN") chars and try to convert NNN to HTTP code. - + #define CHECK_VALID_LINE(line, code) \ UNIT_ASSERT_NO_EXCEPTION(TryGetHttpCodeFromErrorDescription(line)); \ UNIT_ASSERT(!!TryGetHttpCodeFromErrorDescription(line)); \ UNIT_ASSERT_EQUAL(*TryGetHttpCodeFromErrorDescription(line), code) - + CHECK_VALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.0 200 Some random message"), 200); CHECK_VALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.0 404 Some random message"), 404); CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.0 100 Some random message"), 100); CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.0 105)"), 105); CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.1 2004 Some random message"), 200); -#undef CHECK_VALID_LINE - +#undef CHECK_VALID_LINE + #define CHECK_INVALID_LINE(line) \ UNIT_ASSERT_NO_EXCEPTION(TryGetHttpCodeFromErrorDescription(line)); \ UNIT_ASSERT(!TryGetHttpCodeFromErrorDescription(line)) - + CHECK_INVALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.1 1 Some random message")); CHECK_INVALID_LINE(TStringBuf("request failed(HTTP/1.0 asdf Some random message")); CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200 Some random message")); @@ -200,6 +200,6 @@ Y_UNIT_TEST_SUITE(RainCheckHttpClient) { CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200 Some random message")); CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200")); CHECK_INVALID_LINE(TStringBuf("request failed(HTTP/1.1 3334 Some random message")); -#undef CHECK_INVALID_LINE - } +#undef CHECK_INVALID_LINE + } } diff --git a/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp b/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp index 51d75762f6..3d97899d3b 100644 --- a/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp +++ b/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp @@ -1,13 +1,13 @@ -#include "http_code_extractor.h" - +#include "http_code_extractor.h" + #include <library/cpp/http/io/stream.h> #include <library/cpp/http/misc/httpcodes.h> #include <util/generic/maybe.h> -#include <util/generic/strbuf.h> -#include <util/string/cast.h> - -namespace NRainCheck { +#include <util/generic/strbuf.h> +#include <util/string/cast.h> + +namespace NRainCheck { TMaybe<HttpCodes> TryGetHttpCodeFromErrorDescription(const TStringBuf& errorMessage) { // Try to get HttpCode from library/cpp/neh response. // If response has HttpCode and it is not 200 OK, library/cpp/neh will send a message @@ -17,9 +17,9 @@ namespace NRainCheck { const TStringBuf SUBSTR = "request failed("; const size_t SUBSTR_LEN = SUBSTR.size(); const size_t FIRST_LINE_LEN = TStringBuf("HTTP/1.X NNN").size(); - + TMaybe<HttpCodes> httpCode; - + const size_t substrPos = errorMessage.find(SUBSTR); if (substrPos != TStringBuf::npos) { const TStringBuf firstLineStart = errorMessage.SubStr(substrPos + SUBSTR_LEN, FIRST_LINE_LEN); @@ -30,10 +30,10 @@ namespace NRainCheck { } } catch (const TFromStringException& ex) { // Can't parse HttpCode: it is OK, because ErrorDescription can be random string. - } - } + } + } return httpCode; - } - -} + } + +} diff --git a/library/cpp/messagebus/rain_check/http/http_code_extractor.h b/library/cpp/messagebus/rain_check/http/http_code_extractor.h index 33b565fa1c..553a1017ec 100644 --- a/library/cpp/messagebus/rain_check/http/http_code_extractor.h +++ b/library/cpp/messagebus/rain_check/http/http_code_extractor.h @@ -1,16 +1,16 @@ -#pragma once - +#pragma once + #include <library/cpp/http/misc/httpcodes.h> -#include <util/generic/maybe.h> -#include <util/generic/strbuf.h> - -namespace NRainCheck { +#include <util/generic/maybe.h> +#include <util/generic/strbuf.h> + +namespace NRainCheck { // Try to get HttpCode from library/cpp/neh response. // If response has HttpCode and it is not 200 OK, library/cpp/neh will send a message // "library/cpp/neh/http.cpp:<LINE>: request failed(<FIRST-HTTP-RESPONSE-LINE>)" // (see library/cpp/neh/http.cpp:625). So, we will try to parse this message and // find out HttpCode in it. It is bad temporary solution, but we have no choice. TMaybe<HttpCodes> TryGetHttpCodeFromErrorDescription(const TStringBuf& errorMessage); - + } diff --git a/library/cpp/messagebus/rain_check/http/ya.make b/library/cpp/messagebus/rain_check/http/ya.make index ef13329df3..3a5b1b1c50 100644 --- a/library/cpp/messagebus/rain_check/http/ya.make +++ b/library/cpp/messagebus/rain_check/http/ya.make @@ -4,7 +4,7 @@ OWNER(g:messagebus) SRCS( client.cpp - http_code_extractor.cpp + http_code_extractor.cpp ) PEERDIR( |