Ejemplo n.º 1
0
// stubs:
void LLHTTPClient::post(
    const std::string& url,
    const LLSD& body,
    LLHTTPClient::ResponderPtr responder,
    const LLSD& headers,
    const F32 timeout)
{
    LLSD record;
    record["url"] = url;
    record["body"] = body;
    record["headers"] = headers;
    record["timeout"] = timeout;
    gPostRecords->append(record);

    // Magic URL that triggers a 503:
    LLSD result;
    result[LLTextureEntry::OBJECT_ID_KEY] = body[LLTextureEntry::OBJECT_ID_KEY];
    if ( url == FAKE_OBJECT_MEDIA_CAP_URL_503 )
    {
        LLSD content;
        content["reason"] = "fake reason";
        responder->failureResult(HTTP_SERVICE_UNAVAILABLE, "fake reason", content);
        return;
    }
    else if (url == FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL_ERROR)
    {
        LLSD error;
        error["code"] = LLObjectMediaNavigateClient::ERROR_PERMISSION_DENIED_CODE;
        result["error"] = error;
    }
    responder->successResult(result);
}
Ejemplo n.º 2
0
// This might throw AICurlNoEasyHandle.
LLURLRequest::LLURLRequest(LLURLRequest::ERequestAction action, std::string const& url, Injector* body,
	LLHTTPClient::ResponderPtr responder, AIHTTPHeaders& headers, bool keepalive, bool is_auth, bool compression) :
    mAction(action), mURL(url), mKeepAlive(keepalive), mIsAuth(is_auth), mNoCompression(!compression),
	mBody(body), mResponder(responder), mHeaders(headers), mResponderNameCache(responder ? responder->getName() : "<uninitialized>")
{
}
// This might throw AICurlNoEasyHandle.
LLURLRequest::LLURLRequest(LLURLRequest::ERequestAction action, std::string const& url, Injector* body,
	LLHTTPClient::ResponderPtr responder, AIHTTPHeaders& headers, AIPerService::Approvement* approved,
	bool keepalive, bool is_auth, bool compression) :
    mAction(action), mURL(url), mKeepAlive(keepalive), mIsAuth(is_auth), mNoCompression(!compression),
	mBody(body), mResponder(responder), mHeaders(headers), mResponderNameCache(std::string("LLURLRequest:") + std::string(responder ? responder->getName() : "<uninitialized>"))
{
	if (approved)
	{
		AICurlEasyRequest_wat(*mCurlEasyRequest)->setApproved(approved);
	}
}