Code cleanup
* Moved Responder stuff to LLHTTPClient. * Renamed LLHTTPClient::Responder to LLHTTPClient::ResponderWithResult. * Deleted LLHTTPClientAdapter and LLHTTPClientInterface. * Renamed AICurlInterface::TransferInfo to AITransferInfo and moved it to llhttpclient.h * Removed 'CURLcode code' argument from completed_headers.
This commit is contained in:
@@ -113,9 +113,9 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap
|
||||
|
||||
// Only now print this info [doing that before setting mStatus
|
||||
// to STOPPED makes it much more likely that another thread runs
|
||||
// after the LLCurl::Multi::run() function exits and we actually
|
||||
// change this variable (which really SHOULD have been inside
|
||||
// the critical area of the mSignal lock)].
|
||||
// after the AICurlPrivate::curlthread::AICurlThread::run() function
|
||||
// exits and we actually change this variable (which really SHOULD
|
||||
// have been inside the critical area of the mSignal lock)].
|
||||
lldebugs << "LLThread::staticRun() Exiting: " << name << llendl;
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "llpumpio.h"
|
||||
#include "llhttpclient.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llcurl.h"
|
||||
|
||||
LLPumpIO* gServicePump;
|
||||
BOOL gBreak = false;
|
||||
@@ -56,7 +57,7 @@ BOOL gSent = false;
|
||||
class AIHTTPTimeoutPolicy;
|
||||
extern AIHTTPTimeoutPolicy crashLoggerResponder_timeout;
|
||||
|
||||
class LLCrashLoggerResponder : public LLHTTPClient::Responder
|
||||
class LLCrashLoggerResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return crashLoggerResponder_timeout; }
|
||||
|
||||
@@ -44,7 +44,6 @@ set(llmessage_SOURCE_FILES
|
||||
lldispatcher.cpp
|
||||
llfiltersd2xmlrpc.cpp
|
||||
llhost.cpp
|
||||
llhttpclientadapter.cpp
|
||||
llhttpnode.cpp
|
||||
llhttpsender.cpp
|
||||
llinstantmessage.cpp
|
||||
@@ -139,8 +138,6 @@ set(llmessage_HEADER_FILES
|
||||
llfollowcamparams.h
|
||||
llhost.h
|
||||
llhttpclient.h
|
||||
llhttpclientinterface.h
|
||||
llhttpclientadapter.h
|
||||
llhttpnode.h
|
||||
llhttpnodeadapter.h
|
||||
llhttpsender.h
|
||||
@@ -237,7 +234,6 @@ if (LL_TESTS)
|
||||
include(Tut)
|
||||
|
||||
SET(llmessage_TEST_SOURCE_FILES
|
||||
# llhttpclientadapter.cpp
|
||||
llmime.cpp
|
||||
llnamevalue.cpp
|
||||
lltrustedmessageservice.cpp
|
||||
|
||||
@@ -429,151 +429,6 @@ std::string strerror(CURLcode errorcode)
|
||||
return curl_easy_strerror(errorcode);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class ResponderBase
|
||||
//
|
||||
|
||||
ResponderBase::ResponderBase(void) : mReferenceCount(0), mCode(CURLE_FAILED_INIT), mFinished(false)
|
||||
{
|
||||
DoutEntering(dc::curl, "AICurlInterface::Responder() with this = " << (void*)this);
|
||||
}
|
||||
|
||||
ResponderBase::~ResponderBase()
|
||||
{
|
||||
DoutEntering(dc::curl, "AICurlInterface::ResponderBase::~ResponderBase() with this = " << (void*)this << "; mReferenceCount = " << mReferenceCount);
|
||||
llassert(mReferenceCount == 0);
|
||||
}
|
||||
|
||||
void ResponderBase::setURL(std::string const& url)
|
||||
{
|
||||
// setURL is called from llhttpclient.cpp (request()), before calling any of the below (of course).
|
||||
// We don't need locking here therefore; it's a case of initializing before use.
|
||||
mURL = url;
|
||||
}
|
||||
|
||||
AIHTTPTimeoutPolicy const& ResponderBase::getHTTPTimeoutPolicy(void) const
|
||||
{
|
||||
return AIHTTPTimeoutPolicy::getDebugSettingsCurlTimeout();
|
||||
}
|
||||
|
||||
void ResponderBase::decode_llsd_body(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer, LLSD& content)
|
||||
{
|
||||
// If the status indicates success (and we get here) then we expect the body to be LLSD.
|
||||
bool const should_be_llsd = (200 <= status && status < 300);
|
||||
if (should_be_llsd)
|
||||
{
|
||||
LLBufferStream istr(channels, buffer.get());
|
||||
if (LLSDSerialize::fromXML(content, istr) == LLSDParser::PARSE_FAILURE)
|
||||
{
|
||||
// Unfortunately we can't show the body of the message... I think this is a pretty serious error
|
||||
// though, so if this ever happens it has to be investigated by making a copy of the buffer
|
||||
// before serializing it, as is done below.
|
||||
llwarns << "Failed to deserialize LLSD. " << mURL << " [" << status << "]: " << reason << llendl;
|
||||
}
|
||||
// LLSDSerialize::fromXML destructed buffer, we can't initialize content now.
|
||||
return;
|
||||
}
|
||||
// Put the body in content as-is.
|
||||
std::stringstream ss;
|
||||
buffer->writeChannelTo(ss, channels.in());
|
||||
content = ss.str();
|
||||
#ifdef SHOW_ASSERT
|
||||
if (!should_be_llsd)
|
||||
{
|
||||
// Make sure that the server indeed never returns LLSD as body when the http status is an error.
|
||||
LLSD dummy;
|
||||
bool server_sent_llsd_with_http_error = LLSDSerialize::fromXML(dummy, ss) > 0;
|
||||
if (server_sent_llsd_with_http_error)
|
||||
{
|
||||
llwarns << "The server sent us a response with http status " << status << " and LLSD(!) body: \"" << ss.str() << "\"!" << llendl;
|
||||
}
|
||||
llassert(!server_sent_llsd_with_http_error);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ResponderBase::decode_raw_body(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer, std::string& content)
|
||||
{
|
||||
LLMutexLock lock(buffer->getMutex());
|
||||
LLBufferArray::const_segment_iterator_t const end = buffer->endSegment();
|
||||
for (LLBufferArray::const_segment_iterator_t iter = buffer->beginSegment(); iter != end; ++iter)
|
||||
{
|
||||
if (iter->isOnChannel(channels.in()))
|
||||
{
|
||||
content.append((char*)iter->data(), iter->size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called with HTML body.
|
||||
// virtual
|
||||
void ResponderWithCompleted::completedRaw(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
|
||||
{
|
||||
LLSD content;
|
||||
decode_llsd_body(status, reason, channels, buffer, content);
|
||||
|
||||
// Allow derived class to override at this point.
|
||||
completed(status, reason, content);
|
||||
}
|
||||
|
||||
// virtual
|
||||
void ResponderWithCompleted::completed(U32 status, std::string const& reason, LLSD const& content)
|
||||
{
|
||||
// Either completedRaw() or this method must be overridden by the derived class. Hence, we should never get here.
|
||||
llassert_always(false);
|
||||
}
|
||||
|
||||
// virtual
|
||||
void Responder::finished(CURLcode code, U32 http_status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
|
||||
{
|
||||
mCode = code;
|
||||
|
||||
LLSD content;
|
||||
decode_llsd_body(http_status, reason, channels, buffer, content);
|
||||
|
||||
// HTTP status good?
|
||||
if (200 <= http_status && http_status < 300)
|
||||
{
|
||||
// Allow derived class to override at this point.
|
||||
result(content);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Allow derived class to override at this point.
|
||||
errorWithContent(http_status, reason, content);
|
||||
}
|
||||
|
||||
mFinished = true;
|
||||
}
|
||||
|
||||
// virtual
|
||||
void Responder::errorWithContent(U32 status, std::string const& reason, LLSD const&)
|
||||
{
|
||||
// Allow derived class to override at this point.
|
||||
error(status, reason);
|
||||
}
|
||||
|
||||
// virtual
|
||||
void Responder::error(U32 status, std::string const& reason)
|
||||
{
|
||||
llinfos << mURL << " [" << status << "]: " << reason << llendl;
|
||||
}
|
||||
|
||||
// Friend functions.
|
||||
|
||||
void intrusive_ptr_add_ref(ResponderBase* responder)
|
||||
{
|
||||
responder->mReferenceCount++;
|
||||
}
|
||||
|
||||
void intrusive_ptr_release(ResponderBase* responder)
|
||||
{
|
||||
if (--responder->mReferenceCount == 0)
|
||||
{
|
||||
delete responder;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace AICurlInterface
|
||||
//==================================================================================
|
||||
|
||||
@@ -1281,7 +1136,7 @@ void CurlEasyRequest::print_curl_timings(void) const
|
||||
DoutCurl("CURLINFO_STARTTRANSFER_TIME = " << t);
|
||||
}
|
||||
|
||||
void CurlEasyRequest::getTransferInfo(AICurlInterface::TransferInfo* info)
|
||||
void CurlEasyRequest::getTransferInfo(AITransferInfo* info)
|
||||
{
|
||||
// Curl explicitly demands a double for these info's.
|
||||
double size, total_time, speed;
|
||||
@@ -1294,7 +1149,7 @@ void CurlEasyRequest::getTransferInfo(AICurlInterface::TransferInfo* info)
|
||||
info->mSpeedDownload = speed;
|
||||
}
|
||||
|
||||
void CurlEasyRequest::getResult(CURLcode* result, AICurlInterface::TransferInfo* info)
|
||||
void CurlEasyRequest::getResult(CURLcode* result, AITransferInfo* info)
|
||||
{
|
||||
*result = mResult;
|
||||
if (info && mResult != CURLE_FAILED_INIT)
|
||||
@@ -1407,7 +1262,7 @@ ThreadSafeBufferedCurlEasyRequest const* CurlResponderBuffer::get_lockobj(void)
|
||||
return static_cast<ThreadSafeBufferedCurlEasyRequest const*>(AIThreadSafeSimple<CurlResponderBuffer>::wrapper_cast(this));
|
||||
}
|
||||
|
||||
void CurlResponderBuffer::prepRequest(AICurlEasyRequest_wat& curl_easy_request_w, AIHTTPHeaders const& headers, AICurlInterface::ResponderPtr responder)
|
||||
void CurlResponderBuffer::prepRequest(AICurlEasyRequest_wat& curl_easy_request_w, AIHTTPHeaders const& headers, LLHTTPClient::ResponderPtr responder)
|
||||
{
|
||||
mInput.reset(new LLBufferArray);
|
||||
mInput->setThreaded(true);
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
#include "llatomic.h" // LLAtomicU32
|
||||
#include "aithreadsafe.h"
|
||||
#include "llhttpstatuscodes.h"
|
||||
#include "aihttpheaders.h"
|
||||
#include "llhttpclient.h"
|
||||
|
||||
// Debug Settings.
|
||||
extern bool gNoVerifySSLCert;
|
||||
@@ -124,28 +124,9 @@ class AICurlNoBody : public AICurlError {
|
||||
// End Exceptions.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Forward declaration.
|
||||
namespace AICurlInterface { struct TransferInfo; }
|
||||
|
||||
// Events generated by AICurlPrivate::CurlResponderBuffer.
|
||||
struct AICurlResponderBufferEvents {
|
||||
virtual void received_HTTP_header(void) = 0; // For example "HTTP/1.0 200 OK", the first header of a reply.
|
||||
virtual void received_header(std::string const& key, std::string const& value) = 0; // Subsequent headers.
|
||||
virtual void completed_headers(U32 status, std::string const& reason, CURLcode code, AICurlInterface::TransferInfo* info) = 0; // Transaction completed.
|
||||
};
|
||||
|
||||
// Things defined in this namespace are called from elsewhere in the viewer code.
|
||||
namespace AICurlInterface {
|
||||
|
||||
// Output parameter of AICurlPrivate::CurlEasyRequest::getResult.
|
||||
// Used in XMLRPCResponder.
|
||||
struct TransferInfo {
|
||||
TransferInfo() : mSizeDownload(0.0), mTotalTime(0.0), mSpeedDownload(0.0) { }
|
||||
F64 mSizeDownload;
|
||||
F64 mTotalTime;
|
||||
F64 mSpeedDownload;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Global functions.
|
||||
|
||||
@@ -182,235 +163,6 @@ void setCAFile(std::string const& file);
|
||||
// Can be used to set the path to the Certificate Authority file.
|
||||
void setCAPath(std::string const& file);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Global classes.
|
||||
|
||||
// ResponderBase - base class for all Responders.
|
||||
//
|
||||
// The life cycle of classes derived from this class is as follows:
|
||||
// They are allocated with new on the line where get(), getByteRange() or post() is called,
|
||||
// and the pointer to the allocated object is then put in a reference counting ResponderPtr.
|
||||
// This ResponderPtr is passed to CurlResponderBuffer::prepRequest which stores it in its
|
||||
// member mResponder. Hence, the life time of a Responder is never longer than its
|
||||
// associated CurlResponderBuffer, however, if everything works correctly, then normally a
|
||||
// responder is deleted in CurlResponderBuffer::removed_from_multi_handle by setting
|
||||
// mReponder to NULL.
|
||||
//
|
||||
// Note that the lifetime of CurlResponderBuffer is (a bit) shorter than the associated
|
||||
// CurlEasyRequest (because of the order of base classes of ThreadSafeBufferedCurlEasyRequest)
|
||||
// and the callbacks, as set by prepRequest, only use those two.
|
||||
// A callback locks the CurlEasyRequest before actually making the callback, and the
|
||||
// destruction of CurlResponderBuffer also first locks the CurlEasyRequest, and then revokes
|
||||
// the callbacks. This assures that a Responder is never used when the objects it uses are
|
||||
// destructed. Also, if any of those are destructed then the Responder is automatically
|
||||
// destructed too.
|
||||
//
|
||||
class ResponderBase : public AICurlResponderBufferEvents {
|
||||
public:
|
||||
typedef boost::shared_ptr<LLBufferArray> buffer_ptr_t;
|
||||
|
||||
protected:
|
||||
ResponderBase(void);
|
||||
virtual ~ResponderBase();
|
||||
|
||||
// Read body from buffer and put it into content. If status indicates success, interpret it as LLSD, otherwise copy it as-is.
|
||||
void decode_llsd_body(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer, LLSD& content);
|
||||
|
||||
// Read body from buffer and put it into content. Always copy it as-is.
|
||||
void decode_raw_body(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer, std::string& content);
|
||||
|
||||
protected:
|
||||
// Associated URL, used for debug output.
|
||||
std::string mURL;
|
||||
|
||||
// Headers received from the server.
|
||||
AIHTTPReceivedHeaders mReceivedHeaders;
|
||||
|
||||
// The curl result code.
|
||||
CURLcode mCode;
|
||||
|
||||
// Set when the transaction finished (with or without errors).
|
||||
bool mFinished;
|
||||
|
||||
public:
|
||||
// Called to set the URL of the current request for this Responder,
|
||||
// used only when printing debug output regarding activity of the Responder.
|
||||
void setURL(std::string const& url);
|
||||
|
||||
// Accessors.
|
||||
std::string const& getURL(void) const { return mURL; }
|
||||
CURLcode result_code(void) const { return mCode; }
|
||||
|
||||
// Called by CurlResponderBuffer::timed_out or CurlResponderBuffer::processOutput.
|
||||
virtual void finished(CURLcode code, U32 http_status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer) = 0;
|
||||
|
||||
// Return true if the curl thread is done with this transaction.
|
||||
// If this returns true then it is guaranteed that none of the
|
||||
// virtual functions will be called anymore: the curl thread
|
||||
// will not access this object anymore.
|
||||
// Note that normally you don't need to call this function.
|
||||
bool is_finished(void) const { return mFinished; }
|
||||
|
||||
protected:
|
||||
// AICurlResponderBufferEvents
|
||||
|
||||
// Called when the "HTTP/1.x <status> <reason>" header is received.
|
||||
/*virtual*/ void received_HTTP_header(void)
|
||||
{
|
||||
// It's possible that this page was moved (302), so we already saw headers
|
||||
// from the 302 page and are starting over on the new page now.
|
||||
mReceivedHeaders.clear();
|
||||
}
|
||||
|
||||
// Called for all remaining headers.
|
||||
/*virtual*/ void received_header(std::string const& key, std::string const& value)
|
||||
{
|
||||
mReceivedHeaders.addHeader(key, value);
|
||||
}
|
||||
|
||||
// Called when the whole transaction is completed (also the body was received), but before the body is processed.
|
||||
/*virtual*/ void completed_headers(U32 status, std::string const& reason, CURLcode code, TransferInfo* info)
|
||||
{
|
||||
completedHeaders(status, reason, mReceivedHeaders);
|
||||
}
|
||||
|
||||
public:
|
||||
// Derived classes that implement completed_headers()/completedHeaders() should return true here.
|
||||
virtual bool needsHeaders(void) const { return false; }
|
||||
|
||||
// A derived class should return true if curl should follow redirections.
|
||||
// The default is not to follow redirections.
|
||||
virtual bool followRedir(void) { return false; }
|
||||
|
||||
// Timeout policy to use.
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const = 0;
|
||||
|
||||
protected:
|
||||
// Derived classes can override this to get the HTML headers that were received, when the message is completed.
|
||||
virtual void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers)
|
||||
{
|
||||
// The default does nothing.
|
||||
}
|
||||
|
||||
private:
|
||||
// Used by ResponderPtr. Object is deleted when reference count reaches zero.
|
||||
LLAtomicU32 mReferenceCount;
|
||||
|
||||
friend void intrusive_ptr_add_ref(ResponderBase* p); // Called by boost::intrusive_ptr when a new copy of a boost::intrusive_ptr<ResponderBase> is made.
|
||||
friend void intrusive_ptr_release(ResponderBase* p); // Called by boost::intrusive_ptr when a boost::intrusive_ptr<ResponderBase> is destroyed.
|
||||
// This function must delete the ResponderBase object when the reference count reaches zero.
|
||||
};
|
||||
|
||||
// ResponderWithCompleted - base class for Responders that implement completed, or completedRaw if the response is not LLSD.
|
||||
class ResponderWithCompleted : public ResponderBase {
|
||||
protected:
|
||||
// ResponderBase event
|
||||
|
||||
// The responder finished. Do not override this function in derived classes; override completedRaw instead.
|
||||
/*virtual*/ void finished(CURLcode code, U32 http_status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
|
||||
{
|
||||
mCode = code;
|
||||
// Allow classes derived from ResponderBase to override completedRaw
|
||||
// (if not they should override completed or be derived from Responder instead).
|
||||
completedRaw(http_status, reason, channels, buffer);
|
||||
mFinished = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
// Events generated by this class.
|
||||
|
||||
// Derived classes can override this to get the raw data of the body of the HTML message that was received.
|
||||
// The default is to interpret the content as LLSD and call completed().
|
||||
virtual void completedRaw(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer);
|
||||
|
||||
// ... or, derived classes can override this to get LLSD content when the message is completed.
|
||||
// The default aborts, as it should never be called (can't make it pure virtual though, so
|
||||
// classes that override completedRaw don't need to implement this function, too).
|
||||
virtual void completed(U32 status, std::string const& reason, LLSD const& content);
|
||||
|
||||
#ifdef SHOW_ASSERT
|
||||
// Responders derived from this class must override either completedRaw or completed.
|
||||
// They may not attempt to override any of the virual functions defined by ResponderBase.
|
||||
// Define those functions here with different parameters in order to cause a compile
|
||||
// warning when a class accidently tries to override them.
|
||||
enum YOU_ARE_DERIVING_FROM_THE_WRONG_CLASS { };
|
||||
virtual void result(YOU_ARE_DERIVING_FROM_THE_WRONG_CLASS) { }
|
||||
virtual void errorWithContent(YOU_ARE_DERIVING_FROM_THE_WRONG_CLASS) { }
|
||||
virtual void error(YOU_ARE_DERIVING_FROM_THE_WRONG_CLASS) { }
|
||||
#endif
|
||||
};
|
||||
|
||||
// Responder - base class for reponders that expect LLSD in the body of the reply.
|
||||
//
|
||||
// Classes derived from Responder must implement result, and either errorWithContent or error.
|
||||
class Responder : public ResponderBase {
|
||||
protected:
|
||||
// The responder finished. Do not override this function in derived classes; use ResponderWithCompleted instead.
|
||||
/*virtual*/ void finished(CURLcode code, U32 http_status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer);
|
||||
|
||||
protected:
|
||||
// Events generated by this class.
|
||||
|
||||
// Derived classes must override this to receive the content of a body upon success.
|
||||
virtual void result(LLSD const& content) = 0;
|
||||
|
||||
// Derived classes can override this to get informed when a bad HTML status code is received.
|
||||
// The default calls error().
|
||||
virtual void errorWithContent(U32 status, std::string const& reason, LLSD const& content);
|
||||
|
||||
// ... or, derived classes can override this to get informed when a bad HTML status code is received.
|
||||
// The default prints the error to llinfos.
|
||||
virtual void error(U32 status, std::string const& reason);
|
||||
|
||||
public:
|
||||
// Called from LLSDMessage::ResponderAdapter::listener.
|
||||
// LLSDMessage::ResponderAdapter is a hack, showing among others by fact that it needs these functions.
|
||||
|
||||
void pubErrorWithContent(CURLcode code, U32 status, std::string const& reason, LLSD const& content) { mCode = code; errorWithContent(status, reason, content); mFinished = true; }
|
||||
void pubResult(LLSD const& content) { mCode = CURLE_OK; result(content); mFinished = true; }
|
||||
|
||||
#ifdef SHOW_ASSERT
|
||||
// Responders derived from this class must override result, and either errorWithContent or error.
|
||||
// They may not attempt to override any of the virual functions defined by ResponderWithCompleted.
|
||||
// Define those functions here with different parameter in order to cause a compile
|
||||
// warning when a class accidently tries to override them.
|
||||
enum YOU_ARE_DERIVING_FROM_THE_WRONG_CLASS { };
|
||||
virtual void completedRaw(YOU_ARE_DERIVING_FROM_THE_WRONG_CLASS) { }
|
||||
virtual void completed(YOU_ARE_DERIVING_FROM_THE_WRONG_CLASS) { }
|
||||
#endif
|
||||
};
|
||||
|
||||
// A Responder is passed around as ResponderPtr, which causes it to automatically
|
||||
// destruct when there are no pointers left pointing to it.
|
||||
typedef boost::intrusive_ptr<ResponderBase> ResponderPtr;
|
||||
|
||||
// Same as above except that this class stores the result, allowing old polling
|
||||
// code to poll if the transaction finished by calling is_finished() (from the
|
||||
// main the thread) and then access the results-- as opposed to immediately
|
||||
// digesting the results when any of the virtual functions are called.
|
||||
class LegacyPolledResponder : public ResponderWithCompleted {
|
||||
protected:
|
||||
U32 mStatus;
|
||||
std::string mReason;
|
||||
|
||||
protected:
|
||||
// The responder finished. Do not override this function in derived classes.
|
||||
/*virtual*/ void finished(CURLcode code, U32 http_status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
|
||||
{
|
||||
mStatus = http_status;
|
||||
mReason = reason;
|
||||
// Call base class implementation.
|
||||
ResponderWithCompleted::finished(code, http_status, reason, channels, buffer);
|
||||
}
|
||||
|
||||
public:
|
||||
LegacyPolledResponder(void) : mStatus(HTTP_INTERNAL_ERROR) { }
|
||||
|
||||
// Accessors.
|
||||
U32 http_status(void) const { return mStatus; }
|
||||
std::string const& reason(void) const { return mReason; }
|
||||
};
|
||||
|
||||
} // namespace AICurlInterface
|
||||
|
||||
// Forward declaration (see aicurlprivate.h).
|
||||
|
||||
@@ -358,10 +358,10 @@ class CurlEasyRequest : public CurlEasyHandle {
|
||||
void print_diagnostics(AICurlEasyRequest_wat const& curlEasyRequest_w, CURLcode code);
|
||||
|
||||
// Called by MultiHandle::check_run_count() to fill info with the transfer info.
|
||||
void getTransferInfo(AICurlInterface::TransferInfo* info);
|
||||
void getTransferInfo(AITransferInfo* info);
|
||||
|
||||
// If result != CURLE_FAILED_INIT then also info was filled.
|
||||
void getResult(CURLcode* result, AICurlInterface::TransferInfo* info = NULL);
|
||||
void getResult(CURLcode* result, AITransferInfo* info = NULL);
|
||||
|
||||
// For debugging purposes.
|
||||
void print_curl_timings(void) const;
|
||||
@@ -424,7 +424,8 @@ class CurlEasyRequest : public CurlEasyHandle {
|
||||
|
||||
// Buffers used by the AICurlInterface::Request API.
|
||||
// Curl callbacks write into and read from these buffers.
|
||||
// The interface with the rest of the code is through AICurlInterface::Responder.
|
||||
// The interface with the rest of the code is through
|
||||
// AICurlInterface::ResponderBase and derived classes.
|
||||
//
|
||||
// The lifetime of a CurlResponderBuffer is slightly shorter than its
|
||||
// associated CurlEasyRequest; this class can only be created as base class
|
||||
@@ -439,10 +440,10 @@ class CurlEasyRequest : public CurlEasyHandle {
|
||||
// is deleted and the CurlResponderBuffer destructed.
|
||||
class CurlResponderBuffer : protected AICurlResponderBufferEvents, protected AICurlEasyHandleEvents {
|
||||
public:
|
||||
typedef AICurlInterface::Responder::buffer_ptr_t buffer_ptr_t;
|
||||
typedef boost::shared_ptr<LLBufferArray> buffer_ptr_t;
|
||||
|
||||
void resetState(AICurlEasyRequest_wat& curl_easy_request_w);
|
||||
void prepRequest(AICurlEasyRequest_wat& buffered_curl_easy_request_w, AIHTTPHeaders const& headers, AICurlInterface::ResponderPtr responder);
|
||||
void prepRequest(AICurlEasyRequest_wat& buffered_curl_easy_request_w, AIHTTPHeaders const& headers, LLHTTPClient::ResponderPtr responder);
|
||||
|
||||
buffer_ptr_t& getInput(void) { return mInput; }
|
||||
buffer_ptr_t& getOutput(void) { return mOutput; }
|
||||
@@ -463,7 +464,7 @@ class CurlResponderBuffer : protected AICurlResponderBufferEvents, protected AIC
|
||||
// Events from this class.
|
||||
/*virtual*/ void received_HTTP_header(void);
|
||||
/*virtual*/ void received_header(std::string const& key, std::string const& value);
|
||||
/*virtual*/ void completed_headers(U32 status, std::string const& reason, CURLcode code, AICurlInterface::TransferInfo* info);
|
||||
/*virtual*/ void completed_headers(U32 status, std::string const& reason, AITransferInfo* info);
|
||||
|
||||
// CurlEasyHandle events.
|
||||
/*virtual*/ void added_to_multi_handle(AICurlEasyRequest_wat& curl_easy_request_w);
|
||||
@@ -474,7 +475,7 @@ class CurlResponderBuffer : protected AICurlResponderBufferEvents, protected AIC
|
||||
buffer_ptr_t mInput;
|
||||
U8* mLastRead; // Pointer into mInput where we last stopped reading (or NULL to start at the beginning).
|
||||
buffer_ptr_t mOutput;
|
||||
AICurlInterface::ResponderPtr mResponder;
|
||||
LLHTTPClient::ResponderPtr mResponder;
|
||||
//U32 mBodyLimit; // From the old LLURLRequestDetail::mBodyLimit, but never used.
|
||||
U32 mStatus; // HTTP status, decoded from the first header line.
|
||||
std::string mReason; // The "reason" from the same header line.
|
||||
|
||||
@@ -2075,7 +2075,7 @@ void CurlResponderBuffer::processOutput(AICurlEasyRequest_wat& curl_easy_request
|
||||
std::string responseReason;
|
||||
|
||||
CURLcode code;
|
||||
AICurlInterface::TransferInfo info;
|
||||
AITransferInfo info;
|
||||
curl_easy_request_w->getResult(&code, &info);
|
||||
if (code == CURLE_OK)
|
||||
{
|
||||
@@ -2104,7 +2104,7 @@ void CurlResponderBuffer::processOutput(AICurlEasyRequest_wat& curl_easy_request
|
||||
llassert(mEventsTarget == mResponder.get());
|
||||
// Allow clients to parse result codes and headers before we attempt to parse
|
||||
// the body and provide completed/result/error calls.
|
||||
mEventsTarget->completed_headers(responseCode, responseReason, code, (code == CURLE_FAILED_INIT) ? NULL : &info);
|
||||
mEventsTarget->completed_headers(responseCode, responseReason, (code == CURLE_FAILED_INIT) ? NULL : &info);
|
||||
}
|
||||
mResponder->finished(code, responseCode, responseReason, sChannels, mOutput);
|
||||
mResponder = NULL;
|
||||
@@ -2124,10 +2124,10 @@ void CurlResponderBuffer::received_header(std::string const& key, std::string co
|
||||
mEventsTarget->received_header(key, value);
|
||||
}
|
||||
|
||||
void CurlResponderBuffer::completed_headers(U32 status, std::string const& reason, CURLcode code, AICurlInterface::TransferInfo* info)
|
||||
void CurlResponderBuffer::completed_headers(U32 status, std::string const& reason, AITransferInfo* info)
|
||||
{
|
||||
if (mEventsTarget)
|
||||
mEventsTarget->completed_headers(status, reason, code, info);
|
||||
mEventsTarget->completed_headers(status, reason, info);
|
||||
}
|
||||
|
||||
//static
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace LLAvatarNameCache
|
||||
class AIHTTPTimeoutPolicy;
|
||||
extern AIHTTPTimeoutPolicy avatarNameResponder_timeout;
|
||||
|
||||
class LLAvatarNameResponder : public LLHTTPClient::Responder
|
||||
class LLAvatarNameResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
private:
|
||||
// need to store agent ids that are part of this request in case of
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "llvfile.h"
|
||||
#include "llurlrequest.h"
|
||||
#include "llxmltree.h"
|
||||
#include "aihttptimeoutpolicy.h"
|
||||
|
||||
class AIHTTPTimeoutPolicy;
|
||||
extern AIHTTPTimeoutPolicy blockingLLSDPost_timeout;
|
||||
@@ -195,7 +196,7 @@ static void request(
|
||||
const std::string& url,
|
||||
LLURLRequest::ERequestAction method,
|
||||
Injector* body_injector,
|
||||
LLCurl::ResponderPtr responder,
|
||||
LLHTTPClient::ResponderPtr responder,
|
||||
AIHTTPHeaders& headers,
|
||||
bool is_auth = false,
|
||||
bool no_compression = false)
|
||||
@@ -254,10 +255,159 @@ void LLHTTPClient::get(std::string const& url, LLSD const& query, ResponderPtr r
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Responders base classes.
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class LLHTTPClient::ResponderBase
|
||||
//
|
||||
|
||||
LLHTTPClient::ResponderBase::ResponderBase(void) : mReferenceCount(0), mCode(CURLE_FAILED_INIT), mFinished(false)
|
||||
{
|
||||
DoutEntering(dc::curl, "AICurlInterface::Responder() with this = " << (void*)this);
|
||||
}
|
||||
|
||||
LLHTTPClient::ResponderBase::~ResponderBase()
|
||||
{
|
||||
DoutEntering(dc::curl, "AICurlInterface::ResponderBase::~ResponderBase() with this = " << (void*)this << "; mReferenceCount = " << mReferenceCount);
|
||||
llassert(mReferenceCount == 0);
|
||||
}
|
||||
|
||||
void LLHTTPClient::ResponderBase::setURL(std::string const& url)
|
||||
{
|
||||
// setURL is called from llhttpclient.cpp (request()), before calling any of the below (of course).
|
||||
// We don't need locking here therefore; it's a case of initializing before use.
|
||||
mURL = url;
|
||||
}
|
||||
|
||||
AIHTTPTimeoutPolicy const& LLHTTPClient::ResponderBase::getHTTPTimeoutPolicy(void) const
|
||||
{
|
||||
return AIHTTPTimeoutPolicy::getDebugSettingsCurlTimeout();
|
||||
}
|
||||
|
||||
void LLHTTPClient::ResponderBase::decode_llsd_body(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer, LLSD& content)
|
||||
{
|
||||
// If the status indicates success (and we get here) then we expect the body to be LLSD.
|
||||
bool const should_be_llsd = (200 <= status && status < 300);
|
||||
if (should_be_llsd)
|
||||
{
|
||||
LLBufferStream istr(channels, buffer.get());
|
||||
if (LLSDSerialize::fromXML(content, istr) == LLSDParser::PARSE_FAILURE)
|
||||
{
|
||||
// Unfortunately we can't show the body of the message... I think this is a pretty serious error
|
||||
// though, so if this ever happens it has to be investigated by making a copy of the buffer
|
||||
// before serializing it, as is done below.
|
||||
llwarns << "Failed to deserialize LLSD. " << mURL << " [" << status << "]: " << reason << llendl;
|
||||
}
|
||||
// LLSDSerialize::fromXML destructed buffer, we can't initialize content now.
|
||||
return;
|
||||
}
|
||||
// Put the body in content as-is.
|
||||
std::stringstream ss;
|
||||
buffer->writeChannelTo(ss, channels.in());
|
||||
content = ss.str();
|
||||
#ifdef SHOW_ASSERT
|
||||
if (!should_be_llsd)
|
||||
{
|
||||
// Make sure that the server indeed never returns LLSD as body when the http status is an error.
|
||||
LLSD dummy;
|
||||
bool server_sent_llsd_with_http_error = LLSDSerialize::fromXML(dummy, ss) > 0;
|
||||
if (server_sent_llsd_with_http_error)
|
||||
{
|
||||
llwarns << "The server sent us a response with http status " << status << " and LLSD(!) body: \"" << ss.str() << "\"!" << llendl;
|
||||
}
|
||||
llassert(!server_sent_llsd_with_http_error);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void LLHTTPClient::ResponderBase::decode_raw_body(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer, std::string& content)
|
||||
{
|
||||
LLMutexLock lock(buffer->getMutex());
|
||||
LLBufferArray::const_segment_iterator_t const end = buffer->endSegment();
|
||||
for (LLBufferArray::const_segment_iterator_t iter = buffer->beginSegment(); iter != end; ++iter)
|
||||
{
|
||||
if (iter->isOnChannel(channels.in()))
|
||||
{
|
||||
content.append((char*)iter->data(), iter->size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called with HTML body.
|
||||
// virtual
|
||||
void LLHTTPClient::ResponderWithCompleted::completedRaw(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
|
||||
{
|
||||
LLSD content;
|
||||
decode_llsd_body(status, reason, channels, buffer, content);
|
||||
|
||||
// Allow derived class to override at this point.
|
||||
completed(status, reason, content);
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLHTTPClient::ResponderWithCompleted::completed(U32 status, std::string const& reason, LLSD const& content)
|
||||
{
|
||||
// Either completedRaw() or this method must be overridden by the derived class. Hence, we should never get here.
|
||||
llassert_always(false);
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLHTTPClient::ResponderWithResult::finished(CURLcode code, U32 http_status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
|
||||
{
|
||||
mCode = code;
|
||||
|
||||
LLSD content;
|
||||
decode_llsd_body(http_status, reason, channels, buffer, content);
|
||||
|
||||
// HTTP status good?
|
||||
if (200 <= http_status && http_status < 300)
|
||||
{
|
||||
// Allow derived class to override at this point.
|
||||
result(content);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Allow derived class to override at this point.
|
||||
errorWithContent(http_status, reason, content);
|
||||
}
|
||||
|
||||
mFinished = true;
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLHTTPClient::ResponderWithResult::errorWithContent(U32 status, std::string const& reason, LLSD const&)
|
||||
{
|
||||
// Allow derived class to override at this point.
|
||||
error(status, reason);
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLHTTPClient::ResponderWithResult::error(U32 status, std::string const& reason)
|
||||
{
|
||||
llinfos << mURL << " [" << status << "]: " << reason << llendl;
|
||||
}
|
||||
|
||||
// Friend functions.
|
||||
|
||||
void intrusive_ptr_add_ref(LLHTTPClient::ResponderBase* responder)
|
||||
{
|
||||
responder->mReferenceCount++;
|
||||
}
|
||||
|
||||
void intrusive_ptr_release(LLHTTPClient::ResponderBase* responder)
|
||||
{
|
||||
if (--responder->mReferenceCount == 0)
|
||||
{
|
||||
delete responder;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Blocking Responders.
|
||||
//
|
||||
|
||||
class BlockingResponder : public AICurlInterface::LegacyPolledResponder {
|
||||
class BlockingResponder : public LLHTTPClient::LegacyPolledResponder {
|
||||
private:
|
||||
LLCondition mSignal; // Wait condition to wait till mFinished is true.
|
||||
static LLSD LLSD_dummy;
|
||||
@@ -346,7 +496,7 @@ public:
|
||||
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return blockingRawGet_timeout; }
|
||||
};
|
||||
|
||||
// End blocking responders.
|
||||
// End (blocking) responders.
|
||||
//=============================================================================
|
||||
|
||||
// These calls are blocking! This is usually bad, unless you're a dataserver. Then it's awesome.
|
||||
|
||||
@@ -32,29 +32,302 @@
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <curl/curl.h> // CURLcode
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
|
||||
#include "llassettype.h"
|
||||
#include "llcurl.h"
|
||||
#include "llhttpstatuscodes.h"
|
||||
#include "aihttpheaders.h"
|
||||
|
||||
class LLUUID;
|
||||
class LLPumpIO;
|
||||
class LLSD;
|
||||
class AIHTTPTimeoutPolicy;
|
||||
class LLBufferArray;
|
||||
class LLChannelDescriptors;
|
||||
|
||||
extern AIHTTPTimeoutPolicy responderIgnore_timeout;
|
||||
typedef struct _xmlrpc_request* XMLRPC_REQUEST;
|
||||
typedef struct _xmlrpc_value* XMLRPC_VALUE;
|
||||
|
||||
class LLHTTPClient
|
||||
{
|
||||
public:
|
||||
// For convenience
|
||||
typedef LLCurl::Responder Responder;
|
||||
typedef LLCurl::ResponderPtr ResponderPtr;
|
||||
// Output parameter of AICurlPrivate::CurlEasyRequest::getResult.
|
||||
// Used in XMLRPCResponder.
|
||||
struct AITransferInfo {
|
||||
AITransferInfo() : mSizeDownload(0.0), mTotalTime(0.0), mSpeedDownload(0.0) { }
|
||||
F64 mSizeDownload;
|
||||
F64 mTotalTime;
|
||||
F64 mSpeedDownload;
|
||||
};
|
||||
|
||||
class ResponderIgnoreBody : public Responder { void result(LLSD const&) { } };
|
||||
class ResponderIgnore : public ResponderIgnoreBody { virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return responderIgnore_timeout;} };
|
||||
// Events generated by AICurlPrivate::CurlResponderBuffer.
|
||||
struct AICurlResponderBufferEvents {
|
||||
virtual void received_HTTP_header(void) = 0; // For example "HTTP/1.0 200 OK", the first header of a reply.
|
||||
virtual void received_header(std::string const& key, std::string const& value) = 0; // Subsequent headers.
|
||||
virtual void completed_headers(U32 status, std::string const& reason, AITransferInfo* info) = 0; // Transaction completed.
|
||||
};
|
||||
|
||||
class LLHTTPClient {
|
||||
public:
|
||||
|
||||
/** @name Responder base classes */
|
||||
//@{
|
||||
|
||||
/**
|
||||
* @class ResponderBase
|
||||
* @brief Base class for all Responders.
|
||||
*
|
||||
* The life cycle of classes derived from this class is as follows:
|
||||
* They are allocated with new on the line where get(), getByteRange() or post() is called,
|
||||
* and the pointer to the allocated object is then put in a reference counting ResponderPtr.
|
||||
* This ResponderPtr is passed to CurlResponderBuffer::prepRequest which stores it in its
|
||||
* member mResponder. Hence, the life time of a Responder is never longer than its
|
||||
* associated CurlResponderBuffer, however, if everything works correctly, then normally a
|
||||
* responder is deleted in CurlResponderBuffer::removed_from_multi_handle by setting
|
||||
* mReponder to NULL.
|
||||
*
|
||||
* Note that the lifetime of CurlResponderBuffer is (a bit) shorter than the associated
|
||||
* CurlEasyRequest (because of the order of base classes of ThreadSafeBufferedCurlEasyRequest)
|
||||
* and the callbacks, as set by prepRequest, only use those two.
|
||||
* A callback locks the CurlEasyRequest before actually making the callback, and the
|
||||
* destruction of CurlResponderBuffer also first locks the CurlEasyRequest, and then revokes
|
||||
* the callbacks. This assures that a Responder is never used when the objects it uses are
|
||||
* destructed. Also, if any of those are destructed then the Responder is automatically
|
||||
* destructed too.
|
||||
*/
|
||||
class ResponderBase : public AICurlResponderBufferEvents {
|
||||
public:
|
||||
typedef boost::shared_ptr<LLBufferArray> buffer_ptr_t;
|
||||
|
||||
protected:
|
||||
ResponderBase(void);
|
||||
virtual ~ResponderBase();
|
||||
|
||||
// Read body from buffer and put it into content. If status indicates success, interpret it as LLSD, otherwise copy it as-is.
|
||||
void decode_llsd_body(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer, LLSD& content);
|
||||
|
||||
// Read body from buffer and put it into content. Always copy it as-is.
|
||||
void decode_raw_body(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer, std::string& content);
|
||||
|
||||
protected:
|
||||
// Associated URL, used for debug output.
|
||||
std::string mURL;
|
||||
|
||||
// Headers received from the server.
|
||||
AIHTTPReceivedHeaders mReceivedHeaders;
|
||||
|
||||
// The curl result code.
|
||||
CURLcode mCode;
|
||||
|
||||
// Set when the transaction finished (with or without errors).
|
||||
bool mFinished;
|
||||
|
||||
public:
|
||||
// Called to set the URL of the current request for this Responder,
|
||||
// used only when printing debug output regarding activity of the Responder.
|
||||
void setURL(std::string const& url);
|
||||
|
||||
// Accessors.
|
||||
std::string const& getURL(void) const { return mURL; }
|
||||
CURLcode result_code(void) const { return mCode; }
|
||||
|
||||
// Called by CurlResponderBuffer::timed_out or CurlResponderBuffer::processOutput.
|
||||
virtual void finished(CURLcode code, U32 http_status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer) = 0;
|
||||
|
||||
// Return true if the curl thread is done with this transaction.
|
||||
// If this returns true then it is guaranteed that none of the
|
||||
// virtual functions will be called anymore: the curl thread
|
||||
// will not access this object anymore.
|
||||
// Note that normally you don't need to call this function.
|
||||
bool is_finished(void) const { return mFinished; }
|
||||
|
||||
protected:
|
||||
// AICurlResponderBufferEvents
|
||||
|
||||
// Called when the "HTTP/1.x <status> <reason>" header is received.
|
||||
/*virtual*/ void received_HTTP_header(void)
|
||||
{
|
||||
// It's possible that this page was moved (302), so we already saw headers
|
||||
// from the 302 page and are starting over on the new page now.
|
||||
mReceivedHeaders.clear();
|
||||
}
|
||||
|
||||
// Called for all remaining headers.
|
||||
/*virtual*/ void received_header(std::string const& key, std::string const& value)
|
||||
{
|
||||
mReceivedHeaders.addHeader(key, value);
|
||||
}
|
||||
|
||||
// Called when the whole transaction is completed (also the body was received), but before the body is processed.
|
||||
/*virtual*/ void completed_headers(U32 status, std::string const& reason, AITransferInfo* info)
|
||||
{
|
||||
completedHeaders(status, reason, mReceivedHeaders);
|
||||
}
|
||||
|
||||
public:
|
||||
// Derived classes that implement completed_headers()/completedHeaders() should return true here.
|
||||
virtual bool needsHeaders(void) const { return false; }
|
||||
|
||||
// A derived class should return true if curl should follow redirections.
|
||||
// The default is not to follow redirections.
|
||||
virtual bool followRedir(void) { return false; }
|
||||
|
||||
// Timeout policy to use.
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const = 0;
|
||||
|
||||
protected:
|
||||
// Derived classes can override this to get the HTML headers that were received, when the message is completed.
|
||||
virtual void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers)
|
||||
{
|
||||
// The default does nothing.
|
||||
}
|
||||
|
||||
private:
|
||||
// Used by ResponderPtr. Object is deleted when reference count reaches zero.
|
||||
LLAtomicU32 mReferenceCount;
|
||||
|
||||
friend void intrusive_ptr_add_ref(ResponderBase* p); // Called by boost::intrusive_ptr when a new copy of a boost::intrusive_ptr<ResponderBase> is made.
|
||||
friend void intrusive_ptr_release(ResponderBase* p); // Called by boost::intrusive_ptr when a boost::intrusive_ptr<ResponderBase> is destroyed.
|
||||
// This function must delete the ResponderBase object when the reference count reaches zero.
|
||||
};
|
||||
|
||||
/**
|
||||
* @class ResponderWithCompleted
|
||||
* @brief Base class for Responders that implement completed, or completedRaw if the response is not LLSD.
|
||||
*/
|
||||
class ResponderWithCompleted : public ResponderBase {
|
||||
protected:
|
||||
// ResponderBase event
|
||||
|
||||
// The responder finished. Do not override this function in derived classes; override completedRaw instead.
|
||||
/*virtual*/ void finished(CURLcode code, U32 http_status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
|
||||
{
|
||||
mCode = code;
|
||||
// Allow classes derived from ResponderBase to override completedRaw
|
||||
// (if not they should override completed or be derived from Responder instead).
|
||||
completedRaw(http_status, reason, channels, buffer);
|
||||
mFinished = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
// Events generated by this class.
|
||||
|
||||
// Derived classes can override this to get the raw data of the body of the HTML message that was received.
|
||||
// The default is to interpret the content as LLSD and call completed().
|
||||
virtual void completedRaw(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer);
|
||||
|
||||
// ... or, derived classes can override this to get LLSD content when the message is completed.
|
||||
// The default aborts, as it should never be called (can't make it pure virtual though, so
|
||||
// classes that override completedRaw don't need to implement this function, too).
|
||||
virtual void completed(U32 status, std::string const& reason, LLSD const& content);
|
||||
|
||||
#ifdef SHOW_ASSERT
|
||||
// Responders derived from this class must override either completedRaw or completed.
|
||||
// They may not attempt to override any of the virual functions defined by ResponderBase.
|
||||
// Define those functions here with different parameters in order to cause a compile
|
||||
// warning when a class accidently tries to override them.
|
||||
enum YOU_ARE_DERIVING_FROM_THE_WRONG_CLASS { };
|
||||
virtual void result(YOU_ARE_DERIVING_FROM_THE_WRONG_CLASS) { }
|
||||
virtual void errorWithContent(YOU_ARE_DERIVING_FROM_THE_WRONG_CLASS) { }
|
||||
virtual void error(YOU_ARE_DERIVING_FROM_THE_WRONG_CLASS) { }
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* @class ResponderWithResult
|
||||
* @brief Base class for reponders that expect LLSD in the body of the reply.
|
||||
*
|
||||
* Classes derived from ResponderWithResult must implement result, and either errorWithContent or error.
|
||||
*/
|
||||
class ResponderWithResult : public ResponderBase {
|
||||
protected:
|
||||
// The responder finished. Do not override this function in derived classes; use ResponderWithCompleted instead.
|
||||
/*virtual*/ void finished(CURLcode code, U32 http_status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer);
|
||||
|
||||
protected:
|
||||
// Events generated by this class.
|
||||
|
||||
// Derived classes must override this to receive the content of a body upon success.
|
||||
virtual void result(LLSD const& content) = 0;
|
||||
|
||||
// Derived classes can override this to get informed when a bad HTML status code is received.
|
||||
// The default calls error().
|
||||
virtual void errorWithContent(U32 status, std::string const& reason, LLSD const& content);
|
||||
|
||||
// ... or, derived classes can override this to get informed when a bad HTML status code is received.
|
||||
// The default prints the error to llinfos.
|
||||
virtual void error(U32 status, std::string const& reason);
|
||||
|
||||
public:
|
||||
// Called from LLSDMessage::ResponderAdapter::listener.
|
||||
// LLSDMessage::ResponderAdapter is a hack, showing among others by fact that it needs these functions.
|
||||
|
||||
void pubErrorWithContent(CURLcode code, U32 status, std::string const& reason, LLSD const& content) { mCode = code; errorWithContent(status, reason, content); mFinished = true; }
|
||||
void pubResult(LLSD const& content) { mCode = CURLE_OK; result(content); mFinished = true; }
|
||||
|
||||
#ifdef SHOW_ASSERT
|
||||
// Responders derived from this class must override result, and either errorWithContent or error.
|
||||
// They may not attempt to override any of the virual functions defined by ResponderWithCompleted.
|
||||
// Define those functions here with different parameter in order to cause a compile
|
||||
// warning when a class accidently tries to override them.
|
||||
enum YOU_ARE_DERIVING_FROM_THE_WRONG_CLASS { };
|
||||
virtual void completedRaw(YOU_ARE_DERIVING_FROM_THE_WRONG_CLASS) { }
|
||||
virtual void completed(YOU_ARE_DERIVING_FROM_THE_WRONG_CLASS) { }
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* @class LegacyPolledResponder
|
||||
* @brief As ResponderWithCompleted but caches the result for polling.
|
||||
*
|
||||
* This class allows old polling code to poll if the transaction finished
|
||||
* by calling is_finished() (from the main the thread) and then access the
|
||||
* results-- as opposed to immediately digesting the results when any of
|
||||
* the virtual functions are called.
|
||||
*/
|
||||
class LegacyPolledResponder : public ResponderWithCompleted {
|
||||
protected:
|
||||
U32 mStatus;
|
||||
std::string mReason;
|
||||
|
||||
protected:
|
||||
// The responder finished. Do not override this function in derived classes.
|
||||
/*virtual*/ void finished(CURLcode code, U32 http_status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
|
||||
{
|
||||
mStatus = http_status;
|
||||
mReason = reason;
|
||||
// Call base class implementation.
|
||||
ResponderWithCompleted::finished(code, http_status, reason, channels, buffer);
|
||||
}
|
||||
|
||||
public:
|
||||
LegacyPolledResponder(void) : mStatus(HTTP_INTERNAL_ERROR) { }
|
||||
|
||||
// Accessors.
|
||||
U32 http_status(void) const { return mStatus; }
|
||||
std::string const& reason(void) const { return mReason; }
|
||||
};
|
||||
|
||||
/**
|
||||
* @class ResponderIgnoreBody
|
||||
* @brief Base class for responders that ignore the result body.
|
||||
*/
|
||||
class ResponderIgnoreBody : public ResponderWithResult {
|
||||
void result(LLSD const&) { }
|
||||
};
|
||||
|
||||
/**
|
||||
* @class ResponderIgnore
|
||||
* @brief Responder that ignores the reply, if any, from the server.
|
||||
*/
|
||||
class ResponderIgnore : public ResponderIgnoreBody {
|
||||
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return responderIgnore_timeout;}
|
||||
};
|
||||
|
||||
// A Responder is passed around as ResponderPtr, which causes it to automatically
|
||||
// destruct when there are no pointers left pointing to it.
|
||||
typedef boost::intrusive_ptr<ResponderBase> ResponderPtr;
|
||||
|
||||
//@}
|
||||
|
||||
/** @name non-blocking API */
|
||||
//@{
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/**
|
||||
* @file llhttpclientadapter.cpp
|
||||
* @brief
|
||||
*
|
||||
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llhttpclientadapter.h"
|
||||
#include "llhttpclient.h"
|
||||
|
||||
LLHTTPClientAdapter::~LLHTTPClientAdapter()
|
||||
{
|
||||
}
|
||||
|
||||
void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder)
|
||||
{
|
||||
// Pragma is required to stop curl adding "no-cache"
|
||||
// Space is required to stop llurlrequest from turnning off proxying
|
||||
AIHTTPHeaders empty_pragma_header("Pragma", " ");
|
||||
LLHTTPClient::get(url, responder, empty_pragma_header);
|
||||
}
|
||||
|
||||
void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers)
|
||||
{
|
||||
// as above
|
||||
AIHTTPHeaders empty_pragma_header("Pragma", " ");
|
||||
LLHTTPClient::get(url, responder, empty_pragma_header);
|
||||
}
|
||||
|
||||
void LLHTTPClientAdapter::put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder)
|
||||
{
|
||||
LLHTTPClient::put(url, body, responder);
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/**
|
||||
* @file llhttpclientadepter.h
|
||||
* @brief
|
||||
*
|
||||
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_HTTPCLIENTADAPTER_H
|
||||
#define LL_HTTPCLIENTADAPTER_H
|
||||
|
||||
#include "llhttpclientinterface.h"
|
||||
#include "llsingleton.h" // LLSingleton<>
|
||||
|
||||
class LLHTTPClientAdapter : public LLHTTPClientInterface, public LLSingleton<LLHTTPClientAdapter>
|
||||
{
|
||||
public:
|
||||
virtual ~LLHTTPClientAdapter();
|
||||
virtual void get(const std::string& url, LLCurl::ResponderPtr responder);
|
||||
virtual void get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers);
|
||||
virtual void put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* @file llhttpclientinterface.h
|
||||
* @brief
|
||||
*
|
||||
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLHTTPCLIENTINTERFACE_H
|
||||
#define LL_LLHTTPCLIENTINTERFACE_H
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llcurl.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class LLHTTPClientInterface
|
||||
{
|
||||
public:
|
||||
virtual ~LLHTTPClientInterface() {}
|
||||
virtual void get(const std::string& url, LLCurl::ResponderPtr responder) = 0;
|
||||
virtual void get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers) = 0;
|
||||
virtual void put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder) = 0;
|
||||
};
|
||||
|
||||
#endif // LL_LLHTTPCLIENTINTERFACE_H
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llregionpresenceverifier.h"
|
||||
#include "llhttpclientinterface.h"
|
||||
#include <sstream>
|
||||
#include "net.h"
|
||||
#include "message.h"
|
||||
@@ -78,7 +77,7 @@ void LLRegionPresenceVerifier::RegionResponder::result(const LLSD& content)
|
||||
|
||||
std::stringstream uri;
|
||||
uri << "http://" << destination.getString() << "/state/basic/";
|
||||
mSharedData->getHttpClient().get(
|
||||
LLHTTPClient::get(
|
||||
uri.str(),
|
||||
new VerifiedDestinationResponder(mUri, mSharedData, content, mRetryCount));
|
||||
}
|
||||
@@ -131,12 +130,11 @@ void LLRegionPresenceVerifier::VerifiedDestinationResponder::result(const LLSD&
|
||||
|
||||
void LLRegionPresenceVerifier::VerifiedDestinationResponder::retry()
|
||||
{
|
||||
LLSD headers;
|
||||
headers["Cache-Control"] = "no-cache, max-age=0";
|
||||
AIHTTPHeaders headers("Cache-Control", "no-cache, max-age=0");
|
||||
llinfos << "Requesting region information, get uncached for region "
|
||||
<< mUri << llendl;
|
||||
--mRetryCount;
|
||||
mSharedData->getHttpClient().get(mUri, new RegionResponder(mUri, mSharedData, mRetryCount), headers);
|
||||
LLHTTPClient::get(mUri, new RegionResponder(mUri, mSharedData, mRetryCount), headers);
|
||||
}
|
||||
|
||||
void LLRegionPresenceVerifier::VerifiedDestinationResponder::error(U32 status, const std::string& reason)
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "llsd.h"
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
|
||||
class LLHTTPClientInterface;
|
||||
class AIHTTPTimeoutPolicy;
|
||||
extern AIHTTPTimeoutPolicy regionResponder_timeout;
|
||||
extern AIHTTPTimeoutPolicy verifiedDestinationResponder_timeout;
|
||||
@@ -50,15 +49,13 @@ public:
|
||||
virtual void onRegionVerified(const LLSD& region_details) = 0;
|
||||
virtual void onRegionVerificationFailed() = 0;
|
||||
|
||||
virtual LLHTTPClientInterface& getHttpClient() = 0;
|
||||
|
||||
public: /* but not really -- don't touch this */
|
||||
U32 mReferenceCount;
|
||||
};
|
||||
|
||||
typedef boost::intrusive_ptr<Response> ResponsePtr;
|
||||
|
||||
class RegionResponder : public LLHTTPClient::Responder
|
||||
class RegionResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return regionResponder_timeout; }
|
||||
@@ -75,7 +72,7 @@ public:
|
||||
S32 mRetryCount;
|
||||
};
|
||||
|
||||
class VerifiedDestinationResponder : public LLHTTPClient::Responder
|
||||
class VerifiedDestinationResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return verifiedDestinationResponder_timeout; }
|
||||
|
||||
@@ -145,7 +145,7 @@ void LLSDMessage::EventResponder::errorWithContent(U32 status, const std::string
|
||||
}
|
||||
}
|
||||
|
||||
LLSDMessage::ResponderAdapter::ResponderAdapter(LLHTTPClient::Responder* responder,
|
||||
LLSDMessage::ResponderAdapter::ResponderAdapter(LLHTTPClient::ResponderWithResult* responder,
|
||||
const std::string& name):
|
||||
mResponder(responder),
|
||||
mReplyPump(name + ".reply", true), // tweak name for uniqueness
|
||||
@@ -162,7 +162,7 @@ std::string LLSDMessage::ResponderAdapter::getTimeoutPolicyName(void) const
|
||||
|
||||
bool LLSDMessage::ResponderAdapter::listener(const LLSD& payload, bool success)
|
||||
{
|
||||
AICurlInterface::Responder* responder = dynamic_cast<AICurlInterface::Responder*>(mResponder.get());
|
||||
LLHTTPClient::ResponderWithResult* responder = dynamic_cast<LLHTTPClient::ResponderWithResult*>(mResponder.get());
|
||||
// If this assertion fails then ResponderAdapter has been used for a ResponderWithCompleted derived class,
|
||||
// which is not allowed because ResponderAdapter can only work for classes derived from Responder that
|
||||
// implement result() and errorWithContent (or just error).
|
||||
|
||||
@@ -66,31 +66,39 @@ public:
|
||||
* must be visible to the reply/error methods can conveniently be stored
|
||||
* on that class itself, if it's not already.
|
||||
*
|
||||
* The LLHTTPClient::Responder idiom requires a separate instance of a
|
||||
* The LLHTTPClient::ResponderBase idiom requires a separate instance of a
|
||||
* separate class so that it can dispatch to the code of interest by
|
||||
* calling canonical virtual methods. Interesting state must be copied
|
||||
* into that new object.
|
||||
*
|
||||
* With some trepidation, because existing response code is packaged in
|
||||
* LLHTTPClient::Responder subclasses, we provide this adapter class
|
||||
* LLHTTPClient::ResponderWithResult subclasses, we provide this adapter class
|
||||
* <i>for transitional purposes only.</i> Instantiate a new heap
|
||||
* ResponderAdapter with your new LLHTTPClient::ResponderPtr. Pass
|
||||
* ResponderAdapter::getReplyName() and/or getErrorName() in your
|
||||
* LLSDMessage (or LLViewerRegion::getCapAPI()) request event. The
|
||||
* ResponderAdapter will call the appropriate Responder method, then
|
||||
* @c delete itself.
|
||||
*
|
||||
* Singularity note: I think this class/API is a bad idea that makes things
|
||||
* more complex, a lot slower and less OO. The idea to get methods called
|
||||
* on the same class that does the request is a nice idea, but should
|
||||
* be implemented through boost::bind and NOT use LLSD. Avoid.
|
||||
* Also note that this only works for ResponderWithResult derived classes,
|
||||
* not for responders derived from ResponderWithCompleted.
|
||||
* --Aleric
|
||||
*/
|
||||
class ResponderAdapter
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Bind the new LLHTTPClient::Responder subclass instance.
|
||||
* Bind the new LLHTTPClient::ResponderWithResult subclass instance.
|
||||
*
|
||||
* Passing the constructor a name other than the default is only
|
||||
* interesting if you suspect some usage will lead to an exception or
|
||||
* log message.
|
||||
*/
|
||||
ResponderAdapter(LLHTTPClient::Responder* responder,
|
||||
ResponderAdapter(LLHTTPClient::ResponderWithResult* responder,
|
||||
const std::string& name="ResponderAdapter");
|
||||
|
||||
/// EventPump name on which LLSDMessage should post reply event
|
||||
@@ -125,13 +133,13 @@ private:
|
||||
friend class LLCapabilityListener;
|
||||
/// Responder used for internal purposes by LLSDMessage and
|
||||
/// LLCapabilityListener. Others should use higher-level APIs.
|
||||
class EventResponder: public LLHTTPClient::Responder
|
||||
class EventResponder: public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return *mHTTPTimeoutPolicy; }
|
||||
|
||||
/**
|
||||
* LLHTTPClient::Responder that dispatches via named LLEventPump instances.
|
||||
* LLHTTPClient::ResponderWithResult that dispatches via named LLEventPump instances.
|
||||
* We bind LLEventPumps, even though it's an LLSingleton, for testability.
|
||||
* We bind the string names of the desired LLEventPump instances rather
|
||||
* than actually obtain()ing them so we only obtain() the one we're going
|
||||
|
||||
@@ -77,7 +77,7 @@ std::string LLURLRequest::actionAsVerb(LLURLRequest::ERequestAction action)
|
||||
|
||||
// This might throw AICurlNoEasyHandle.
|
||||
LLURLRequest::LLURLRequest(LLURLRequest::ERequestAction action, std::string const& url, Injector* body,
|
||||
AICurlInterface::ResponderPtr responder, AIHTTPHeaders& headers, bool is_auth, bool no_compression) :
|
||||
LLHTTPClient::ResponderPtr responder, AIHTTPHeaders& headers, bool is_auth, bool no_compression) :
|
||||
AICurlEasyRequestStateMachine(true), mAction(action), mURL(url), mIsAuth(is_auth), mNoCompression(no_compression),
|
||||
mBody(body), mResponder(responder), mHeaders(headers)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
class Injector
|
||||
{
|
||||
public:
|
||||
typedef AICurlInterface::Responder::buffer_ptr_t buffer_ptr_t;
|
||||
typedef LLHTTPClient::ResponderBase::buffer_ptr_t buffer_ptr_t;
|
||||
virtual char const* contentType(void) const = 0;
|
||||
virtual U32 get_body(LLChannelDescriptors const& channels, buffer_ptr_t& buffer) = 0;
|
||||
};
|
||||
@@ -75,7 +75,7 @@ class LLURLRequest : public AICurlEasyRequestStateMachine {
|
||||
* @param action One of the ERequestAction enumerations.
|
||||
* @param url The url of the request. It should already be encoded.
|
||||
*/
|
||||
LLURLRequest(ERequestAction action, std::string const& url, Injector* body, AICurlInterface::ResponderPtr responder, AIHTTPHeaders& headers, bool is_auth, bool no_compression);
|
||||
LLURLRequest(ERequestAction action, std::string const& url, Injector* body, LLHTTPClient::ResponderPtr responder, AIHTTPHeaders& headers, bool is_auth, bool no_compression);
|
||||
|
||||
protected:
|
||||
// Call abort(), not delete.
|
||||
@@ -118,7 +118,7 @@ class LLURLRequest : public AICurlEasyRequestStateMachine {
|
||||
bool mNoCompression; // Set to disable using gzip.
|
||||
Injector* mBody; // Non-zero iff the action is HTTP_POST and HTTP_PUT.
|
||||
U32 mBodySize;
|
||||
AICurlInterface::ResponderPtr mResponder;
|
||||
LLHTTPClient::ResponderPtr mResponder;
|
||||
AIHTTPHeaders mHeaders;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
|
||||
namespace
|
||||
{
|
||||
class LLFnPtrResponder : public LLHTTPClient::Responder
|
||||
class LLFnPtrResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
LOG_CLASS(LLFnPtrResponder);
|
||||
public:
|
||||
|
||||
@@ -65,7 +65,7 @@ FloaterVoiceLicense::FloaterVoiceLicense(const LLSD& key)
|
||||
|
||||
// helper class that trys to download a URL from a web site and calls a method
|
||||
// on parent class indicating if the web server is working or not
|
||||
class LLIamHereVoice : public LLHTTPClient::Responder
|
||||
class LLIamHereVoice : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
private:
|
||||
LLIamHereVoice( FloaterVoiceLicense* parent ) :
|
||||
|
||||
@@ -52,7 +52,7 @@ class lggDicDownloadFloater;
|
||||
class AIHTTPTimeoutPolicy;
|
||||
extern AIHTTPTimeoutPolicy emeraldDicDownloader_timeout;
|
||||
|
||||
class EmeraldDicDownloader : public AICurlInterface::ResponderWithCompleted
|
||||
class EmeraldDicDownloader : public LLHTTPClient::ResponderWithCompleted
|
||||
{
|
||||
public:
|
||||
EmeraldDicDownloader(lggDicDownloadFloater* spanel, std::string sname);
|
||||
|
||||
@@ -38,7 +38,7 @@ LLAccountingCostManager::LLAccountingCostManager()
|
||||
{
|
||||
}
|
||||
//===============================================================================
|
||||
class LLAccountingCostResponder : public LLCurl::Responder
|
||||
class LLAccountingCostResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLAccountingCostResponder( const LLSD& objectIDs )
|
||||
|
||||
@@ -2171,7 +2171,7 @@ void LLAgent::setStartPosition( U32 location_id )
|
||||
|
||||
// This awkward idiom warrants explanation.
|
||||
// For starters, LLSDMessage::ResponderAdapter is ONLY for testing the new
|
||||
// LLSDMessage functionality with a pre-existing LLHTTPClient::Responder.
|
||||
// LLSDMessage functionality with a pre-existing LLHTTPClient::ResponderWithResult.
|
||||
// In new code, define your reply/error methods on the same class as the
|
||||
// sending method, bind them to local LLEventPump objects and pass those
|
||||
// LLEventPump names in the request LLSD object.
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
#include "llprimitive.h"
|
||||
#include "llnotifications.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "llcurl.h"
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#if LL_WINDOWS
|
||||
|
||||
@@ -51,7 +51,7 @@ void on_new_single_inventory_upload_complete(LLAssetType::EType asset_type,
|
||||
|
||||
// Abstract class for supporting asset upload
|
||||
// via capabilities
|
||||
class LLAssetUploadResponder : public LLHTTPClient::Responder
|
||||
class LLAssetUploadResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLAssetUploadResponder(const LLSD& post_data,
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
// are needed (such as different confirmation messages, etc.)
|
||||
// the functions onApplicationLevelError and showConfirmationDialog.
|
||||
class LLNewAgentInventoryVariablePriceResponder :
|
||||
public LLHTTPClient::Responder
|
||||
public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLNewAgentInventoryVariablePriceResponder(
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
class AIHTTPTimeoutPolicy;
|
||||
extern AIHTTPTimeoutPolicy classifiedStatsResponder_timeout;
|
||||
|
||||
class LLClassifiedStatsResponder : public LLHTTPClient::Responder
|
||||
class LLClassifiedStatsResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLClassifiedStatsResponder(LLHandle<LLView> classified_panel_handle, LLUUID classified_id);
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace
|
||||
const F32 EVENT_POLL_ERROR_RETRY_SECONDS_INC = 5.f; // ~ half of a normal timeout.
|
||||
const S32 MAX_EVENT_POLL_HTTP_ERRORS = 10; // ~5 minutes, by the above rules.
|
||||
|
||||
class LLEventPollResponder : public LLHTTPClient::Responder
|
||||
class LLEventPollResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -273,7 +273,7 @@ LLEventPoll::LLEventPoll(const std::string& poll_url, const LLHost& sender)
|
||||
|
||||
LLEventPoll::~LLEventPoll()
|
||||
{
|
||||
AICurlInterface::ResponderBase* responderp = mImpl.get();
|
||||
LLHTTPClient::ResponderBase* responderp = mImpl.get();
|
||||
LLEventPollResponder* event_poll_responder = dynamic_cast<LLEventPollResponder*>(responderp);
|
||||
if (event_poll_responder) event_poll_responder->stop();
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return asyncConsoleResponder_timeout; }
|
||||
};
|
||||
|
||||
class ConsoleResponder : public LLHTTPClient::Responder
|
||||
class ConsoleResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
ConsoleResponder(LLTextEditor *output) : mOutput(output)
|
||||
|
||||
@@ -2310,7 +2310,7 @@ void LLPanelEstateInfo::getEstateOwner()
|
||||
}
|
||||
*/
|
||||
|
||||
class LLEstateChangeInfoResponder : public LLHTTPClient::Responder
|
||||
class LLEstateChangeInfoResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLEstateChangeInfoResponder(void* userdata) : mpPanel((LLPanelEstateInfo*)userdata) {};
|
||||
|
||||
@@ -858,7 +858,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class LLUserReportResponder : public LLHTTPClient::Responder
|
||||
class LLUserReportResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLUserReportResponder() { }
|
||||
|
||||
@@ -64,7 +64,7 @@ extern AIHTTPTimeoutPolicy placeAvatarTeleportResponder_timeout;
|
||||
// OGPX TODO: mResult should not get replaced in result(), instead
|
||||
// should replace individual LLSD fields in mResult.
|
||||
class LLPlaceAvatarTeleportResponder :
|
||||
public LLHTTPClient::Responder
|
||||
public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLPlaceAvatarTeleportResponder()
|
||||
|
||||
@@ -92,7 +92,7 @@ LLFloaterTOS::LLFloaterTOS(ETOSType type, const std::string & message)
|
||||
|
||||
// helper class that trys to download a URL from a web site and calls a method
|
||||
// on parent class indicating if the web server is working or not
|
||||
class LLIamHere : public LLHTTPClient::Responder
|
||||
class LLIamHere : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
private:
|
||||
LLIamHere( LLFloaterTOS* parent ) :
|
||||
|
||||
@@ -42,7 +42,7 @@ class AIHTTPTimeoutPolicy;
|
||||
extern AIHTTPTimeoutPolicy homeLocationResponder_timeout;
|
||||
|
||||
/* Typedef, Enum, Class, Struct, etc. */
|
||||
class LLHomeLocationResponder : public LLHTTPClient::Responder
|
||||
class LLHomeLocationResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
virtual void result( const LLSD& content );
|
||||
virtual void error( U32 status, const std::string& reason );
|
||||
|
||||
@@ -301,7 +301,7 @@ bool send_start_session_messages(
|
||||
return false;
|
||||
}
|
||||
|
||||
class LLVoiceCallCapResponder : public LLHTTPClient::Responder
|
||||
class LLVoiceCallCapResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLVoiceCallCapResponder(const LLUUID& session_id) : mSessionID(session_id) {};
|
||||
|
||||
@@ -95,7 +95,7 @@ LLIMMgr* gIMMgr = NULL;
|
||||
// return (LLStringUtil::compareDict( a->mName, b->mName ) < 0);
|
||||
//}
|
||||
class LLViewerChatterBoxInvitationAcceptResponder :
|
||||
public LLHTTPClient::Responder
|
||||
public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLViewerChatterBoxInvitationAcceptResponder(
|
||||
|
||||
@@ -470,7 +470,7 @@ LLUUID LLInventoryModel::findCategoryByName(std::string name)
|
||||
return LLUUID::null;
|
||||
}
|
||||
|
||||
class LLCreateInventoryCategoryResponder : public LLHTTPClient::Responder
|
||||
class LLCreateInventoryCategoryResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLCreateInventoryCategoryResponder(LLInventoryModel* model,
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
typedef LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array_t;
|
||||
typedef std::set<LLUUID> changed_items_t;
|
||||
|
||||
class fetchInventoryResponder : public LLHTTPClient::Responder
|
||||
class fetchInventoryResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
fetchInventoryResponder(const LLSD& request_sd) : mRequestSD(request_sd) {};
|
||||
|
||||
@@ -393,7 +393,7 @@ void LLInventoryModelFetchItemResponder::error( U32 status, const std::string& r
|
||||
LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1);
|
||||
}
|
||||
|
||||
class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::Responder
|
||||
class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd, uuid_vec_t recursive_cats) :
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
class AIHTTPTimeoutPolicy;
|
||||
extern AIHTTPTimeoutPolicy mapLayerResponder_timeout;
|
||||
|
||||
class LLMapLayerResponder : public LLHTTPClient::Responder
|
||||
class LLMapLayerResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
virtual void result(const LLSD& content);
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return mapLayerResponder_timeout; }
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
#include "llinventorymodel.h"
|
||||
#include "llfoldertype.h"
|
||||
#include "llviewerparcelmgr.h"
|
||||
#include "aicurl.h"
|
||||
|
||||
#include "boost/lexical_cast.hpp"
|
||||
#ifndef LL_WINDOWS
|
||||
@@ -209,7 +210,7 @@ S32 LLMeshRepoThread::sActiveHeaderRequests = 0;
|
||||
S32 LLMeshRepoThread::sActiveLODRequests = 0;
|
||||
U32 LLMeshRepoThread::sMaxConcurrentRequests = 1;
|
||||
|
||||
class LLMeshHeaderResponder : public LLCurl::ResponderWithCompleted
|
||||
class LLMeshHeaderResponder : public LLHTTPClient::ResponderWithCompleted
|
||||
{
|
||||
public:
|
||||
LLVolumeParams mMeshParams;
|
||||
@@ -232,7 +233,7 @@ public:
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshHeaderResponder_timeout; }
|
||||
};
|
||||
|
||||
class LLMeshLODResponder : public LLCurl::ResponderWithCompleted
|
||||
class LLMeshLODResponder : public LLHTTPClient::ResponderWithCompleted
|
||||
{
|
||||
public:
|
||||
LLVolumeParams mMeshParams;
|
||||
@@ -258,7 +259,7 @@ public:
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshLODResponder_timeout; }
|
||||
};
|
||||
|
||||
class LLMeshSkinInfoResponder : public LLCurl::ResponderWithCompleted
|
||||
class LLMeshSkinInfoResponder : public LLHTTPClient::ResponderWithCompleted
|
||||
{
|
||||
public:
|
||||
LLUUID mMeshID;
|
||||
@@ -277,7 +278,7 @@ public:
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshSkinInfoResponder_timeout; }
|
||||
};
|
||||
|
||||
class LLMeshDecompositionResponder : public LLCurl::ResponderWithCompleted
|
||||
class LLMeshDecompositionResponder : public LLHTTPClient::ResponderWithCompleted
|
||||
{
|
||||
public:
|
||||
LLUUID mMeshID;
|
||||
@@ -296,7 +297,7 @@ public:
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshDecompositionResponder_timeout; }
|
||||
};
|
||||
|
||||
class LLMeshPhysicsShapeResponder : public LLCurl::ResponderWithCompleted
|
||||
class LLMeshPhysicsShapeResponder : public LLHTTPClient::ResponderWithCompleted
|
||||
{
|
||||
public:
|
||||
LLUUID mMeshID;
|
||||
@@ -365,7 +366,7 @@ void log_upload_error(S32 status, const LLSD& content, std::string stage, std::s
|
||||
}
|
||||
}
|
||||
|
||||
class LLWholeModelFeeResponder: public LLCurl::ResponderWithCompleted
|
||||
class LLWholeModelFeeResponder: public LLHTTPClient::ResponderWithCompleted
|
||||
{
|
||||
LLMeshUploadThread* mThread;
|
||||
LLSD mModelData;
|
||||
@@ -419,7 +420,7 @@ public:
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return wholeModelFeeResponder_timeout; }
|
||||
};
|
||||
|
||||
class LLWholeModelUploadResponder: public LLCurl::ResponderWithCompleted
|
||||
class LLWholeModelUploadResponder: public LLHTTPClient::ResponderWithCompleted
|
||||
{
|
||||
LLMeshUploadThread* mThread;
|
||||
LLSD mModelData;
|
||||
|
||||
@@ -684,7 +684,7 @@ void LLPanelGroupVoting::handleFailure(
|
||||
}
|
||||
}
|
||||
|
||||
class LLStartGroupVoteResponder : public LLHTTPClient::Responder
|
||||
class LLStartGroupVoteResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLStartGroupVoteResponder(const LLUUID& group_id)
|
||||
@@ -717,7 +717,7 @@ private:
|
||||
LLUUID mGroupID;
|
||||
};
|
||||
|
||||
class LLGroupProposalBallotResponder : public LLHTTPClient::Responder
|
||||
class LLGroupProposalBallotResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLGroupProposalBallotResponder(const LLUUID& group_id)
|
||||
|
||||
@@ -168,7 +168,7 @@ std::string gFullName;
|
||||
|
||||
// helper class that trys to download a URL from a web site and calls a method
|
||||
// on parent class indicating if the web server is working or not
|
||||
class LLIamHereLogin : public AICurlInterface::ResponderWithCompleted
|
||||
class LLIamHereLogin : public LLHTTPClient::ResponderWithCompleted
|
||||
{
|
||||
private:
|
||||
LLIamHereLogin( LLPanelLogin* parent ) :
|
||||
|
||||
@@ -110,7 +110,7 @@ LLHTTPRegistration<LLAgentStateChangeNode> gHTTPRegistrationAgentStateChangeNode
|
||||
// NavMeshStatusResponder
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class NavMeshStatusResponder : public LLHTTPClient::Responder
|
||||
class NavMeshStatusResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion, bool pIsGetStatusOnly);
|
||||
@@ -133,7 +133,7 @@ private:
|
||||
// NavMeshResponder
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class NavMeshResponder : public LLHTTPClient::Responder
|
||||
class NavMeshResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
NavMeshResponder(const std::string &pCapabilityURL, U32 pNavMeshVersion, LLPathfindingNavMeshPtr pNavMeshPtr);
|
||||
@@ -155,7 +155,7 @@ private:
|
||||
// AgentStateResponder
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class AgentStateResponder : public LLHTTPClient::Responder
|
||||
class AgentStateResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
AgentStateResponder(const std::string &pCapabilityURL);
|
||||
@@ -175,7 +175,7 @@ private:
|
||||
//---------------------------------------------------------------------------
|
||||
// NavMeshRebakeResponder
|
||||
//---------------------------------------------------------------------------
|
||||
class NavMeshRebakeResponder : public LLHTTPClient::Responder
|
||||
class NavMeshRebakeResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
NavMeshRebakeResponder(const std::string &pCapabilityURL, LLPathfindingManager::rebake_navmesh_callback_t pRebakeNavMeshCallback);
|
||||
@@ -235,7 +235,7 @@ typedef boost::shared_ptr<LinksetsResponder> LinksetsResponderPtr;
|
||||
//---------------------------------------------------------------------------
|
||||
// ObjectLinksetsResponder
|
||||
//---------------------------------------------------------------------------
|
||||
class ObjectLinksetsResponder : public LLHTTPClient::Responder
|
||||
class ObjectLinksetsResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
ObjectLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr);
|
||||
@@ -255,7 +255,7 @@ private:
|
||||
//---------------------------------------------------------------------------
|
||||
// TerrainLinksetsResponder
|
||||
//---------------------------------------------------------------------------
|
||||
class TerrainLinksetsResponder : public LLHTTPClient::Responder
|
||||
class TerrainLinksetsResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
TerrainLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr);
|
||||
@@ -275,7 +275,7 @@ private:
|
||||
//---------------------------------------------------------------------------
|
||||
// CharactersResponder
|
||||
//---------------------------------------------------------------------------
|
||||
class CharactersResponder : public LLHTTPClient::Responder
|
||||
class CharactersResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
CharactersResponder(const std::string &pCapabilityURL, LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::object_request_callback_t pCharactersCallback);
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
class AIHTTPTimeoutPolicy;
|
||||
extern AIHTTPTimeoutPolicy productInfoRequestResponder_timeout;
|
||||
|
||||
class LLProductInfoRequestResponder : public LLHTTPClient::Responder
|
||||
class LLProductInfoRequestResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
//If we get back a normal response, handle it here
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
class AIHTTPTimeoutPolicy;
|
||||
extern AIHTTPTimeoutPolicy remoteParcelRequestResponder_timeout;
|
||||
|
||||
class LLRemoteParcelRequestResponder : public LLHTTPClient::Responder
|
||||
class LLRemoteParcelRequestResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLRemoteParcelRequestResponder(LLHandle<LLPanel> place_panel_handle);
|
||||
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
// void relese() { --mActiveCount; }
|
||||
|
||||
S32 callbackHttpGet(const LLChannelDescriptors& channels,
|
||||
const LLHTTPClient::Responder::buffer_ptr_t& buffer,
|
||||
const LLHTTPClient::ResponderBase::buffer_ptr_t& buffer,
|
||||
bool partial, bool success);
|
||||
void callbackCacheRead(bool success, LLImageFormatted* image,
|
||||
S32 imagesize, BOOL islocal);
|
||||
@@ -292,7 +292,7 @@ private:
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
class HTTPGetResponder : public AICurlInterface::ResponderWithCompleted
|
||||
class HTTPGetResponder : public LLHTTPClient::ResponderWithCompleted
|
||||
{
|
||||
LOG_CLASS(HTTPGetResponder);
|
||||
public:
|
||||
@@ -1811,7 +1811,7 @@ bool LLTextureFetchWorker::processSimulatorPackets()
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
S32 LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels,
|
||||
const LLHTTPClient::Responder::buffer_ptr_t& buffer,
|
||||
const LLHTTPClient::ResponderBase::buffer_ptr_t& buffer,
|
||||
bool partial, bool success)
|
||||
{
|
||||
S32 data_size = 0 ;
|
||||
@@ -3016,7 +3016,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
|
||||
* refactoring of the LLQueuedThread usage, these POSTs
|
||||
* could be put in a request object and made more reliable.
|
||||
*/
|
||||
class lcl_responder : public LLCurl::Responder
|
||||
class lcl_responder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
lcl_responder(LLTextureFetch * fetcher,
|
||||
|
||||
@@ -43,7 +43,7 @@ extern AIHTTPTimeoutPolicy translationReceiver_timeout;
|
||||
class LLTranslate
|
||||
{
|
||||
public :
|
||||
class TranslationReceiver: public LLHTTPClient::Responder
|
||||
class TranslationReceiver: public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
protected:
|
||||
TranslationReceiver(const std::string &fromLang, const std::string &toLang)
|
||||
|
||||
@@ -98,7 +98,7 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
class LLUploadModelPremissionsResponder : public LLHTTPClient::Responder
|
||||
class LLUploadModelPremissionsResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
bool mInitialized;
|
||||
};
|
||||
|
||||
class LLViewerMediaOpenIDResponder : public AICurlInterface::ResponderWithCompleted
|
||||
class LLViewerMediaOpenIDResponder : public LLHTTPClient::ResponderWithCompleted
|
||||
{
|
||||
LOG_CLASS(LLViewerMediaOpenIDResponder);
|
||||
public:
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return viewerMediaOpenIDResponder_timeout; }
|
||||
};
|
||||
|
||||
class LLViewerMediaWebProfileResponder : public AICurlInterface::ResponderWithCompleted
|
||||
class LLViewerMediaWebProfileResponder : public LLHTTPClient::ResponderWithCompleted
|
||||
{
|
||||
LOG_CLASS(LLViewerMediaWebProfileResponder);
|
||||
public:
|
||||
|
||||
@@ -3350,7 +3350,7 @@ void check_translate_chat(const std::string &mesg, LLChat &chat, const BOOL hist
|
||||
// defined in llchatbar.cpp, but not declared in any header
|
||||
void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel);
|
||||
|
||||
class AuthHandler : public AICurlInterface::ResponderWithCompleted
|
||||
class AuthHandler : public LLHTTPClient::ResponderWithCompleted
|
||||
{
|
||||
protected:
|
||||
/*virtual*/ void completedRaw(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
|
||||
|
||||
@@ -688,7 +688,7 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent)
|
||||
LLVOAvatar::cullAvatarsByPixelArea();
|
||||
}
|
||||
|
||||
class LLObjectCostResponder : public LLCurl::Responder
|
||||
class LLObjectCostResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLObjectCostResponder(const LLSD& object_ids)
|
||||
@@ -778,7 +778,7 @@ private:
|
||||
LLSD mObjectIDs;
|
||||
};
|
||||
|
||||
class LLPhysicsFlagsResponder : public LLCurl::Responder
|
||||
class LLPhysicsFlagsResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLPhysicsFlagsResponder(const LLSD& object_ids)
|
||||
|
||||
@@ -209,7 +209,7 @@ public:
|
||||
};
|
||||
LLRegionHandler gRegionHandler;
|
||||
|
||||
class BaseCapabilitiesComplete : public LLHTTPClient::Responder
|
||||
class BaseCapabilitiesComplete : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
LOG_CLASS(BaseCapabilitiesComplete);
|
||||
public:
|
||||
@@ -1711,7 +1711,7 @@ void LLViewerRegion::failedSeedCapability()
|
||||
}
|
||||
}
|
||||
|
||||
class SimulatorFeaturesReceived : public LLHTTPClient::Responder
|
||||
class SimulatorFeaturesReceived : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
LOG_CLASS(SimulatorFeaturesReceived);
|
||||
public:
|
||||
|
||||
@@ -697,7 +697,7 @@ void update_statistics(U32 frame_count)
|
||||
}
|
||||
}
|
||||
|
||||
class ViewerStatsResponder : public LLHTTPClient::Responder
|
||||
class ViewerStatsResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
ViewerStatsResponder() { }
|
||||
|
||||
@@ -144,7 +144,7 @@ static int scale_speaker_volume(float volume)
|
||||
}
|
||||
|
||||
class LLViewerVoiceAccountProvisionResponder :
|
||||
public LLHTTPClient::Responder
|
||||
public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLViewerVoiceAccountProvisionResponder(int retries)
|
||||
@@ -1014,7 +1014,7 @@ static bool sMuteListListener_listening = false;
|
||||
static LLVoiceClientFriendsObserver *friendslist_listener = NULL;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class LLVoiceClientCapResponder : public LLHTTPClient::Responder
|
||||
class LLVoiceClientCapResponder : public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
public:
|
||||
LLVoiceClientCapResponder(void){};
|
||||
|
||||
@@ -52,7 +52,7 @@ private:
|
||||
static bool doRequest();
|
||||
};
|
||||
|
||||
class LLEnvironmentRequestResponder: public LLHTTPClient::Responder
|
||||
class LLEnvironmentRequestResponder: public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
LOG_CLASS(LLEnvironmentRequestResponder);
|
||||
public:
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
static clock_t UPDATE_WAIT_SECONDS;
|
||||
};
|
||||
|
||||
class LLEnvironmentApplyResponder: public LLHTTPClient::Responder
|
||||
class LLEnvironmentApplyResponder: public LLHTTPClient::ResponderWithResult
|
||||
{
|
||||
LOG_CLASS(LLEnvironmentApplyResponder);
|
||||
public:
|
||||
|
||||
@@ -156,14 +156,14 @@ XMLRPC_VALUE LLXMLRPCValue::getValue() const
|
||||
return mV;
|
||||
}
|
||||
|
||||
void XMLRPCResponder::completed_headers(U32 status, std::string const& reason, CURLcode code, AICurlInterface::TransferInfo* info)
|
||||
void XMLRPCResponder::completed_headers(U32 status, std::string const& reason, AITransferInfo* info)
|
||||
{
|
||||
if (info)
|
||||
{
|
||||
mTransferInfo = *info;
|
||||
}
|
||||
// Call base class implementation.
|
||||
LegacyPolledResponder::completed_headers(status, reason, code, info);
|
||||
LegacyPolledResponder::completed_headers(status, reason, info);
|
||||
}
|
||||
|
||||
void XMLRPCResponder::completedRaw(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer)
|
||||
|
||||
@@ -91,9 +91,9 @@ private:
|
||||
XMLRPC_VALUE mV;
|
||||
};
|
||||
|
||||
class XMLRPCResponder : public AICurlInterface::LegacyPolledResponder {
|
||||
class XMLRPCResponder : public LLHTTPClient::LegacyPolledResponder {
|
||||
private:
|
||||
AICurlInterface::TransferInfo mTransferInfo;
|
||||
AITransferInfo mTransferInfo;
|
||||
S32 mBufferSize;
|
||||
bool mReceivedHTTPHeader;
|
||||
XMLRPC_REQUEST mResponse;
|
||||
@@ -105,8 +105,8 @@ public:
|
||||
XMLRPC_REQUEST response(void) const { return mResponse; }
|
||||
LLXMLRPCValue responseValue(void) const;
|
||||
|
||||
/*virtual*/ void received_HTTP_header(void) { mReceivedHTTPHeader = true; LLCurl::ResponderBase::received_HTTP_header(); }
|
||||
/*virtual*/ void completed_headers(U32 status, std::string const& reason, CURLcode code, AICurlInterface::TransferInfo* info);
|
||||
/*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);
|
||||
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return XMLRPCResponder_timeout; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user