diff options
author | Monty Brandenberg <monty@lindenlab.com> | 2012-06-19 17:12:20 -0400 |
---|---|---|
committer | Monty Brandenberg <monty@lindenlab.com> | 2012-06-19 17:12:20 -0400 |
commit | 6b4fe9fadc2301eb13a2854457b67fbebe045b08 (patch) | |
tree | 81b2b25ae98d1d0d0df14ae3f1ba86ec9cfdc8bb | |
parent | a50944e078b98435685f04eda0ba93e95d4c61f2 (diff) |
When a Content-Range header is received, make available the full triplet of <offset, length, fulllength>.
-rw-r--r-- | indra/llcorehttp/_httpoprequest.cpp | 7 | ||||
-rw-r--r-- | indra/llcorehttp/_httpoprequest.h | 1 | ||||
-rw-r--r-- | indra/llcorehttp/httpresponse.cpp | 1 | ||||
-rw-r--r-- | indra/llcorehttp/httpresponse.h | 7 | ||||
-rw-r--r-- | indra/newview/lltexturefetch.cpp | 4 |
5 files changed, 15 insertions, 5 deletions
diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp index 04a8e0baff..516daadf9b 100644 --- a/indra/llcorehttp/_httpoprequest.cpp +++ b/indra/llcorehttp/_httpoprequest.cpp @@ -107,6 +107,7 @@ HttpOpRequest::HttpOpRequest() mReplyBody(NULL), mReplyOffset(0), mReplyLength(0), + mReplyFullLength(0), mReplyHeaders(NULL), mPolicyRetries(0), mPolicyRetryAt(HttpTime(0)), @@ -154,6 +155,7 @@ HttpOpRequest::~HttpOpRequest() mReplyOffset = 0; mReplyLength = 0; + mReplyFullLength = 0; if (mReplyBody) { mReplyBody->release(); @@ -224,7 +226,7 @@ void HttpOpRequest::visitNotifier(HttpRequest * request) if (mReplyOffset || mReplyLength) { // Got an explicit offset/length in response - response->setRange(mReplyOffset, mReplyLength); + response->setRange(mReplyOffset, mReplyLength, mReplyFullLength); } mUserHandler->onCompleted(static_cast<HttpHandle>(this), response); @@ -362,6 +364,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service) } mReplyOffset = 0; mReplyLength = 0; + mReplyFullLength = 0; if (mReplyHeaders) { mReplyHeaders->release(); @@ -590,6 +593,7 @@ size_t HttpOpRequest::headerCallback(void * data, size_t size, size_t nmemb, voi // taking results from the last header stanza we receive. op->mReplyOffset = 0; op->mReplyLength = 0; + op->mReplyFullLength = 0; op->mStatus = HttpStatus(); } else if (op->mProcFlags & PF_SCAN_RANGE_HEADER) @@ -613,6 +617,7 @@ size_t HttpOpRequest::headerCallback(void * data, size_t size, size_t nmemb, voi // Success, record the fragment position op->mReplyOffset = first; op->mReplyLength = last - first + 1; + op->mReplyFullLength = length; } else if (-1 == status) { diff --git a/indra/llcorehttp/_httpoprequest.h b/indra/llcorehttp/_httpoprequest.h index f2b709a3a2..5d2417466c 100644 --- a/indra/llcorehttp/_httpoprequest.h +++ b/indra/llcorehttp/_httpoprequest.h @@ -150,6 +150,7 @@ public: BufferArray * mReplyBody; off_t mReplyOffset; size_t mReplyLength; + size_t mReplyFullLength; HttpHeaders * mReplyHeaders; // Policy data diff --git a/indra/llcorehttp/httpresponse.cpp b/indra/llcorehttp/httpresponse.cpp index 3dcdadb337..a552e48a1b 100644 --- a/indra/llcorehttp/httpresponse.cpp +++ b/indra/llcorehttp/httpresponse.cpp @@ -37,6 +37,7 @@ HttpResponse::HttpResponse() : LLCoreInt::RefCounted(true), mReplyOffset(0U), mReplyLength(0U), + mReplyFullLength(0U), mBufferArray(NULL), mHeaders(NULL) {} diff --git a/indra/llcorehttp/httpresponse.h b/indra/llcorehttp/httpresponse.h index 5bcd7c4eb8..925cf81586 100644 --- a/indra/llcorehttp/httpresponse.h +++ b/indra/llcorehttp/httpresponse.h @@ -111,16 +111,18 @@ public: /// If a 'Range:' header was used, these methods are involved /// in setting and returning data about the actual response. - void getRange(unsigned int * offset, unsigned int * length) const + void getRange(unsigned int * offset, unsigned int * length, unsigned int * full) const { *offset = mReplyOffset; *length = mReplyLength; + *full = mReplyFullLength; } - void setRange(unsigned int offset, unsigned int length) + void setRange(unsigned int offset, unsigned int length, unsigned int full_length) { mReplyOffset = offset; mReplyLength = length; + mReplyFullLength = full_length; } protected: @@ -128,6 +130,7 @@ protected: HttpStatus mStatus; unsigned int mReplyOffset; unsigned int mReplyLength; + unsigned int mReplyFullLength; BufferArray * mBufferArray; HttpHeaders * mHeaders; }; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 6e14c5fc63..2eda6a9b80 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1735,8 +1735,8 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe << " status: " << status.toHex() << " '" << status.toString() << "'" << llendl; -// unsigned int offset(0), length(0); -// response->getRange(&offset, &length); +// unsigned int offset(0), length(0), full_length(0); +// response->getRange(&offset, &length, &full_length); // llwarns << "HTTP COMPLETE: " << mID << " handle: " << handle // << " status: " << status.toULong() << " '" << status.toString() << "'" // << " req offset: " << mRequestedOffset << " req length: " << mRequestedSize |