ResponderAdapter stuff
Renamed AICurlInterface::Responder to AICurlInterface::ResponderBase, but without the virtual 'event' methods. Derived from that: Responder and ReponderWithCompleted, where the first defines result = 0, ErrorWithContent and error, and the latter completedRaw and completed. Added HttpClient::IgnoreBody, derived from Responder and implementing 'result' doing nothing; HttpClient::Ignore is now derived from IgnoreBody and defines the still pure virtual getHTTPTimeoutPolicy. Added ResponderBase::decode_body, which is now the sole place where the code makes the decision wether some response data might be LLSD or not based on the http status result. Before it just tried to decode everything as LLSD, which seems a bit nonsense. ResponderWithCompleted::completed no longer does anything, since classes derived from ResponderWithCompleted are expected to override it, or never call it by overriding completedRaw. Entry point is now ResponderBase::finished = 0, instead of completedRaw, where ResponderWithCompleted implements finished by called completedRaw, but Responder doesn't: that directly calls result/errorWithContent/error. Or, for the hack ResponderAdapter, the entry points are pubResult/pubErrorWithContent. Those are now the ONLY public methods, so more confusion. mFinished is now set in all cases. As a result of all that, it is no longer possible to accidently pass a responder to ResponderAdapter that would break because it expects completed() and completedRaw() to be called. Added LLBufferArray::writeChannelTo. Fixed bug for BlockingResponder::body (returned reference to temporary). LLSDMessage::ResponderAdapter now allows a "timeoutpolicy" name to be passed (not doing so results in the default timings), so that the timeout policy of the used responder is retained. Fixed llfasttimerview.cpp to test LLSDSerialize::fromXML() to return a positive value instead of non-zero, because it may return -1 when the parsing fails (three places). Removed LLHTTPClient::Responder as base class from LLFloaterRegionDebugConsole completely: it isn't a responder! Several other responder classes were simplified a bit in order to compile again with the above changes.
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "stdtypes.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
class AIHTTPTimeoutPolicyBase;
|
||||
|
||||
@@ -52,6 +53,8 @@ class AIHTTPTimeoutPolicy {
|
||||
char const* const mName; // The name of this policy, for debugging purposes.
|
||||
AIHTTPTimeoutPolicyBase* const mBase; // Policy this policy was based on.
|
||||
static AIHTTPTimeoutPolicyBase sDebugSettingsCurlTimeout; // CurlTimeout* debug settings.
|
||||
typedef std::map<std::string, AIHTTPTimeoutPolicy*> namemap_t; // Type of sNameMap.
|
||||
static namemap_t sNameMap; // Map of name of timeout policies (as returned by name()) to AIHTTPTimeoutPolicy* (this).
|
||||
|
||||
private:
|
||||
U16 mDNSLookupGrace; // Extra connect timeout the first time we connect to a host (this is to allow for DNS lookups).
|
||||
@@ -97,6 +100,7 @@ class AIHTTPTimeoutPolicy {
|
||||
U16 getCurlTransaction(void) const { return mMaximumCurlTransaction; }
|
||||
U16 getTotalDelay(void) const { return mMaximumTotalDelay; }
|
||||
static AIHTTPTimeoutPolicy const& getDebugSettingsCurlTimeout(void);
|
||||
static AIHTTPTimeoutPolicy const* getTimeoutPolicyByName(std::string const& name);
|
||||
|
||||
// Called once at start up of viewer to set a different default timeout policy than HTTPTimeoutPolicy_default.
|
||||
static void setDefaultCurlTimeout(AIHTTPTimeoutPolicy const& defaultCurlTimeout);
|
||||
|
||||
Reference in New Issue
Block a user