From ab91525e7af4f44c96ef1f944699eb47d5898ef9 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Sun, 11 Nov 2012 17:36:43 +0100 Subject: [PATCH] Add missing needHeaders The AIBufferedCurlEasyRequestEvents are not triggered unless the derived class return true for needsHeaders(). That means, every class that implements received_HTTP_header(), received_header() or completed_headers(), or implement the virtual function completedHeaders(), or use the protected member mReceivedHeaders directly. This commits adds missing needsHeaders() for LLAvatarNameCache (thanks Siana) and XMLRPCResponder. The former now uses mReceivedHeaders directly instead of making a copy. --- indra/llmessage/llavatarnamecache.cpp | 9 ++------- indra/llmessage/llhttpclient.h | 2 ++ indra/newview/llxmlrpcresponder.h | 1 + 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index a3aaebb2a..ae04a8105 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -182,7 +182,7 @@ private: std::vector mAgentIDs; // Need the headers to look up Expires: and Retry-After: - AIHTTPReceivedHeaders mHeaders; + virtual bool needsHeaders(void) const { return true; } public: virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return avatarNameResponder_timeout; } @@ -190,16 +190,11 @@ public: LLAvatarNameResponder(const std::vector& agent_ids) : mAgentIDs(agent_ids) { } - - /*virtual*/ void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers) - { - mHeaders = headers; - } /*virtual*/ void result(const LLSD& content) { // Pull expiration out of headers if available - F64 expires = LLAvatarNameCache::nameExpirationFromHeaders(mHeaders); + F64 expires = LLAvatarNameCache::nameExpirationFromHeaders(mReceivedHeaders); F64 now = LLFrameTimer::getTotalSeconds(); LLSD agents = content["agents"]; diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h index 862d161ce..fa37e8b62 100644 --- a/indra/llmessage/llhttpclient.h +++ b/indra/llmessage/llhttpclient.h @@ -133,6 +133,7 @@ public: protected: // AIBufferedCurlEasyRequestEvents + // These three events are only actually called for classes that implement a needsHeaders() that returns true. // Called when the "HTTP/1.x " header is received. /*virtual*/ void received_HTTP_header(void) @@ -167,6 +168,7 @@ public: protected: // Derived classes can override this to get the HTML headers that were received, when the message is completed. + // Only actually called for classes that implement a needsHeaders() that returns true. virtual void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers) { // The default does nothing. diff --git a/indra/newview/llxmlrpcresponder.h b/indra/newview/llxmlrpcresponder.h index e42066f1c..df01692ae 100644 --- a/indra/newview/llxmlrpcresponder.h +++ b/indra/newview/llxmlrpcresponder.h @@ -105,6 +105,7 @@ public: XMLRPC_REQUEST response(void) const { return mResponse; } LLXMLRPCValue responseValue(void) const; + /*virtual*/ bool needsHeaders(void) const { return true; } /*virtual*/ void received_HTTP_header(void) { mReceivedHTTPHeader = true; LLHTTPClient::ResponderBase::received_HTTP_header(); } /*virtual*/ void completed_headers(U32 status, std::string const& reason, AITransferInfo* info); /*virtual*/ void completedRaw(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer);