summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2015-09-15 17:01:26 -0700
committerRider Linden <rider@lindenlab.com>2015-09-15 17:01:26 -0700
commit907efc9cc9bcf4a935ed0e1bd17b19da2bb99dce (patch)
tree8453041f5ba3e07fbe0e7d2a632ee1fbf08698e7 /indra/newview
parent5f7985f6a79a21256162785cd9f0b97baac0504a (diff)
MAINT-5507: Remove llcurl, move constant values and untilities to llcorehttp lib
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llaisapi.h1
-rwxr-xr-xindra/newview/llappcorehttp.cpp3
-rwxr-xr-xindra/newview/llappviewer.cpp13
-rwxr-xr-xindra/newview/llfloaterabout.cpp1
-rwxr-xr-xindra/newview/llhttpretrypolicy.cpp47
-rwxr-xr-xindra/newview/llhttpretrypolicy.h2
-rwxr-xr-xindra/newview/llinventorymodel.h1
-rwxr-xr-xindra/newview/llmediadataclient.cpp10
-rwxr-xr-xindra/newview/llmeshrepository.cpp1
-rwxr-xr-xindra/newview/llpanellogin.cpp1
-rwxr-xr-xindra/newview/lltexturefetch.h1
-rwxr-xr-xindra/newview/llxmlrpctransaction.cpp2
-rwxr-xr-xindra/newview/pipeline.cpp1
-rwxr-xr-xindra/newview/tests/llhttpretrypolicy_test.cpp6
14 files changed, 60 insertions, 30 deletions
diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h
index 48c081991a..e97059014b 100755
--- a/indra/newview/llaisapi.h
+++ b/indra/newview/llaisapi.h
@@ -31,7 +31,6 @@
#include <map>
#include <set>
#include <string>
-#include "llcurl.h"
#include "llhttpretrypolicy.h"
#include "llviewerinventory.h"
#include "llcorehttputil.h"
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)
{
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 45e21d9129..ba76341b69 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -58,7 +58,6 @@
#include "llviewerjoystick.h"
#include "llallocator.h"
#include "llares.h"
-#include "llcurl.h"
#include "llcalc.h"
#include "llconversationlog.h"
#include "lldxhardware.h"
@@ -828,12 +827,7 @@ bool LLAppViewer::init()
// before consumers (LLTextureFetch).
mAppCoreHttp.init();
- // *NOTE:Mani - LLCurl::initClass is not thread safe.
- // Called before threads are created.
- LLCurl::initClass(gSavedSettings.getF32("CurlRequestTimeOut"),
- gSavedSettings.getS32("CurlMaximumNumberOfHandles"),
- gSavedSettings.getBOOL("CurlUseMultipleThreads"));
- LL_INFOS("InitInfo") << "LLCurl initialized." << LL_ENDL ;
+ LL_INFOS("InitInfo") << "LLCore::Http initialized." << LL_ENDL ;
LLMachineID::init();
@@ -903,7 +897,7 @@ bool LLAppViewer::init()
// the libs involved in getting to a full login screen.
//
LL_INFOS("InitInfo") << "J2C Engine is: " << LLImageJ2C::getEngineInfo() << LL_ENDL;
- LL_INFOS("InitInfo") << "libcurl version is: " << LLCurl::getVersionString() << LL_ENDL;
+ LL_INFOS("InitInfo") << "libcurl version is: " << LLCore::LLHttp::getCURLVersion() << LL_ENDL;
/////////////////////////////////////////////////
// OS-specific login dialogs
@@ -1313,7 +1307,6 @@ bool LLAppViewer::mainLoop()
// Create IO Pump to use for HTTP Requests.
gServicePump = new LLPumpIO(gAPRPoolp);
- LLCurl::setCAFile(gDirUtilp->getCAFile());
// Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated.
@@ -3348,7 +3341,7 @@ LLSD LLAppViewer::getViewerInfo() const
#endif
info["OPENGL_VERSION"] = (const char*)(glGetString(GL_VERSION));
- info["LIBCURL_VERSION"] = LLCurl::getVersionString();
+ info["LIBCURL_VERSION"] = LLCore::LLHttp::getCURLVersion();
info["J2C_VERSION"] = LLImageJ2C::getEngineInfo();
bool want_fullname = true;
info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : LLSD();
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index 01c9416973..7bd01f6beb 100755
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -48,7 +48,6 @@
// Linden library includes
#include "llaudioengine.h"
#include "llbutton.h"
-#include "llcurl.h"
#include "llglheaders.h"
#include "llfloater.h"
#include "llfloaterreg.h"
diff --git a/indra/newview/llhttpretrypolicy.cpp b/indra/newview/llhttpretrypolicy.cpp
index e2e151eb63..6a2daeeb90 100755
--- a/indra/newview/llhttpretrypolicy.cpp
+++ b/indra/newview/llhttpretrypolicy.cpp
@@ -25,9 +25,23 @@
*/
#include "llviewerprecompiledheaders.h"
-
#include "llhttpretrypolicy.h"
+namespace
+{
+ // Moved from httpconstants.h... only used in this file.
+ bool isHttpServerErrorStatus(S32 status)
+ {
+ // Status 499 is sometimes used for re-interpreted status 2xx errors.
+ // Allow retry of these, since we don't have enough information in this
+ // context to know if this will always fail.
+ if (HTTP_INTERNAL_ERROR == status) return true;
+
+ // Check for status 5xx.
+ return((500 <= status) && (status < 600));
+ }
+}
+
LLAdaptiveRetryPolicy::LLAdaptiveRetryPolicy(F32 min_delay, F32 max_delay, F32 backoff_factor, U32 max_retries, bool retry_on_4xx):
mMinDelay(min_delay),
mMaxDelay(max_delay),
@@ -140,3 +154,34 @@ bool LLAdaptiveRetryPolicy::shouldRetry(F32& seconds_to_wait) const
seconds_to_wait = mShouldRetry ? (F32) mRetryTimer.getRemainingTimeF32() : F32_MAX;
return mShouldRetry;
}
+
+// Moved from httpconstants. Only used by this file.
+// Parses 'Retry-After' header contents and returns seconds until retry should occur.
+/*static*/
+bool LLAdaptiveRetryPolicy::getSecondsUntilRetryAfter(const std::string& retry_after, F32& seconds_to_wait)
+{
+ // *TODO: This needs testing! Not in use yet.
+ // Examples of Retry-After headers:
+ // Retry-After: Fri, 31 Dec 1999 23:59:59 GMT
+ // Retry-After: 120
+
+ // Check for number of seconds version, first:
+ char* end = 0;
+ // Parse as double
+ double seconds = std::strtod(retry_after.c_str(), &end);
+ if (end != 0 && *end == 0)
+ {
+ // Successful parse
+ seconds_to_wait = (F32)seconds;
+ return true;
+ }
+
+ // Parse rfc1123 date.
+ time_t date = curl_getdate(retry_after.c_str(), NULL);
+ if (-1 == date) return false;
+
+ seconds_to_wait = (F64)date - LLTimer::getTotalSeconds();
+
+ return true;
+}
+
diff --git a/indra/newview/llhttpretrypolicy.h b/indra/newview/llhttpretrypolicy.h
index c0cc263546..af07b4afec 100755
--- a/indra/newview/llhttpretrypolicy.h
+++ b/indra/newview/llhttpretrypolicy.h
@@ -76,6 +76,8 @@ public:
// virtual
bool shouldRetry(F32& seconds_to_wait) const;
+ static bool getSecondsUntilRetryAfter(const std::string& retry_after, F32& seconds_to_wait);
+
protected:
void init();
bool getRetryAfter(const LLSD& headers, F32& retry_header_time);
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index e8977bc7d7..a74e3b69f4 100755
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -35,7 +35,6 @@
#include "llassettype.h"
#include "llfoldertype.h"
#include "llframetimer.h"
-#include "llcurl.h"
#include "lluuid.h"
#include "llpermissionsflags.h"
#include "llviewerinventory.h"
diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp
index b8ff76aa6d..bfd0700a2f 100755
--- a/indra/newview/llmediadataclient.cpp
+++ b/indra/newview/llmediadataclient.cpp
@@ -631,14 +631,8 @@ void LLMediaDataClient::Handler::onFailure(LLCore::HttpResponse * response, LLCo
if (status == LLCore::HttpStatus(HTTP_SERVICE_UNAVAILABLE))
{
F32 retry_timeout;
-#if 0
- // *TODO: Honor server Retry-After header.
- if (!hasResponseHeader(HTTP_IN_HEADER_RETRY_AFTER)
- || !getSecondsUntilRetryAfter(getResponseHeader(HTTP_IN_HEADER_RETRY_AFTER), retry_timeout))
-#endif
- {
- retry_timeout = mRequest->getRetryTimerDelay();
- }
+
+ retry_timeout = mRequest->getRetryTimerDelay();
mRequest->incRetryCount();
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 5bd9df54e2..40de31b9af 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -36,7 +36,6 @@
#include "llappviewer.h"
#include "llbufferstream.h"
#include "llcallbacklist.h"
-#include "llcurl.h"
#include "lldatapacker.h"
#include "lldeadmantimer.h"
#include "llfloatermodelpreview.h"
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index f972b320c3..bd23478694 100755
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -40,7 +40,6 @@
#include "llcheckboxctrl.h"
#include "llcommandhandler.h" // for secondlife:///app/login/
#include "llcombobox.h"
-#include "llcurl.h"
#include "llviewercontrol.h"
#include "llfloaterpreference.h"
#include "llfocusmgr.h"
diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h
index e569175e8f..50233eee5e 100755
--- a/indra/newview/lltexturefetch.h
+++ b/indra/newview/lltexturefetch.h
@@ -37,7 +37,6 @@
#include "lltextureinfo.h"
#include "llapr.h"
#include "llimageworker.h"
-#include "llcurl.h"
#include "httprequest.h"
#include "httpoptions.h"
#include "httpheaders.h"
diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp
index 5828aee7fc..442ed73c2d 100755
--- a/indra/newview/llxmlrpctransaction.cpp
+++ b/indra/newview/llxmlrpctransaction.cpp
@@ -34,8 +34,8 @@
#include "llxmlrpctransaction.h"
#include "llxmlrpclistener.h"
-#include "llcurl.h"
#include "httpcommon.h"
+#include "llhttpconstants.h"
#include "httprequest.h"
#include "httpoptions.h"
#include "httpheaders.h"
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 03712c1065..57e2faca5b 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -105,7 +105,6 @@
#include "llspatialpartition.h"
#include "llmutelist.h"
#include "lltoolpie.h"
-#include "llcurl.h"
#include "llnotifications.h"
#include "llpathinglib.h"
#include "llfloaterpathfindingconsole.h"
diff --git a/indra/newview/tests/llhttpretrypolicy_test.cpp b/indra/newview/tests/llhttpretrypolicy_test.cpp
index 8bd6cc2690..21c83184dc 100755
--- a/indra/newview/tests/llhttpretrypolicy_test.cpp
+++ b/indra/newview/tests/llhttpretrypolicy_test.cpp
@@ -234,13 +234,13 @@ void RetryPolicyTestObject::test<6>()
std::string str1("0");
seconds_to_wait = F32_MAX;
- success = getSecondsUntilRetryAfter(str1, seconds_to_wait);
+ success = LLAdaptiveRetryPolicy::getSecondsUntilRetryAfter(str1, seconds_to_wait);
ensure("parse 1", success);
ensure_equals("parse 1", seconds_to_wait, 0.0);
std::string str2("999.9");
seconds_to_wait = F32_MAX;
- success = getSecondsUntilRetryAfter(str2, seconds_to_wait);
+ success = LLAdaptiveRetryPolicy::getSecondsUntilRetryAfter(str2, seconds_to_wait);
ensure("parse 2", success);
ensure_approximately_equals("parse 2", seconds_to_wait, 999.9F, 8);
@@ -248,7 +248,7 @@ void RetryPolicyTestObject::test<6>()
time(&nowseconds);
std::string str3 = LLDate((F64)(nowseconds+44)).asRFC1123();
seconds_to_wait = F32_MAX;
- success = getSecondsUntilRetryAfter(str3, seconds_to_wait);
+ success = LLAdaptiveRetryPolicy::getSecondsUntilRetryAfter(str3, seconds_to_wait);
std::cerr << " str3 [" << str3 << "]" << std::endl;
ensure("parse 3", success);
ensure_approximately_equals_range("parse 3", seconds_to_wait, 44.0F, 2.0F);