From 6f4d36634e980bb989b9a8b762c3c622804c43dd Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 16 Mar 2015 17:14:34 -0700 Subject: Removal of RPCXML dep on LLCurl switching to LLCore::Html --- indra/newview/llappcorehttp.cpp | 69 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'indra/newview/llappcorehttp.cpp') diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index f5f224b83e..dd39b9a959 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -31,6 +31,10 @@ #include "llappviewer.h" #include "llviewercontrol.h" +#include +#include +#include "llsecapi.h" +#include // Here is where we begin to get our connection usage under control. // This establishes llcorehttp policy classes that, among other @@ -151,6 +155,15 @@ void LLAppCoreHttp::init() << LL_ENDL; } + // Set up SSL Verification call back. + status = LLCore::HttpRequest::setStaticPolicyOption(LLCore::HttpRequest::PO_SSL_VERIFY_CALLBACK, + LLCore::HttpRequest::GLOBAL_POLICY_ID, + sslVerify, NULL); + if (!status) + { + LL_WARNS("Init") << "Failed to set SSL Verification. Reason: " << status.toString() << LL_ENDL; + } + // Tracing levels for library & libcurl (note that 2 & 3 are beyond spammy): // 0 - None // 1 - Basic start, stop simple transitions @@ -457,6 +470,62 @@ void LLAppCoreHttp::refreshSettings(bool initial) } } +LLCore::HttpStatus LLAppCoreHttp::sslVerify(const std::string &url, + LLCore::HttpHandler const * const handler, void *appdata) +{ + X509_STORE_CTX *ctx = static_cast(appdata); + LLCore::HttpStatus result; + LLPointer store = gSecAPIHandler->getCertificateStore(""); + LLPointer chain = gSecAPIHandler->getCertificateChain(ctx); + LLSD validation_params = LLSD::emptyMap(); + LLURI uri(url); + + validation_params[CERT_HOSTNAME] = uri.hostName(); + + // *TODO*: In the case of an exception while validating the cert, we need a way + // to pass the offending(?) cert back out. *Rider* + + try + { + // don't validate hostname. Let libcurl do it instead. That way, it'll handle redirects + store->validate(VALIDATION_POLICY_SSL & (~VALIDATION_POLICY_HOSTNAME), chain, validation_params); + } + catch (LLCertValidationTrustException &cert_exception) + { + // this exception is is handled differently than the general cert + // exceptions, as we allow the user to actually add the certificate + // for trust. + // therefore we pass back a different error code + // NOTE: We're currently 'wired' to pass around CURL error codes. This is + // somewhat clumsy, as we may run into errors that do not map directly to curl + // error codes. Should be refactored with login refactoring, perhaps. + result = LLCore::HttpStatus(LLCore::HttpStatus::EXT_CURL_EASY, CURLE_SSL_CACERT); + result.setMessage(cert_exception.getMessage()); + LLPointer cert = cert_exception.getCert(); + cert->ref(); // adding an extra ref here + result.setErrorData(cert.get()); + // We should probably have a more generic way of passing information + // back to the error handlers. + } + catch (LLCertException &cert_exception) + { + result = LLCore::HttpStatus(LLCore::HttpStatus::EXT_CURL_EASY, CURLE_SSL_PEER_CERTIFICATE); + result.setMessage(cert_exception.getMessage()); + LLPointer cert = cert_exception.getCert(); + cert->ref(); // adding an extra ref here + result.setErrorData(cert.get()); + } + catch (...) + { + // any other odd error, we just handle as a connect error. + result = LLCore::HttpStatus(LLCore::HttpStatus::EXT_CURL_EASY, CURLE_SSL_CONNECT_ERROR); + } + + return result; +} + + + void LLAppCoreHttp::onCompleted(LLCore::HttpHandle, LLCore::HttpResponse *) { -- cgit v1.2.3 From 9d676ce5b97d7ce09630d7d6ab8abd562b958cae Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 20 Mar 2015 13:16:25 -0700 Subject: Clean up and use policies for Material transfer. --- indra/newview/llappcorehttp.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llappcorehttp.cpp') diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index dd39b9a959..420d37369f 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -97,6 +97,11 @@ static const struct 4, 1, 4, 0, false, "", "inventory" + }, + { // AP_MATERIALS + 2, 1, 8, 0, false, + "RenderMaterials", + "material manager requests" } }; @@ -195,6 +200,8 @@ void LLAppCoreHttp::init() } mHttpClasses[app_policy].mPolicy = LLCore::HttpRequest::createPolicyClass(); + // We have run out of available HTTP policies. Adjust HTTP_POLICY_CLASS_LIMIT in _httpinternal.h + llassert(mHttpClasses[app_policy].mPolicy != LLCore::HttpRequest::INVALID_POLICY_ID); if (! mHttpClasses[app_policy].mPolicy) { // Use default policy (but don't accidentally modify default) -- cgit v1.2.3 From e140118fc41b79e403b299cabe1653af1971e87a Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 25 Mar 2015 11:31:11 -0700 Subject: Replace appearance responder with new LLCore Appearance Handler. Prep for some slight cleanup of the code. Add AP_AVATAR Policy --- indra/newview/llappcorehttp.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llappcorehttp.cpp') diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index 420d37369f..8da78a45a6 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -102,6 +102,11 @@ static const struct 2, 1, 8, 0, false, "RenderMaterials", "material manager requests" + }, + { // AP_AVATAR + 2, 1, 32, 0, true, + "Avatar", + "Avatar requests" } }; -- cgit v1.2.3 From 97b93179692b764aba7eee571f1b557f6f8070db Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 26 Mar 2015 13:32:09 -0700 Subject: Create trivial handler for SD Messages, method in LLAgent for posting HTTP requests. --- indra/newview/llappcorehttp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llappcorehttp.cpp') diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index 8da78a45a6..cd9166f7b7 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -103,10 +103,10 @@ static const struct "RenderMaterials", "material manager requests" }, - { // AP_AVATAR + { // AP_AGENT 2, 1, 32, 0, true, - "Avatar", - "Avatar requests" + "Agent", + "Agent requests" } }; -- cgit v1.2.3 From 735364038767694ea29d9b6a168410e6482cc9c2 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 27 Mar 2015 17:00:02 -0700 Subject: first set of chnages from code review from Nat --- indra/newview/llappcorehttp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llappcorehttp.cpp') diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index cd9166f7b7..51cca273d8 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -494,7 +494,7 @@ LLCore::HttpStatus LLAppCoreHttp::sslVerify(const std::string &url, validation_params[CERT_HOSTNAME] = uri.hostName(); - // *TODO*: In the case of an exception while validating the cert, we need a way + // *TODO: In the case of an exception while validating the cert, we need a way // to pass the offending(?) cert back out. *Rider* try -- cgit v1.2.3 From 907efc9cc9bcf4a935ed0e1bd17b19da2bb99dce Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 15 Sep 2015 17:01:26 -0700 Subject: MAINT-5507: Remove llcurl, move constant values and untilities to llcorehttp lib --- indra/newview/llappcorehttp.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llappcorehttp.cpp') diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index 51cca273d8..91a5148e4c 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -138,6 +138,9 @@ LLAppCoreHttp::~LLAppCoreHttp() void LLAppCoreHttp::init() { + + LLCore::LLHttp::initialize(); + LLCore::HttpStatus status = LLCore::HttpRequest::createService(); if (! status) { -- cgit v1.2.3 From bbb9d4f21b018bfffc41f790aab7b54975504027 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 14 Oct 2015 17:46:24 -0700 Subject: MAINT-5732: Change to the way event polling handles error conditions and cancel calls. Refactor any remaining LLCore::HTTPHandlers to use boost::shared_ptr Started minor refactor in the materials manager into coroutines (unfinished) --- indra/newview/llappcorehttp.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'indra/newview/llappcorehttp.cpp') diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index 91a5148e4c..ee4b91f8f2 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -278,12 +278,19 @@ void setting_changed() LLAppViewer::instance()->getAppCoreHttp().refreshSettings(false); } +namespace +{ + void NoOpDeletor(LLCore::HttpHandler *) + { + + } +} void LLAppCoreHttp::requestStop() { llassert_always(mRequest); - mStopHandle = mRequest->requestStopThread(this); + mStopHandle = mRequest->requestStopThread(LLCore::HttpHandler::ptr_t(this, NoOpDeletor)); if (LLCORE_HTTP_HANDLE_INVALID != mStopHandle) { mStopRequested = LLTimer::getTotalSeconds(); @@ -486,7 +493,7 @@ void LLAppCoreHttp::refreshSettings(bool initial) } LLCore::HttpStatus LLAppCoreHttp::sslVerify(const std::string &url, - LLCore::HttpHandler const * const handler, void *appdata) + const LLCore::HttpHandler::ptr_t &handler, void *appdata) { X509_STORE_CTX *ctx = static_cast(appdata); LLCore::HttpStatus result; -- cgit v1.2.3 From eca891e2618581e90c79f0c141b1c920f2577efe Mon Sep 17 00:00:00 2001 From: rider Date: Thu, 15 Oct 2015 09:32:19 -0700 Subject: MAINT-5732: Fixes for Mac build --- indra/newview/llappcorehttp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llappcorehttp.cpp') diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index ee4b91f8f2..5662334555 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -403,7 +403,7 @@ void LLAppCoreHttp::refreshSettings(bool initial) handle = mRequest->setPolicyOption(LLCore::HttpRequest::PO_PIPELINING_DEPTH, mHttpClasses[app_policy].mPolicy, new_depth, - NULL); + LLCore::HttpHandler::ptr_t()); if (LLCORE_HTTP_HANDLE_INVALID == handle) { status = mRequest->getStatus(); @@ -453,7 +453,7 @@ void LLAppCoreHttp::refreshSettings(bool initial) handle = mRequest->setPolicyOption(LLCore::HttpRequest::PO_CONNECTION_LIMIT, mHttpClasses[app_policy].mPolicy, (mHttpClasses[app_policy].mPipelined ? 2 * setting : setting), - NULL); + LLCore::HttpHandler::ptr_t()); if (LLCORE_HTTP_HANDLE_INVALID == handle) { status = mRequest->getStatus(); @@ -466,7 +466,7 @@ void LLAppCoreHttp::refreshSettings(bool initial) handle = mRequest->setPolicyOption(LLCore::HttpRequest::PO_PER_HOST_CONNECTION_LIMIT, mHttpClasses[app_policy].mPolicy, setting, - NULL); + LLCore::HttpHandler::ptr_t()); if (LLCORE_HTTP_HANDLE_INVALID == handle) { status = mRequest->getStatus(); -- cgit v1.2.3 From 3fdd5abf96fc945bd28038cf9d5d2533c7c9564e Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 15 Oct 2015 10:12:58 -0700 Subject: MAINT-5732: Issue in texture_load example and some comments regarding NoOpDeletor --- indra/newview/llappcorehttp.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'indra/newview/llappcorehttp.cpp') diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index 5662334555..8c276c0fe9 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -280,10 +280,16 @@ void setting_changed() namespace { + // The NoOpDeletor is used when wrapping LLAppCoreHttp in a smart pointer below for + // passage into the LLCore::Http libararies. When the smart pointer is destroyed, + // no action will be taken since we do not in this case want the entire LLAppCoreHttp object + // to be destroyed at the end of the call. + // + // *NOTE$: Yes! It is "Deletor" + // http://english.stackexchange.com/questions/4733/what-s-the-rule-for-adding-er-vs-or-when-nouning-a-verb + // "delete" derives from Latin "deletus" void NoOpDeletor(LLCore::HttpHandler *) - { - - } + { /*NoOp*/ } } void LLAppCoreHttp::requestStop() -- cgit v1.2.3 From 6ff0bff8f0f65a77e66c86077d8d2d6a9f8930c7 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 15 Oct 2015 11:42:43 -0700 Subject: Another fix for unit tests. Missed on Windows. --- indra/newview/llappcorehttp.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'indra/newview/llappcorehttp.cpp') diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index 8c276c0fe9..5aed9ff25f 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -278,25 +278,11 @@ void setting_changed() LLAppViewer::instance()->getAppCoreHttp().refreshSettings(false); } -namespace -{ - // The NoOpDeletor is used when wrapping LLAppCoreHttp in a smart pointer below for - // passage into the LLCore::Http libararies. When the smart pointer is destroyed, - // no action will be taken since we do not in this case want the entire LLAppCoreHttp object - // to be destroyed at the end of the call. - // - // *NOTE$: Yes! It is "Deletor" - // http://english.stackexchange.com/questions/4733/what-s-the-rule-for-adding-er-vs-or-when-nouning-a-verb - // "delete" derives from Latin "deletus" - void NoOpDeletor(LLCore::HttpHandler *) - { /*NoOp*/ } -} - void LLAppCoreHttp::requestStop() { llassert_always(mRequest); - mStopHandle = mRequest->requestStopThread(LLCore::HttpHandler::ptr_t(this, NoOpDeletor)); + mStopHandle = mRequest->requestStopThread(*this); if (LLCORE_HTTP_HANDLE_INVALID != mStopHandle) { mStopRequested = LLTimer::getTotalSeconds(); -- cgit v1.2.3 From 302e5780694a6f271807d0804db0c6fc6923026f Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 15 Oct 2015 11:50:30 -0700 Subject: This file change should not have been checked in. --- indra/newview/llappcorehttp.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'indra/newview/llappcorehttp.cpp') diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index 5aed9ff25f..8c276c0fe9 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -278,11 +278,25 @@ void setting_changed() LLAppViewer::instance()->getAppCoreHttp().refreshSettings(false); } +namespace +{ + // The NoOpDeletor is used when wrapping LLAppCoreHttp in a smart pointer below for + // passage into the LLCore::Http libararies. When the smart pointer is destroyed, + // no action will be taken since we do not in this case want the entire LLAppCoreHttp object + // to be destroyed at the end of the call. + // + // *NOTE$: Yes! It is "Deletor" + // http://english.stackexchange.com/questions/4733/what-s-the-rule-for-adding-er-vs-or-when-nouning-a-verb + // "delete" derives from Latin "deletus" + void NoOpDeletor(LLCore::HttpHandler *) + { /*NoOp*/ } +} + void LLAppCoreHttp::requestStop() { llassert_always(mRequest); - mStopHandle = mRequest->requestStopThread(*this); + mStopHandle = mRequest->requestStopThread(LLCore::HttpHandler::ptr_t(this, NoOpDeletor)); if (LLCORE_HTTP_HANDLE_INVALID != mStopHandle) { mStopRequested = LLTimer::getTotalSeconds(); -- cgit v1.2.3 From 70d4c0ad7da483df2b5e621dd20467b4fd67ab51 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 2 Feb 2016 12:11:08 -0800 Subject: MAINT-6067: There appears to be an issue with HTTP pipelining and timeouts in CURL that has never been resolved (see https://github.com/bagder/curl/issues/627). Until resolved disable pipelining for meshes and textures. --- indra/newview/llappcorehttp.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llappcorehttp.cpp') diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index 8c276c0fe9..c13c4f982a 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -104,7 +104,7 @@ static const struct "material manager requests" }, { // AP_AGENT - 2, 1, 32, 0, true, + 2, 1, 32, 0, false, "Agent", "Agent requests" } @@ -125,7 +125,7 @@ LLAppCoreHttp::LLAppCoreHttp() mStopHandle(LLCORE_HTTP_HANDLE_INVALID), mStopRequested(0.0), mStopped(false), - mPipelined(true) + mPipelined(false) {} @@ -359,13 +359,14 @@ void LLAppCoreHttp::refreshSettings(bool initial) static const std::string http_pipelining("HttpPipelining"); if (gSavedSettings.controlExists(http_pipelining)) { - // Default to true (in ctor) if absent. + // Default to false (in ctor) if absent. bool pipelined(gSavedSettings.getBOOL(http_pipelining)); if (pipelined != mPipelined) { mPipelined = pipelined; pipeline_changed = true; } + LL_INFOS("Init") << "HTTP Pipelining " << (mPipelined ? "enabled" : "disabled") << "!" << LL_ENDL; } for (int i(0); i < LL_ARRAY_SIZE(init_data); ++i) -- cgit v1.2.3 From bfabb7bd2b02654e00f5b8d12541e9bec9cbbad7 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 19 Feb 2016 11:19:50 -0800 Subject: MAINT-6137: Re enable pipelining by default, use new version of CURL (7.47) with corrections for timed out connections in pipelining. Minor fix for safer op retrieval. --- indra/newview/llappcorehttp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llappcorehttp.cpp') diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index c13c4f982a..7dee309a62 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -125,7 +125,7 @@ LLAppCoreHttp::LLAppCoreHttp() mStopHandle(LLCORE_HTTP_HANDLE_INVALID), mStopRequested(0.0), mStopped(false), - mPipelined(false) + mPipelined(true) {} @@ -359,7 +359,7 @@ void LLAppCoreHttp::refreshSettings(bool initial) static const std::string http_pipelining("HttpPipelining"); if (gSavedSettings.controlExists(http_pipelining)) { - // Default to false (in ctor) if absent. + // Default to true (in ctor) if absent. bool pipelined(gSavedSettings.getBOOL(http_pipelining)); if (pipelined != mPipelined) { -- cgit v1.2.3