From 6b8c814df3141fa705b9921ba0a73aeaa3fe63b6 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 19 Mar 2015 17:01:21 -0700 Subject: Adding new HTTP handling for material manager. --- indra/llcorehttp/bufferarray.h | 1 + indra/llcorehttp/httpheaders.cpp | 2 +- indra/llcorehttp/httpheaders.h | 8 ++++++-- indra/llcorehttp/httpresponse.cpp | 4 ++++ indra/llcorehttp/httpresponse.h | 4 ++++ 5 files changed, 16 insertions(+), 3 deletions(-) (limited to 'indra/llcorehttp') diff --git a/indra/llcorehttp/bufferarray.h b/indra/llcorehttp/bufferarray.h index 9c2b991de6..1da807b0a6 100755 --- a/indra/llcorehttp/bufferarray.h +++ b/indra/llcorehttp/bufferarray.h @@ -131,6 +131,7 @@ protected: container_t mBlocks; size_t mLen; + }; // end class BufferArray diff --git a/indra/llcorehttp/httpheaders.cpp b/indra/llcorehttp/httpheaders.cpp index 23ebea361c..73c92c8f10 100755 --- a/indra/llcorehttp/httpheaders.cpp +++ b/indra/llcorehttp/httpheaders.cpp @@ -105,7 +105,7 @@ void HttpHeaders::appendNormal(const char * header, size_t size) // Find from end to simulate a tradition of using single-valued // std::map for this in the past. -const std::string * HttpHeaders::find(const char * name) const +const std::string * HttpHeaders::find(const std::string &name) const { const_reverse_iterator iend(rend()); for (const_reverse_iterator iter(rbegin()); iend != iter; ++iter) diff --git a/indra/llcorehttp/httpheaders.h b/indra/llcorehttp/httpheaders.h index c89d6af222..41832c4931 100755 --- a/indra/llcorehttp/httpheaders.h +++ b/indra/llcorehttp/httpheaders.h @@ -146,8 +146,12 @@ public: // a pointer to a std::string in the container. // Pointer is valid only for the lifetime of // the container or until container is modifed. - // - const std::string * find(const char * name) const; + + const std::string * find(const std::string &name) const; + const std::string * find(const char * name) const + { + return find(std::string(name)); + } // Count of headers currently in the list. size_type size() const diff --git a/indra/llcorehttp/httpresponse.cpp b/indra/llcorehttp/httpresponse.cpp index c974395b0a..87e3426415 100755 --- a/indra/llcorehttp/httpresponse.cpp +++ b/indra/llcorehttp/httpresponse.cpp @@ -89,5 +89,9 @@ void HttpResponse::setHeaders(HttpHeaders * headers) mHeaders = headers; } +size_t HttpResponse::getBodySize() const +{ + return (mBufferArray) ? mBufferArray->size() : 0; +} } // end namespace LLCore diff --git a/indra/llcorehttp/httpresponse.h b/indra/llcorehttp/httpresponse.h index 01e9dd2bc6..c6b470ee3f 100755 --- a/indra/llcorehttp/httpresponse.h +++ b/indra/llcorehttp/httpresponse.h @@ -104,6 +104,10 @@ public: return mBufferArray; } + /// Safely get the size of the body buffer. If the body buffer is missing + /// return 0 as the size. + size_t getBodySize() const; + /// Set the response data in the instance. Will drop the reference /// count to any existing data and increment the count of that passed /// in. It is legal to set the data to NULL. -- cgit v1.2.3