MCPcopy Create free account
hub / github.com/cuberite/cuberite / OnHeaderLine

Method OnHeaderLine

src/HTTPServer/HTTPMessage.cpp:224–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222
223
224void cHTTPRequest::OnHeaderLine(const AString & a_Key, const AString & a_Value)
225{
226 if (
227 (NoCaseCompare(a_Key, "Authorization") == 0) &&
228 (strncmp(a_Value.c_str(), "Basic ", 6) == 0)
229 )
230 {
231 AString UserPass = Base64Decode(a_Value.substr(6));
232 size_t idxCol = UserPass.find(':');
233 if (idxCol != AString::npos)
234 {
235 m_AuthUsername = UserPass.substr(0, idxCol);
236 m_AuthPassword = UserPass.substr(idxCol + 1);
237 m_HasAuth = true;
238 }
239 }
240 if ((a_Key == "Connection") && (NoCaseCompare(a_Value, "keep-alive") == 0))
241 {
242 m_AllowKeepAlive = true;
243 }
244 AddHeader(a_Key, a_Value);
245}
246
247
248

Callers 1

NotifyLastMethod · 0.45

Calls 3

NoCaseCompareFunction · 0.85
Base64DecodeFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected