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

Method ParseHeaderLine

library/cpp/http/push_parser/http_parser.cpp:247–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247void THttpParser::ParseHeaderLine() {
248 if (!!HeaderLine_) {
249 if (CollectHeaders_) {
250 THttpInputHeader hdr(HeaderLine_);
251
252 Headers_.AddHeader(hdr);
253
254 ApplyHeaderLine(hdr.Name(), hdr.Value());
255 } else {
256 //some dirty optimization (avoid reallocation new strings)
257 size_t pos = HeaderLine_.find(':');
258
259 if (pos == TString::npos) {
260 ythrow THttpParseException() << "can not parse http header(" << HeaderLine_.Quote() << ")";
261 }
262
263 TStringBuf name(StripString(TStringBuf(HeaderLine_.begin(), HeaderLine_.begin() + pos)));
264 TStringBuf val(StripString(TStringBuf(HeaderLine_.begin() + pos + 1, HeaderLine_.end())));
265 ApplyHeaderLine(name, val);
266 }
267 HeaderLine_.remove(0);
268 }
269}
270
271void THttpParser::OnEof() {
272 if (Parser_ == &THttpParser::ContentParser && !HasContentLength_ && !ChunkInputState_) {

Callers

nothing calls this directly

Calls 8

StripStringFunction · 0.85
AddHeaderMethod · 0.45
NameMethod · 0.45
ValueMethod · 0.45
findMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected