summaryrefslogtreecommitdiff
path: root/indra/newview/llhttpretrypolicy.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2013-04-15 18:58:58 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2013-04-15 18:58:58 -0400
commit8d3afb35d878e49a505fef26dbbe6ea347966146 (patch)
tree2300f449b9c10a5f6c8a4103a7bb6bb9a06e9e6a /indra/newview/llhttpretrypolicy.cpp
parent039fa244d6e3d5c6014de6a55d86675dd073309c (diff)
parent8868964b549822f260694c2bf26b903dbce8ed0a (diff)
SH-4061 - integrated LLHttpRetryPolicy with new corehttp header parsing
Diffstat (limited to 'indra/newview/llhttpretrypolicy.cpp')
-rwxr-xr-xindra/newview/llhttpretrypolicy.cpp20
1 files changed, 4 insertions, 16 deletions
diff --git a/indra/newview/llhttpretrypolicy.cpp b/indra/newview/llhttpretrypolicy.cpp
index 82f6eab00e..10b923be5a 100755
--- a/indra/newview/llhttpretrypolicy.cpp
+++ b/indra/newview/llhttpretrypolicy.cpp
@@ -47,24 +47,13 @@ bool LLAdaptiveRetryPolicy::getRetryAfter(const LLSD& headers, F32& retry_header
bool LLAdaptiveRetryPolicy::getRetryAfter(const LLCore::HttpHeaders *headers, F32& retry_header_time)
{
- // Look for matching header. Hopefully it's correct enough to let
- // us extract the field we are looking for. Does not purport to be
- // in any way a viable general HTTP header parser.
if (headers)
{
- for (std::vector<std::string>::const_iterator it = headers->mHeaders.begin();
- it != headers->mHeaders.end();
- ++it)
+ const std::string *retry_value = headers->find(HTTP_IN_HEADER_RETRY_AFTER.c_str());
+ if (retry_value &&
+ getSecondsUntilRetryAfter(*retry_value, retry_header_time))
{
- const std::string& str = *it;
- const std::string match = HTTP_IN_HEADER_RETRY_AFTER + ":";
- size_t pos = str.find(match);
- if ((pos != std::string::npos) &&
- (pos+match.length() <= str.length()))
- {
- retry_header_time = strtod(str.substr(pos+match.length()).c_str(), NULL);
- return true;
- }
+ return true;
}
}
return false;
@@ -77,7 +66,6 @@ void LLAdaptiveRetryPolicy::onFailure(S32 status, const LLSD& headers)
onFailureCommon(status, has_retry_header_time, retry_header_time);
}
-// TODO: replace this parsing junk once CoreHttp has its own header parsing capabilities.
void LLAdaptiveRetryPolicy::onFailure(const LLCore::HttpResponse *response)
{
F32 retry_header_time;