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