MCPcopy Create free account
hub / github.com/chen3feng/toft / ParseStatusCode

Method ParseStatusCode

net/http/response.cpp:116–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116bool HttpResponse::ParseStatusCode(StringPiece status)
117{
118 if (status.size() != 3)
119 return false;
120 if (!isdigit(status[0]) || !isdigit(status[1]) || !isdigit(status[2]))
121 return false;
122 int code = (status[0] - '0') * 100 + (status[1] - '0') * 10 + (status[2] - '0');
123 if (code < 100 || code > 999)
124 return false;
125 m_status = static_cast<StatusCode>(code);
126 return true;
127}
128
129void HttpResponse::AppendStartLineToString(std::string* result) const {
130 StringAppend(result, "HTTP/", Version().Major(), ".", Version().Major(),

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected