From 7a67670e1a128bb33dec465cd8d5faefc7aedd99 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 11 Apr 2017 14:36:28 -0400 Subject: [PATCH] Fixed #846. httpproxy.addresshelper config parameter added --- Config.cpp | 1 + HTTPProxy.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Config.cpp b/Config.cpp index 7dada817..64b7a792 100644 --- a/Config.cpp +++ b/Config.cpp @@ -94,6 +94,7 @@ namespace config { ("httpproxy.latency.min", value()->default_value("0"), "HTTP proxy min latency for tunnels") ("httpproxy.latency.max", value()->default_value("0"), "HTTP proxy max latency for tunnels") ("httpproxy.outproxy", value()->default_value(""), "HTTP proxy upstream out proxy url") + ("httpproxy.addresshelper", value()->default_value(true), "Enable or disable addresshelper") ; options_description socksproxy("SOCKS Proxy options"); diff --git a/HTTPProxy.cpp b/HTTPProxy.cpp index 5abd6112..55bd60fe 100644 --- a/HTTPProxy.cpp +++ b/HTTPProxy.cpp @@ -237,7 +237,15 @@ namespace proxy { LogPrint(eLogDebug, "HTTPProxy: requested: ", m_ClientRequest.uri); m_RequestURL.parse(m_ClientRequest.uri); - if (ExtractAddressHelper(m_RequestURL, b64)) { + if (ExtractAddressHelper(m_RequestURL, b64)) + { + bool addresshelper; i2p::config::GetOption("httpproxy.addresshelper", addresshelper); + if (!addresshelper) + { + LogPrint(eLogWarning, "HTTPProxy: addresshelper disabled"); + GenericProxyError("Invalid request", "adddresshelper is not supported"); + return true; + } i2p::client::context.GetAddressBook ().InsertAddress (m_RequestURL.host, b64); LogPrint (eLogInfo, "HTTPProxy: added b64 from addresshelper for ", m_RequestURL.host); std::string full_url = m_RequestURL.to_string();