Start working on build system.
This commit is contained in:
parent
4b308f6c32
commit
521486be62
88 changed files with 1065 additions and 349 deletions
|
@ -1,97 +0,0 @@
|
|||
#include "HttpHeader.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
|
||||
HttpHeader::HttpHeader()
|
||||
: mHttpVersion("1.1"),
|
||||
mContentType("text / html")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string HttpHeader::getContentType() const
|
||||
{
|
||||
return mContentType;
|
||||
}
|
||||
|
||||
std::string HttpHeader::getHttpVersion() const
|
||||
{
|
||||
return mHttpVersion;
|
||||
}
|
||||
|
||||
void HttpHeader::parse(const std::vector<std::string >& message)
|
||||
{
|
||||
std::string tag;
|
||||
std::string value;
|
||||
bool foundDelimiter{false};
|
||||
for (const auto& line : message)
|
||||
{
|
||||
for(std::size_t idx = 0; idx< line.size(); idx++)
|
||||
{
|
||||
const auto c = line[idx];
|
||||
if (c == StringUtils::COLON)
|
||||
{
|
||||
foundDelimiter = true;
|
||||
}
|
||||
else if(foundDelimiter)
|
||||
{
|
||||
value.push_back(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
tag.push_back(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tag.empty() || value.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (tag == "Host")
|
||||
{
|
||||
mHost = value;
|
||||
}
|
||||
else if (tag == "User-Agent")
|
||||
{
|
||||
mUserAgent = value;
|
||||
}
|
||||
else if (tag == "Accept")
|
||||
{
|
||||
mAccept = value;
|
||||
}
|
||||
else if (tag == "Accept-Language")
|
||||
{
|
||||
mAcceptLanguage = value;
|
||||
}
|
||||
else if (tag == "Accept-Encoding")
|
||||
{
|
||||
mAcceptEncoding = value;
|
||||
}
|
||||
else if (tag == "Connection")
|
||||
{
|
||||
mConnection = value;
|
||||
}
|
||||
else if (tag == "Referer")
|
||||
{
|
||||
mReferer = value;
|
||||
}
|
||||
else if (tag == "Sec-Fetch-Dest")
|
||||
{
|
||||
mSecFetchDest = value;
|
||||
}
|
||||
else if (tag == "Sec-Fetch-Mode")
|
||||
{
|
||||
mSecFetchMode = value;
|
||||
}
|
||||
else if (tag == "Sec-Fetch-Site")
|
||||
{
|
||||
mSecFetchSite = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
mOtherFields[tag] = value;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue