Support for new LL Responder API.
This adds mStatus, mReason and mContent to ResponderBase and fills those in instead of passing it to member functions. The added danger here is that now code can accidently try to access these variables while they didn't already get a correct value. Affected members of ResponderBase (that now have less arguments): decode_llsd_body, decode_raw_body, completedHeaders, completed -> httpCompleted, result -> httpSuccess, errorWithContent and error -> httpFailure. New API: ResponderBase::setResult ResponderBase::getStatus() ResponderBase::getReason() ResponderBase::getContent() ResponderBase::getResponseHeaders() (returns AIHTTPReceivedHeaders though, not LLSD) ResponderBase::dumpResponse() ResponderWithCompleted::completeResult ResponderWithResult::failureResult (previously pubErrorWithContent) ResponderWithResult::successResult (previously pubResult) Not implemented: getHTTPMethod() - use getName() instead which returns the class name of the responder. completedHeaders() is still called as usual, although you can ignore it (not implement in a derived responder) and call getResponseHeaders() instead, provided you implement needsHeaders() and have it return true. However, classes derived from ResponderHeadersOnly do not have completedHeaders(), so they still must implement completedHeaders(), and then call getResponseHeaders() or just access mReceivedHeaders directly, as usual.
This commit is contained in:
@@ -293,11 +293,11 @@ LLUserAuth::UserAuthcode LLUserAuth::authResponse()
|
||||
}
|
||||
|
||||
mLastTransferRateBPS = mResponder->transferRate();
|
||||
mErrorMessage = mResponder->reason();
|
||||
mErrorMessage = mResponder->getReason();
|
||||
|
||||
// if curl was ok, parse the download area.
|
||||
CURLcode result = mResponder->result_code();
|
||||
if (is_internal_http_error(mResponder->http_status()))
|
||||
if (is_internal_http_error(mResponder->getStatus()))
|
||||
{
|
||||
// result can be a meaningless CURLE_OK in the case of an internal error.
|
||||
result = CURLE_FAILED_INIT; // Just some random error to get the default case below.
|
||||
@@ -342,7 +342,7 @@ LLUserAuth::UserAuthcode LLUserAuth::parseResponse()
|
||||
XMLRPC_REQUEST response = mResponder->response();
|
||||
if(!response)
|
||||
{
|
||||
U32 status = mResponder->http_status();
|
||||
U32 status = mResponder->getStatus();
|
||||
// Is it an HTTP error?
|
||||
if (!(200 <= status && status < 400))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user