|
|
|
@ -87,6 +87,7 @@ namespace proxy {
@@ -87,6 +87,7 @@ namespace proxy {
|
|
|
|
|
std::shared_ptr<boost::asio::ip::tcp::socket> m_proxysock; |
|
|
|
|
boost::asio::ip::tcp::resolver m_proxy_resolver; |
|
|
|
|
std::string m_OutproxyUrl; |
|
|
|
|
bool m_Addresshelper; |
|
|
|
|
i2p::http::URL m_ProxyURL; |
|
|
|
|
i2p::http::URL m_RequestURL; |
|
|
|
|
uint8_t m_socks_buf[255+8]; // for socks request/response
|
|
|
|
@ -95,13 +96,15 @@ namespace proxy {
@@ -95,13 +96,15 @@ namespace proxy {
|
|
|
|
|
i2p::http::HTTPReq m_ClientRequest; |
|
|
|
|
i2p::http::HTTPRes m_ClientResponse; |
|
|
|
|
std::stringstream m_ClientRequestBuffer; |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
|
|
|
|
|
HTTPReqHandler(HTTPProxy * parent, std::shared_ptr<boost::asio::ip::tcp::socket> sock) : |
|
|
|
|
I2PServiceHandler(parent), m_sock(sock), |
|
|
|
|
m_proxysock(std::make_shared<boost::asio::ip::tcp::socket>(parent->GetService())), |
|
|
|
|
m_proxy_resolver(parent->GetService()), |
|
|
|
|
m_OutproxyUrl(parent->GetOutproxyURL()) {} |
|
|
|
|
m_OutproxyUrl(parent->GetOutproxyURL()), |
|
|
|
|
m_Addresshelper(parent->GetHelperSupport()) {} |
|
|
|
|
~HTTPReqHandler() { Terminate(); } |
|
|
|
|
void Handle () { AsyncSockRead(); } /* overload */ |
|
|
|
|
}; |
|
|
|
@ -253,8 +256,7 @@ namespace proxy {
@@ -253,8 +256,7 @@ namespace proxy {
|
|
|
|
|
std::string jump; |
|
|
|
|
if (ExtractAddressHelper(m_RequestURL, jump, m_Confirm)) |
|
|
|
|
{ |
|
|
|
|
bool addresshelper; i2p::config::GetOption("httpproxy.addresshelper", addresshelper); |
|
|
|
|
if (!addresshelper) |
|
|
|
|
if (!m_Addresshelper) |
|
|
|
|
{ |
|
|
|
|
LogPrint(eLogWarning, "HTTPProxy: addresshelper request rejected"); |
|
|
|
|
GenericProxyError("Invalid request", "addresshelper is not supported"); |
|
|
|
@ -621,9 +623,9 @@ namespace proxy {
@@ -621,9 +623,9 @@ namespace proxy {
|
|
|
|
|
Done (shared_from_this()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HTTPProxy::HTTPProxy(const std::string& name, const std::string& address, int port, const std::string & outproxy, std::shared_ptr<i2p::client::ClientDestination> localDestination): |
|
|
|
|
HTTPProxy::HTTPProxy(const std::string& name, const std::string& address, int port, const std::string & outproxy, bool addresshelper, std::shared_ptr<i2p::client::ClientDestination> localDestination): |
|
|
|
|
TCPIPAcceptor (address, port, localDestination ? localDestination : i2p::client::context.GetSharedLocalDestination ()), |
|
|
|
|
m_Name (name), m_OutproxyUrl(outproxy) |
|
|
|
|
m_Name (name), m_OutproxyUrl (outproxy), m_Addresshelper (addresshelper) |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|