From 74d9bf0d5525426feae4ea21e2a81034ddcf4d7f Mon Sep 17 00:00:00 2001 From: Robin Cornelius Date: Mon, 28 Mar 2011 11:20:06 +0100 Subject: VWR-20801 Implement SOCKS 5 Proxy for the viewer --- indra/newview/llxmlrpctransaction.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'indra/newview/llxmlrpctransaction.cpp') diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index 257884d921..b3d899c61a 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -41,6 +41,8 @@ #include "llappviewer.h" #include "lltrans.h" +#include "llsocks5.h" + // Static instance of LLXMLRPCListener declared here so that every time we // bring in this code, we instantiate a listener. If we put the static // instance of LLXMLRPCListener into llxmlrpclistener.cpp, the linker would @@ -307,16 +309,23 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip) } mErrorCert = NULL; - if (gSavedSettings.getBOOL("BrowserProxyEnabled")) + if (LLSocks::getInstance()->isHttpProxyEnabled()) { - mProxyAddress = gSavedSettings.getString("BrowserProxyAddress"); - S32 port = gSavedSettings.getS32 ( "BrowserProxyPort" ); - - // tell curl about the settings - mCurlRequest->setoptString(CURLOPT_PROXY, mProxyAddress); + std::string address = LLSocks::getInstance()->getHTTPProxy().getIPString(); + U16 port = LLSocks::getInstance()->getHTTPProxy().getPort(); + mCurlRequest->setoptString(CURLOPT_PROXY, address.c_str()); mCurlRequest->setopt(CURLOPT_PROXYPORT, port); + if (LLSocks::getInstance()->getHttpProxyType() == LLPROXY_SOCKS) + { + mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); + if(LLSocks::getInstance()->getSelectedAuthMethod()==METHOD_PASSWORD) + mCurlRequest->setoptString(CURLOPT_PROXYUSERPWD,LLSocks::getInstance()->getProxyUserPwd()); + } + else + { mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_HTTP); } + } // mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // usefull for debugging mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1); -- cgit v1.2.3 From 6ce2c20a06e32825f4e4260575059a9867510ecd Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Fri, 10 Jun 2011 17:34:00 -0400 Subject: STORM-1112 First pass at cleanup of SOCKS 5 proxy code based on Linden Coding Standard and comments in the code review. --- indra/newview/llxmlrpctransaction.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/llxmlrpctransaction.cpp') diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index b3d899c61a..87d2f780be 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -319,15 +319,17 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip) { mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); if(LLSocks::getInstance()->getSelectedAuthMethod()==METHOD_PASSWORD) + { mCurlRequest->setoptString(CURLOPT_PROXYUSERPWD,LLSocks::getInstance()->getProxyUserPwd()); + } } else { - mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_HTTP); - } + mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_HTTP); + } } -// mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // usefull for debugging +// mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // useful for debugging mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1); mCurlRequest->setWriteCallback(&curlDownloadCallback, (void*)this); BOOL vefifySSLCert = !gSavedSettings.getBOOL("NoVerifySSLCert"); -- cgit v1.2.3 From 20100ba38c6d3fa16ab11be2ed326ab0964c4c21 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Tue, 21 Jun 2011 17:09:12 -0400 Subject: Refactored SOCKS 5 handshake to use existing LLSocket class. --- indra/newview/llxmlrpctransaction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llxmlrpctransaction.cpp') diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index 87d2f780be..b9ce7d9fae 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -309,13 +309,13 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip) } mErrorCert = NULL; - if (LLSocks::getInstance()->isHttpProxyEnabled()) + if (LLSocks::getInstance()->isHTTPProxyEnabled()) { std::string address = LLSocks::getInstance()->getHTTPProxy().getIPString(); U16 port = LLSocks::getInstance()->getHTTPProxy().getPort(); mCurlRequest->setoptString(CURLOPT_PROXY, address.c_str()); mCurlRequest->setopt(CURLOPT_PROXYPORT, port); - if (LLSocks::getInstance()->getHttpProxyType() == LLPROXY_SOCKS) + if (LLSocks::getInstance()->getHTTPProxyType() == LLPROXY_SOCKS) { mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); if(LLSocks::getInstance()->getSelectedAuthMethod()==METHOD_PASSWORD) -- cgit v1.2.3 From 7717b6f647feb250c0b94d038f72a640a7888915 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Tue, 28 Jun 2011 19:54:53 -0400 Subject: STORM-1112 More cleanup of SOCKS 5 proxy code. Renamed llsocks5.cpp to llproxy.cpp. --- indra/newview/llxmlrpctransaction.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/newview/llxmlrpctransaction.cpp') diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index b9ce7d9fae..ef6763a5d1 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -41,7 +41,7 @@ #include "llappviewer.h" #include "lltrans.h" -#include "llsocks5.h" +#include "llproxy.h" // Static instance of LLXMLRPCListener declared here so that every time we // bring in this code, we instantiate a listener. If we put the static @@ -309,18 +309,18 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip) } mErrorCert = NULL; - if (LLSocks::getInstance()->isHTTPProxyEnabled()) + if (LLProxy::getInstance()->isHTTPProxyEnabled()) { - std::string address = LLSocks::getInstance()->getHTTPProxy().getIPString(); - U16 port = LLSocks::getInstance()->getHTTPProxy().getPort(); + std::string address = LLProxy::getInstance()->getHTTPProxy().getIPString(); + U16 port = LLProxy::getInstance()->getHTTPProxy().getPort(); mCurlRequest->setoptString(CURLOPT_PROXY, address.c_str()); mCurlRequest->setopt(CURLOPT_PROXYPORT, port); - if (LLSocks::getInstance()->getHTTPProxyType() == LLPROXY_SOCKS) + if (LLProxy::getInstance()->getHTTPProxyType() == LLPROXY_SOCKS) { mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); - if(LLSocks::getInstance()->getSelectedAuthMethod()==METHOD_PASSWORD) + if(LLProxy::getInstance()->getSelectedAuthMethod()==METHOD_PASSWORD) { - mCurlRequest->setoptString(CURLOPT_PROXYUSERPWD,LLSocks::getInstance()->getProxyUserPwd()); + mCurlRequest->setoptString(CURLOPT_PROXYUSERPWD,LLProxy::getInstance()->getProxyUserPwdCURL()); } } else -- cgit v1.2.3 From cb24dff9e36a963af280be1aead9424be8a678b6 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Wed, 13 Jul 2011 16:46:36 -0400 Subject: Code cleanup for the SOCKS 5 proxy viewer. --- indra/newview/llxmlrpctransaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llxmlrpctransaction.cpp') diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index ef6763a5d1..c88e829527 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -318,7 +318,7 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip) if (LLProxy::getInstance()->getHTTPProxyType() == LLPROXY_SOCKS) { mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); - if(LLProxy::getInstance()->getSelectedAuthMethod()==METHOD_PASSWORD) + if (LLProxy::getInstance()->getSelectedAuthMethod()==METHOD_PASSWORD) { mCurlRequest->setoptString(CURLOPT_PROXYUSERPWD,LLProxy::getInstance()->getProxyUserPwdCURL()); } -- cgit v1.2.3 From 792667ff8ef13e16823d96b490ea9a4f498425ea Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Tue, 19 Jul 2011 14:20:21 -0400 Subject: STORM-1112 Added LLProxy::applyProxySettings() to apply proxy settings to curl handles. Added call to that function everywhere curl handles are created in the viewer. --- indra/newview/llxmlrpctransaction.cpp | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'indra/newview/llxmlrpctransaction.cpp') diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index c88e829527..fe5ceea81d 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -309,25 +309,7 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip) } mErrorCert = NULL; - if (LLProxy::getInstance()->isHTTPProxyEnabled()) - { - std::string address = LLProxy::getInstance()->getHTTPProxy().getIPString(); - U16 port = LLProxy::getInstance()->getHTTPProxy().getPort(); - mCurlRequest->setoptString(CURLOPT_PROXY, address.c_str()); - mCurlRequest->setopt(CURLOPT_PROXYPORT, port); - if (LLProxy::getInstance()->getHTTPProxyType() == LLPROXY_SOCKS) - { - mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); - if (LLProxy::getInstance()->getSelectedAuthMethod()==METHOD_PASSWORD) - { - mCurlRequest->setoptString(CURLOPT_PROXYUSERPWD,LLProxy::getInstance()->getProxyUserPwdCURL()); - } - } - else - { - mCurlRequest->setopt(CURLOPT_PROXYTYPE, CURLPROXY_HTTP); - } - } + LLProxy::getInstance()->applyProxySettings(mCurlRequest); // mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // useful for debugging mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1); -- cgit v1.2.3 From 5915da89f06106d0e811c6655144df93d35144f8 Mon Sep 17 00:00:00 2001 From: Logan Dethrow Date: Mon, 8 Aug 2011 15:53:06 -0400 Subject: LLProxy cleanup. Made the socks proxy start first in llstartup.cpp Moved initialization of the proxy to before the HTTP table fetch Added Doxygen comments to LLProxy methods. Removed call to applyProxySettings in llxmlrpctransaction.cpp since the ctor of LLCurlEasyRequest will apply the proxy settings. --- indra/newview/llxmlrpctransaction.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llxmlrpctransaction.cpp') diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index 7683d4feb5..f483ba5af8 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -41,8 +41,6 @@ #include "llappviewer.h" #include "lltrans.h" -#include "llproxy.h" - // Static instance of LLXMLRPCListener declared here so that every time we // bring in this code, we instantiate a listener. If we put the static // instance of LLXMLRPCListener into llxmlrpclistener.cpp, the linker would @@ -308,8 +306,6 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip) mCurlRequest = new LLCurlEasyRequest(); } mErrorCert = NULL; - - LLProxy::getInstance()->applyProxySettings(mCurlRequest); // mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // useful for debugging mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1); -- cgit v1.2.3