style: run clang-format
This commit is contained in:
@@ -357,7 +357,7 @@ void TinyMITMProxy::handleClient(SOCKET clientSocket)
|
||||
|
||||
std::string req(buf);
|
||||
bool isConnect = (req.find("CONNECT ") != std::string::npos);
|
||||
|
||||
|
||||
std::string host, port;
|
||||
if (isConnect)
|
||||
{
|
||||
@@ -376,21 +376,28 @@ void TinyMITMProxy::handleClient(SOCKET clientSocket)
|
||||
hostStart += 7;
|
||||
size_t hostEnd = req.find_first_of(":/ \r\n", hostStart);
|
||||
host = req.substr(hostStart, hostEnd - hostStart);
|
||||
if (req[hostEnd] == ':') {
|
||||
if (req[hostEnd] == ':')
|
||||
{
|
||||
size_t portEnd = req.find_first_of("/ \r\n", hostEnd + 1);
|
||||
port = req.substr(hostEnd + 1, portEnd - (hostEnd + 1));
|
||||
} else port = "80";
|
||||
}
|
||||
else
|
||||
port = "80";
|
||||
}
|
||||
else
|
||||
{
|
||||
host = getHeader(req, "Host");
|
||||
size_t colon = host.find(':');
|
||||
if (colon != std::string::npos) {
|
||||
if (colon != std::string::npos)
|
||||
{
|
||||
port = host.substr(colon + 1);
|
||||
host = host.substr(0, colon);
|
||||
} else port = "80";
|
||||
}
|
||||
else
|
||||
port = "80";
|
||||
}
|
||||
if (host.empty()) {
|
||||
if (host.empty())
|
||||
{
|
||||
TINYMITM_WRITELOG(error, "Unable to parse host from request: {}", req.substr(0, 100));
|
||||
return;
|
||||
}
|
||||
@@ -423,13 +430,14 @@ void TinyMITMProxy::handleClient(SOCKET clientSocket)
|
||||
clientSSL.reset(wolfSSL_new(hostCtx));
|
||||
remoteSSL.reset(wolfSSL_new(_clientCtx));
|
||||
|
||||
// temporarily removed alpn
|
||||
//char alpnList[] = "\x08http/1.1";
|
||||
//wolfSSL_UseALPN(remoteSSL.get(), alpnList, sizeof(alpnList) - 1, 0);
|
||||
//wolfSSL_UseALPN(clientSSL.get(), alpnList, sizeof(alpnList) - 1, 0);
|
||||
wolfSSL_set_fd(clientSSL.get(), (int)clientGuard);
|
||||
wolfSSL_set_fd(remoteSSL.get(), (int)remoteGuard);
|
||||
|
||||
// temporarily removed alpn
|
||||
//char alpnList[] = "\x08http/1.1";
|
||||
//wolfSSL_UseALPN(remoteSSL.get(), alpnList, sizeof(alpnList) - 1, 0);
|
||||
//wolfSSL_UseALPN(clientSSL.get(), alpnList, sizeof(alpnList) - 1, 0);
|
||||
|
||||
wolfSSL_UseSNI(remoteSSL.get(), WOLFSSL_SNI_HOST_NAME, host.c_str(), (unsigned short)host.size());
|
||||
|
||||
setNonBlocking(clientGuard, true);
|
||||
@@ -710,7 +718,8 @@ void TinyMITMProxy::handleClient(SOCKET clientSocket)
|
||||
|
||||
if (complete)
|
||||
{
|
||||
std::string url = inFlightUrls.empty() ? ((isConnect ? "https://" : "http://") + host) : inFlightUrls.front();
|
||||
std::string url = inFlightUrls.empty() ? ((isConnect ? "https://" : "http://") + host)
|
||||
: inFlightUrls.front();
|
||||
if (!inFlightUrls.empty()) inFlightUrls.pop_front();
|
||||
std::string respHeaders = serverStream.buffer.substr(0, serverStream.headersEnd + 4);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user