feat: allow url modification
This commit is contained in:
@@ -335,6 +335,10 @@ void Proxy::handleClient(SOCKET hClientSocket)
|
|||||||
{
|
{
|
||||||
std::string emptyBody = "";
|
std::string emptyBody = "";
|
||||||
OnClientRequest.run(url, emptyBody, headers);
|
OnClientRequest.run(url, emptyBody, headers);
|
||||||
|
|
||||||
|
if (!pendingUrls.empty())
|
||||||
|
pendingUrls.back() = url;
|
||||||
|
|
||||||
SSL_write(remoteSSL, headers.data(), (int)headers.size());
|
SSL_write(remoteSSL, headers.data(), (int)headers.size());
|
||||||
clientStream.buffer.erase(0, clientStream.headersEnd + 4);
|
clientStream.buffer.erase(0, clientStream.headersEnd + 4);
|
||||||
clientStream.reset();
|
clientStream.reset();
|
||||||
@@ -383,6 +387,9 @@ void Proxy::handleClient(SOCKET hClientSocket)
|
|||||||
if (complete)
|
if (complete)
|
||||||
{
|
{
|
||||||
OnClientRequest.run(url, body, headers);
|
OnClientRequest.run(url, body, headers);
|
||||||
|
if (!pendingUrls.empty() && pendingUrls.back() != url)
|
||||||
|
pendingUrls.back() = url;
|
||||||
|
|
||||||
SSL_write(remoteSSL, headers.data(), (int)headers.size());
|
SSL_write(remoteSSL, headers.data(), (int)headers.size());
|
||||||
SSL_write(remoteSSL, clientStream.buffer.data() + bodyStart,
|
SSL_write(remoteSSL, clientStream.buffer.data() + bodyStart,
|
||||||
(int)(clientStream.buffer.size() - bodyStart));
|
(int)(clientStream.buffer.size() - bodyStart));
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class Proxy
|
|||||||
bool Init();
|
bool Init();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
CallbackEvent<const std::string&, const std::string&, std::string&> OnClientRequest;
|
CallbackEvent<std::string&, const std::string&, std::string&> OnClientRequest;
|
||||||
CallbackEvent<const std::string&, std::string&, std::string&> OnServerResponse;
|
CallbackEvent<const std::string&, std::string&, std::string&> OnServerResponse;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user