16 #pragma warning(disable:4355)
47 itr->second.append(
", ");
48 itr->second.append(a_Value);
52 if (Key ==
"content-type")
56 else if (Key ==
"content-length")
83 a_DataStream.append(
"HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\nContent-Type: ");
85 a_DataStream.append(
"\r\n");
88 if ((itr->first ==
"Content-Type") || (itr->first ==
"Content-Length"))
92 a_DataStream.append(itr->first);
93 a_DataStream.append(
": ");
94 a_DataStream.append(itr->second);
95 a_DataStream.append(
"\r\n");
97 a_DataStream.append(
"\r\n");
121 auto idxQuestionMark =
m_URL.find(
'?');
122 if (idxQuestionMark == AString::npos)
128 return m_URL.substr(0, idxQuestionMark);
140 (strncmp(a_Value.c_str(),
"Basic ", 6) == 0)
144 size_t idxCol = UserPass.find(
':');
145 if (idxCol != AString::npos)
152 if ((a_Key ==
"Connection") && (
NoCaseCompare(a_Value,
"keep-alive") == 0))
AString StrToLower(const AString &s)
Returns a lower-cased copy of the string.
AString Base64Decode(const AString &a_Base64String)
Decodes a Base64-encoded string into the raw data.
int NoCaseCompare(const AString &s1, const AString &s2)
Case-insensitive string comparison.
bool StringToInteger(const AString &a_str, T &a_Num)
Parses any integer type.
cHTTPMessage(eKind a_Kind)
virtual void AddHeader(const AString &a_Key, const AString &a_Value)
Adds a header into the internal map of headers.
AString m_ContentType
Type of the content; parsed by AddHeader(), set directly by SetContentLength()
AStringMap m_Headers
Map of headers, with their keys lowercased.
size_t m_ContentLength
Length of the content that is to be received.
cHTTPOutgoingResponse(void)
void AppendToData(AString &a_DataStream) const
Appends the response to the specified datastream - response line and headers.
virtual void AddHeader(const AString &a_Key, const AString &a_Value) override
Adds the specified header into the internal list of headers.
cHTTPIncomingRequest(const AString &a_Method, const AString &a_URL)
Creates a new instance of the class, containing the method and URL provided by the client.
bool m_AllowKeepAlive
Set to true if the request indicated that it supports keepalives.
AString GetURLPath(void) const
Returns the path part of the URL.
bool m_HasAuth
Set to true if the request contains auth data that was understood by the parser.
AString m_URL
Full URL of the request.
AString m_AuthUsername
The username used for auth.
AString m_AuthPassword
The password used for auth.