From bb9326c5a2f04318af7e9ee87afad727a594c389 Mon Sep 17 00:00:00 2001 From: neru Date: Wed, 13 May 2026 11:33:45 -0300 Subject: [PATCH] fix: change port parsing --- src/proxy/tinymitm/proxy.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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";