summaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <[email protected]>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/messagebus/rain_check/http/http_code_extractor.cpp
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
Restoring authorship annotation for Anton Samokhvalov <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/rain_check/http/http_code_extractor.cpp')
-rw-r--r--library/cpp/messagebus/rain_check/http/http_code_extractor.cpp32
1 files changed, 16 insertions, 16 deletions
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 b0925c5a6b8..51d75762f68 100644
--- a/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp
+++ b/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp
@@ -8,32 +8,32 @@
#include <util/string/cast.h>
namespace NRainCheck {
- TMaybe<HttpCodes> TryGetHttpCodeFromErrorDescription(const TStringBuf& errorMessage) {
+ 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
// "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.
+ // find out HttpCode in it. It is bad temporary solution, but we have no choice.
const TStringBuf SUBSTR = "request failed(";
- const size_t SUBSTR_LEN = SUBSTR.size();
+ const size_t SUBSTR_LEN = SUBSTR.size();
const size_t FIRST_LINE_LEN = TStringBuf("HTTP/1.X NNN").size();
- TMaybe<HttpCodes> httpCode;
+ 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);
- try {
- httpCode = static_cast<HttpCodes>(ParseHttpRetCode(firstLineStart));
- if (*httpCode < HTTP_CONTINUE || *httpCode >= HTTP_CODE_MAX) {
- httpCode = Nothing();
- }
- } catch (const TFromStringException& ex) {
- // Can't parse HttpCode: it is OK, because ErrorDescription can be random string.
+ const size_t substrPos = errorMessage.find(SUBSTR);
+ if (substrPos != TStringBuf::npos) {
+ const TStringBuf firstLineStart = errorMessage.SubStr(substrPos + SUBSTR_LEN, FIRST_LINE_LEN);
+ try {
+ httpCode = static_cast<HttpCodes>(ParseHttpRetCode(firstLineStart));
+ if (*httpCode < HTTP_CONTINUE || *httpCode >= HTTP_CODE_MAX) {
+ httpCode = Nothing();
+ }
+ } catch (const TFromStringException& ex) {
+ // Can't parse HttpCode: it is OK, because ErrorDescription can be random string.
}
}
-
- return httpCode;
+
+ return httpCode;
}
}