diff --git a/src/proxy/tinymitm/proxy.cpp b/src/proxy/tinymitm/proxy.cpp index 8a11213..3857f30 100644 --- a/src/proxy/tinymitm/proxy.cpp +++ b/src/proxy/tinymitm/proxy.cpp @@ -305,8 +305,8 @@ void TinyMITMProxy::handleClient(SOCKET clientSocket) /* port parsing */ - size_t space = req.find(' ', 8); - std::string fullHost = req.substr(8, space - 8); + size_t endOfHost = req.find_first_of(" \r\n", 8); + std::string fullHost = req.substr(8, endOfHost - 8); size_t colon = fullHost.find(':'); std::string host = (colon != std::string::npos) ? fullHost.substr(0, colon) : fullHost; std::string port = (colon != std::string::npos) ? fullHost.substr(colon + 1) : "443";