MCPcopy Create free account
hub / github.com/catboost/catboost / FirstLineParser

Method FirstLineParser

library/cpp/http/push_parser/http_parser.cpp:51–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51bool THttpParser::FirstLineParser() {
52 if (Y_UNLIKELY(!ReadLine())) {
53 return false;
54 }
55
56 CurrentLine_.swap(FirstLine_);
57
58 try {
59 TStringBuf s(FirstLine_);
60 if (MessageType_ == Response) {
61 // Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
62 TStringBuf httpVersion, statusCode;
63 GetNext(s, ' ', httpVersion);
64 ParseHttpVersion(httpVersion);
65 GetNext(s, ' ', statusCode);
66 RetCode_ = FromString<unsigned>(statusCode);
67
68 if (RetCode_ < 200 || RetCode_ == 204 || RetCode_ == 304) {
69 // RFC9112 6.3
70 BodyNotExpected_ = true;
71 }
72 } else {
73 // Request-Line = Method SP Request-URI SP HTTP-Version CRLF
74 TStringBuf httpVersion = s.After(' ').After(' ');
75 ParseHttpVersion(httpVersion);
76 }
77 } catch (...) {
78 throw THttpParseException() << "Cannot parse first line: " << CurrentExceptionMessage() << " First 80 chars of line: " << FirstLine_.substr(0, Min<size_t>(80ull, FirstLine_.size())).Quote();
79 }
80
81 return HeadersParser();
82}
83
84bool THttpParser::HeadersParser() {
85 while (ReadLine()) {

Callers

nothing calls this directly

Calls 8

ReadLineFunction · 0.85
GetNextFunction · 0.85
THttpParseExceptionClass · 0.85
CurrentExceptionMessageFunction · 0.85
AfterMethod · 0.80
swapMethod · 0.45
substrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected