From 0aeb7b79997abfed53b19d22ea7d1fcd492ba5d2 Mon Sep 17 00:00:00 2001 From: Talyx Date: Wed, 9 Feb 2022 17:17:09 +0300 Subject: [PATCH] update: split host and port --- src/Client/Request.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Client/Request.cpp b/src/Client/Request.cpp index 4729399..06996f9 100644 --- a/src/Client/Request.cpp +++ b/src/Client/Request.cpp @@ -294,17 +294,23 @@ int Request::parseRequest(void) void Request::copyFromMap() { std::map::iterator it; - int pos; + int pos = 0; //host it = _headerField.find("host"); if (it != _headerField.end()) + { _host = it->second; - + pos = _host.find(":"); + if (pos != -1) + _host = _host.substr(0, pos); + } + pos = 0; //content-lenght it = _headerField.find("content-length"); if (it != _headerField.end()) _contentLength = atoi(it->second.c_str()); + pos = 0; //chunked it = _headerField.find("transfer-encoding"); if (it != _headerField.end()) @@ -313,6 +319,7 @@ void Request::copyFromMap() if ( pos != -1) _chunked = true; } + pos = 0; //connection it = _headerField.find("connection"); if (it != _headerField.end())