Compare commits
3 Commits
7e878a1ac1
...
510241e311
| Author | SHA1 | Date | |
|---|---|---|---|
| 510241e311 | |||
| 5e701e1e1b | |||
| edc4a8b500 |
@@ -335,6 +335,10 @@ void Proxy::handleClient(SOCKET hClientSocket)
|
||||
{
|
||||
std::string emptyBody = "";
|
||||
OnClientRequest.run(url, emptyBody, headers);
|
||||
|
||||
if (!pendingUrls.empty())
|
||||
pendingUrls.back() = url;
|
||||
|
||||
SSL_write(remoteSSL, headers.data(), (int)headers.size());
|
||||
clientStream.buffer.erase(0, clientStream.headersEnd + 4);
|
||||
clientStream.reset();
|
||||
@@ -383,6 +387,9 @@ void Proxy::handleClient(SOCKET hClientSocket)
|
||||
if (complete)
|
||||
{
|
||||
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, clientStream.buffer.data() + bodyStart,
|
||||
(int)(clientStream.buffer.size() - bodyStart));
|
||||
|
||||
@@ -25,7 +25,7 @@ class Proxy
|
||||
bool Init();
|
||||
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;
|
||||
|
||||
private:
|
||||
|
||||
@@ -34,8 +34,7 @@ void Spoofer::registerListeners(Proxy* proxy)
|
||||
this->serverResponseHandler(url, body, respHeaders);
|
||||
});
|
||||
|
||||
proxy->OnClientRequest.addListener(
|
||||
[this](const std::string& url, const std::string& body, std::string& reqHeaders) {
|
||||
proxy->OnClientRequest.addListener([this](std::string& url, const std::string& body, std::string& reqHeaders) {
|
||||
this->clientRequestHandler(url, body, reqHeaders);
|
||||
});
|
||||
}
|
||||
@@ -267,7 +266,9 @@ void Spoofer::modifyCharacterData(json& js)
|
||||
|
||||
void Spoofer::serverResponseHandler(const std::string& url, std::string& body, std::string& respHeaders)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (url.find("bhvrdbd.com") != std::string::npos) Log::verbose("BHVR api res @ {}", url);
|
||||
#endif
|
||||
|
||||
if (url.find("api/v1/extensions/store/getCatalogItems") != std::string::npos) return parseAndDumpCatalog(body);
|
||||
|
||||
@@ -453,7 +454,7 @@ void Spoofer::serverResponseHandler(const std::string& url, std::string& body, s
|
||||
}
|
||||
}
|
||||
|
||||
void Spoofer::clientRequestHandler(const std::string& url, const std::string& body, std::string& /*reqHeaders*/)
|
||||
void Spoofer::clientRequestHandler(std::string& url, const std::string& body, std::string& reqHeaders)
|
||||
{
|
||||
if (url.find("api/v1/dbd-character-data/bloodweb") != std::string::npos ||
|
||||
url.find("api/v1/dbd-character-data/bulk-spending-bloodweb") != std::string::npos)
|
||||
|
||||
@@ -22,7 +22,7 @@ class Spoofer
|
||||
void modifyCharacterData(nlohmann::json& js);
|
||||
|
||||
void serverResponseHandler(const std::string& url, std::string& body, std::string& respHeaders);
|
||||
void clientRequestHandler(const std::string& url, const std::string& body, std::string& reqHeaders);
|
||||
void clientRequestHandler(std::string& url, const std::string& body, std::string& reqHeaders);
|
||||
|
||||
std::unordered_set<std::string> _camperItemIds;
|
||||
std::unordered_set<std::string> _slasherPowerIds;
|
||||
|
||||
Reference in New Issue
Block a user