mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-29 13:27:59 +03:00
update: split host and port
This commit is contained in:
@@ -294,17 +294,23 @@ int Request::parseRequest(void)
|
|||||||
void Request::copyFromMap()
|
void Request::copyFromMap()
|
||||||
{
|
{
|
||||||
std::map<std::string, std::string>::iterator it;
|
std::map<std::string, std::string>::iterator it;
|
||||||
int pos;
|
int pos = 0;
|
||||||
|
|
||||||
//host
|
//host
|
||||||
it = _headerField.find("host");
|
it = _headerField.find("host");
|
||||||
if (it != _headerField.end())
|
if (it != _headerField.end())
|
||||||
|
{
|
||||||
_host = it->second;
|
_host = it->second;
|
||||||
|
pos = _host.find(":");
|
||||||
|
if (pos != -1)
|
||||||
|
_host = _host.substr(0, pos);
|
||||||
|
}
|
||||||
|
pos = 0;
|
||||||
//content-lenght
|
//content-lenght
|
||||||
it = _headerField.find("content-length");
|
it = _headerField.find("content-length");
|
||||||
if (it != _headerField.end())
|
if (it != _headerField.end())
|
||||||
_contentLength = atoi(it->second.c_str());
|
_contentLength = atoi(it->second.c_str());
|
||||||
|
pos = 0;
|
||||||
//chunked
|
//chunked
|
||||||
it = _headerField.find("transfer-encoding");
|
it = _headerField.find("transfer-encoding");
|
||||||
if (it != _headerField.end())
|
if (it != _headerField.end())
|
||||||
@@ -313,6 +319,7 @@ void Request::copyFromMap()
|
|||||||
if ( pos != -1)
|
if ( pos != -1)
|
||||||
_chunked = true;
|
_chunked = true;
|
||||||
}
|
}
|
||||||
|
pos = 0;
|
||||||
//connection
|
//connection
|
||||||
it = _headerField.find("connection");
|
it = _headerField.find("connection");
|
||||||
if (it != _headerField.end())
|
if (it != _headerField.end())
|
||||||
|
|||||||
Reference in New Issue
Block a user