Code clean up.
* Removed LLCurlRequest and replaced it's last usage with LLHTTPClient API calls. * Deleted dead code. * Renamed all the get4/post4/put4/getByteRange4 etc, back to their original name without the '4'.
This commit is contained in:
@@ -320,7 +320,7 @@ bool LLCrashLogger::runCrashLogPost(std::string host, LLSD data, std::string msg
|
||||
for(int i = 0; i < retries; ++i)
|
||||
{
|
||||
status_message = llformat("%s, try %d...", msg.c_str(), i+1);
|
||||
LLHTTPClient::post4(host, data, new LLCrashLoggerResponder);
|
||||
LLHTTPClient::post(host, data, new LLCrashLoggerResponder);
|
||||
while(!gBreak)
|
||||
{
|
||||
updateApplication(status_message);
|
||||
|
||||
@@ -36,7 +36,6 @@ set(llmessage_SOURCE_FILES
|
||||
llchainio.cpp
|
||||
llcircuit.cpp
|
||||
llclassifiedflags.cpp
|
||||
llcurlrequest.cpp
|
||||
lldatapacker.cpp
|
||||
lldispatcher.cpp
|
||||
llfiltersd2xmlrpc.cpp
|
||||
@@ -123,7 +122,6 @@ set(llmessage_HEADER_FILES
|
||||
llcircuit.h
|
||||
llclassifiedflags.h
|
||||
llcurl.h
|
||||
llcurlrequest.h
|
||||
lldatapacker.h
|
||||
lldbstrings.h
|
||||
lldispatcher.h
|
||||
|
||||
@@ -385,7 +385,7 @@ void LLAvatarNameCache::requestNamesViaCapability()
|
||||
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::requestNamesViaCapability first "
|
||||
<< ids << " ids"
|
||||
<< LL_ENDL;
|
||||
LLHTTPClient::get4(url, new LLAvatarNameResponder(agent_ids));
|
||||
LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids));
|
||||
url.clear();
|
||||
agent_ids.clear();
|
||||
}
|
||||
@@ -396,7 +396,7 @@ void LLAvatarNameCache::requestNamesViaCapability()
|
||||
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::requestNamesViaCapability all "
|
||||
<< ids << " ids"
|
||||
<< LL_ENDL;
|
||||
LLHTTPClient::get4(url, new LLAvatarNameResponder(agent_ids));
|
||||
LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids));
|
||||
url.clear();
|
||||
agent_ids.clear();
|
||||
}
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
/**
|
||||
* @file llcurlrequest.cpp
|
||||
* @brief Implementation of Request.
|
||||
*
|
||||
* Copyright (c) 2012, Aleric Inglewood.
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution.
|
||||
*
|
||||
* CHANGELOG
|
||||
* and additional copyright holders.
|
||||
*
|
||||
* 17/03/2012
|
||||
* Initial version, written by Aleric Inglewood @ SL
|
||||
*
|
||||
* 20/03/2012
|
||||
* Added copyright notice for Linden Lab for those parts that were
|
||||
* copied or derived from llcurl.cpp. The code of those parts are
|
||||
* already in their own llcurl.cpp, so they do not ever need to
|
||||
* even look at this file; the reason I added the copyright notice
|
||||
* is to make clear that I am not the author of 100% of this code
|
||||
* and hence I cannot change the license of it.
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llsdserialize.h"
|
||||
#include "llcurlrequest.h"
|
||||
#include "llbufferstream.h"
|
||||
#include "aicurleasyrequeststatemachine.h"
|
||||
#include "aihttpheaders.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// class Request
|
||||
//
|
||||
|
||||
namespace AICurlInterface {
|
||||
|
||||
bool Request::get2(std::string const& url, ResponderPtr responder)
|
||||
{
|
||||
AIHTTPHeaders empty_headers;
|
||||
return getByteRange2(url, empty_headers, 0, -1, responder);
|
||||
}
|
||||
|
||||
bool Request::getByteRange2(std::string const& url, AIHTTPHeaders const& headers, S32 offset, S32 length, ResponderPtr responder)
|
||||
{
|
||||
DoutEntering(dc::curl, "Request::getByteRange(" << url << ", ...)");
|
||||
|
||||
// This might throw AICurlNoEasyHandle.
|
||||
AICurlEasyRequestStateMachine* buffered_easy_request = new AICurlEasyRequestStateMachine(true);
|
||||
|
||||
{
|
||||
AICurlEasyRequest_wat buffered_easy_request_w(*buffered_easy_request->mCurlEasyRequest);
|
||||
|
||||
AICurlResponderBuffer_wat(*buffered_easy_request->mCurlEasyRequest)->prepRequest(buffered_easy_request_w, headers, responder);
|
||||
|
||||
buffered_easy_request_w->setopt(CURLOPT_HTTPGET, 1);
|
||||
if (length > 0)
|
||||
{
|
||||
std::string range = llformat("Range: bytes=%d-%d", offset, offset + length - 1);
|
||||
buffered_easy_request_w->addHeader(range.c_str());
|
||||
}
|
||||
|
||||
buffered_easy_request_w->finalizeRequest(url, responder->getHTTPTimeoutPolicy(), buffered_easy_request);
|
||||
}
|
||||
|
||||
buffered_easy_request->run();
|
||||
|
||||
return true; // We throw in case of problems.
|
||||
}
|
||||
|
||||
bool Request::post2(std::string const& url, AIHTTPHeaders const& headers, std::string const& data, ResponderPtr responder)
|
||||
{
|
||||
DoutEntering(dc::curl, "Request::post(" << url << ", ...)");
|
||||
|
||||
// This might throw AICurlNoEasyHandle.
|
||||
AICurlEasyRequestStateMachine* buffered_easy_request = new AICurlEasyRequestStateMachine(true);
|
||||
|
||||
{
|
||||
AICurlEasyRequest_wat buffered_easy_request_w(*buffered_easy_request->mCurlEasyRequest);
|
||||
AICurlResponderBuffer_wat buffer_w(*buffered_easy_request->mCurlEasyRequest);
|
||||
|
||||
buffer_w->prepRequest(buffered_easy_request_w, headers, responder);
|
||||
|
||||
U32 bytes = data.size();
|
||||
bool success = buffer_w->getInput()->append(buffer_w->sChannels.out(), (U8 const*)data.data(), bytes);
|
||||
if (!success)
|
||||
{
|
||||
buffered_easy_request->kill();
|
||||
throw AICurlNoBody("LLBufferArray::copyIntoBuffers() returned false");
|
||||
}
|
||||
buffered_easy_request_w->setPost(bytes);
|
||||
buffered_easy_request_w->addHeader("Content-Type: application/octet-stream");
|
||||
buffered_easy_request_w->finalizeRequest(url, responder->getHTTPTimeoutPolicy(), buffered_easy_request);
|
||||
}
|
||||
|
||||
buffered_easy_request->run();
|
||||
|
||||
return true; // We throw in case of problems.
|
||||
}
|
||||
|
||||
bool Request::post3(std::string const& url, AIHTTPHeaders const& headers, LLSD const& data, ResponderPtr responder)
|
||||
{
|
||||
DoutEntering(dc::curl, "Request::post(" << url << ", ...)");
|
||||
|
||||
// This might throw AICurlNoEasyHandle.
|
||||
AICurlEasyRequestStateMachine* buffered_easy_request = new AICurlEasyRequestStateMachine(true);
|
||||
|
||||
{
|
||||
AICurlEasyRequest_wat buffered_easy_request_w(*buffered_easy_request->mCurlEasyRequest);
|
||||
AICurlResponderBuffer_wat buffer_w(*buffered_easy_request->mCurlEasyRequest);
|
||||
|
||||
buffer_w->prepRequest(buffered_easy_request_w, headers, responder);
|
||||
|
||||
LLBufferStream buffer_stream(buffer_w->sChannels, buffer_w->getInput().get());
|
||||
LLSDSerialize::toXML(data, buffer_stream);
|
||||
// Need to flush the LLBufferStream or countAfter() returns more than the written data.
|
||||
buffer_stream << std::flush;
|
||||
S32 bytes = buffer_w->getInput()->countAfter(buffer_w->sChannels.out(), NULL);
|
||||
buffered_easy_request_w->setPost(bytes);
|
||||
buffered_easy_request_w->addHeader("Content-Type: application/llsd+xml");
|
||||
buffered_easy_request_w->finalizeRequest(url, responder->getHTTPTimeoutPolicy(), buffered_easy_request);
|
||||
|
||||
lldebugs << "POSTING: " << bytes << " bytes." << llendl;
|
||||
}
|
||||
|
||||
buffered_easy_request->run();
|
||||
|
||||
return true; // We throw in case of problems.
|
||||
}
|
||||
|
||||
} // namespace AICurlInterface
|
||||
//==================================================================================
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/**
|
||||
* @file llcurlrequest.h
|
||||
* @brief Declaration of class Request
|
||||
*
|
||||
* Copyright (c) 2012, Aleric Inglewood.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution.
|
||||
*
|
||||
* CHANGELOG
|
||||
* and additional copyright holders.
|
||||
*
|
||||
* 17/03/2012
|
||||
* Initial version, written by Aleric Inglewood @ SL
|
||||
*/
|
||||
|
||||
#ifndef AICURLREQUEST_H
|
||||
#define AICURLREQUEST_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
|
||||
class AIHTTPHeaders;
|
||||
|
||||
// Things defined in this namespace are called from elsewhere in the viewer code.
|
||||
namespace AICurlInterface {
|
||||
|
||||
// Forward declaration.
|
||||
class ResponderBase;
|
||||
typedef boost::intrusive_ptr<ResponderBase> ResponderPtr;
|
||||
|
||||
class Request {
|
||||
public:
|
||||
bool get2(std::string const& url, ResponderPtr responder);
|
||||
bool getByteRange2(std::string const& url, AIHTTPHeaders const& headers, S32 offset, S32 length, ResponderPtr responder);
|
||||
bool post2(std::string const& url, AIHTTPHeaders const& headers, std::string const& data, ResponderPtr responder);
|
||||
bool post3(std::string const& url, AIHTTPHeaders const& headers, LLSD const& data, ResponderPtr responder);
|
||||
};
|
||||
|
||||
} // namespace AICurlInterface
|
||||
|
||||
#endif
|
||||
@@ -221,7 +221,7 @@ static void request(
|
||||
req->run();
|
||||
}
|
||||
|
||||
void LLHTTPClient::getByteRange4(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
void LLHTTPClient::getByteRange(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
{
|
||||
if(offset > 0 || bytes > 0)
|
||||
{
|
||||
@@ -230,27 +230,27 @@ void LLHTTPClient::getByteRange4(std::string const& url, S32 offset, S32 bytes,
|
||||
request(url, LLURLRequest::HTTP_GET, NULL, responder, headers);
|
||||
}
|
||||
|
||||
void LLHTTPClient::head4(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
void LLHTTPClient::head(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
{
|
||||
request(url, LLURLRequest::HTTP_HEAD, NULL, responder, headers);
|
||||
}
|
||||
|
||||
void LLHTTPClient::get4(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
void LLHTTPClient::get(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
{
|
||||
request(url, LLURLRequest::HTTP_GET, NULL, responder, headers);
|
||||
}
|
||||
|
||||
void LLHTTPClient::getHeaderOnly4(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
void LLHTTPClient::getHeaderOnly(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
{
|
||||
request(url, LLURLRequest::HTTP_HEAD, NULL, responder, headers);
|
||||
}
|
||||
|
||||
void LLHTTPClient::get4(std::string const& url, LLSD const& query, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
void LLHTTPClient::get(std::string const& url, LLSD const& query, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
{
|
||||
LLURI uri;
|
||||
|
||||
uri = LLURI::buildHTTP(url, LLSD::emptyArray(), query);
|
||||
get4(uri.asString(), responder, headers);
|
||||
get(uri.asString(), responder, headers);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@@ -385,17 +385,17 @@ static LLSD blocking_request(
|
||||
if (method == HTTP_LLSD_POST)
|
||||
{
|
||||
responder = new BlockingLLSDPostResponder;
|
||||
LLHTTPClient::post4(url, body, responder, headers);
|
||||
LLHTTPClient::post(url, body, responder, headers);
|
||||
}
|
||||
else if (method == HTTP_LLSD_GET)
|
||||
{
|
||||
responder = new BlockingLLSDGetResponder;
|
||||
LLHTTPClient::get4(url, responder, headers);
|
||||
LLHTTPClient::get(url, responder, headers);
|
||||
}
|
||||
else // method == HTTP_RAW_GET
|
||||
{
|
||||
responder = new BlockingRawGetResponder;
|
||||
LLHTTPClient::get4(url, responder, headers);
|
||||
LLHTTPClient::get(url, responder, headers);
|
||||
}
|
||||
|
||||
responder->wait();
|
||||
@@ -474,12 +474,12 @@ U32 LLHTTPClient::blockingGetRaw(const std::string& url, std::string& body)
|
||||
return result["status"].asInteger();
|
||||
}
|
||||
|
||||
void LLHTTPClient::put4(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
void LLHTTPClient::put(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
{
|
||||
request(url, LLURLRequest::HTTP_PUT, new LLSDInjector(body), responder, headers);
|
||||
}
|
||||
|
||||
void LLHTTPClient::post4(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
void LLHTTPClient::post(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
{
|
||||
request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, headers);
|
||||
}
|
||||
@@ -500,29 +500,29 @@ void LLHTTPClient::postXMLRPC(std::string const& url, char const* method, XMLRPC
|
||||
request(url, LLURLRequest::HTTP_POST, new XMLRPCInjector(xmlrpc_request), responder, headers, true, true); // Does not use compression.
|
||||
}
|
||||
|
||||
void LLHTTPClient::postRaw4(std::string const& url, char const* data, S32 size, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
void LLHTTPClient::postRaw(std::string const& url, char const* data, S32 size, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
{
|
||||
request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, headers);
|
||||
}
|
||||
|
||||
void LLHTTPClient::postFile4(std::string const& url, std::string const& filename, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
void LLHTTPClient::postFile(std::string const& url, std::string const& filename, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
{
|
||||
request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, headers);
|
||||
}
|
||||
|
||||
void LLHTTPClient::postFile4(std::string const& url, LLUUID const& uuid, LLAssetType::EType asset_type, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
void LLHTTPClient::postFile(std::string const& url, LLUUID const& uuid, LLAssetType::EType asset_type, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
{
|
||||
request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, headers);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLHTTPClient::del4(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
void LLHTTPClient::del(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
{
|
||||
request(url, LLURLRequest::HTTP_DELETE, NULL, responder, headers);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLHTTPClient::move4(std::string const& url, std::string const& destination, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
void LLHTTPClient::move(std::string const& url, std::string const& destination, ResponderPtr responder, AIHTTPHeaders& headers)
|
||||
{
|
||||
headers.addHeader("Destination", destination);
|
||||
request(url, LLURLRequest::HTTP_MOVE, NULL, responder, headers);
|
||||
|
||||
@@ -58,33 +58,33 @@ public:
|
||||
|
||||
/** @name non-blocking API */
|
||||
//@{
|
||||
static void head4(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void head4(std::string const& url, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; head4(url, responder, headers); }
|
||||
static void head(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void head(std::string const& url, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; head(url, responder, headers); }
|
||||
|
||||
static void getByteRange4(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void getByteRange4(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; getByteRange4(url, offset, bytes, responder, headers); }
|
||||
static void getByteRange(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void getByteRange(std::string const& url, S32 offset, S32 bytes, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; getByteRange(url, offset, bytes, responder, headers); }
|
||||
|
||||
static void get4(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void get4(std::string const& url, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; get4(url, responder, headers); }
|
||||
static void get(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void get(std::string const& url, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; get(url, responder, headers); }
|
||||
|
||||
static void get4(std::string const& url, LLSD const& query, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void get4(std::string const& url, LLSD const& query, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; get4(url, query, responder, headers); }
|
||||
static void get(std::string const& url, LLSD const& query, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void get(std::string const& url, LLSD const& query, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; get(url, query, responder, headers); }
|
||||
|
||||
static void put4(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void put4(std::string const& url, LLSD const& body, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; put4(url, body, responder, headers); }
|
||||
static void put(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void put(std::string const& url, LLSD const& body, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; put(url, body, responder, headers); }
|
||||
|
||||
static void getHeaderOnly4(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void getHeaderOnly4(std::string const& url, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; getHeaderOnly4(url, responder, headers); }
|
||||
static void getHeaderOnly(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void getHeaderOnly(std::string const& url, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; getHeaderOnly(url, responder, headers); }
|
||||
|
||||
static void post4(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void post4(std::string const& url, LLSD const& body, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; post4(url, body, responder, headers); }
|
||||
static void post(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void post(std::string const& url, LLSD const& body, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; post(url, body, responder, headers); }
|
||||
|
||||
/** Takes ownership of request and deletes it when sent */
|
||||
static void postXMLRPC(std::string const& url, XMLRPC_REQUEST request, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
@@ -96,21 +96,21 @@ public:
|
||||
{ AIHTTPHeaders headers; postXMLRPC(url, method, value, responder, headers); }
|
||||
|
||||
/** Takes ownership of data and deletes it when sent */
|
||||
static void postRaw4(std::string const& url, const char* data, S32 size, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void postRaw4(std::string const& url, const char* data, S32 size, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; postRaw4(url, data, size, responder, headers); }
|
||||
static void postRaw(std::string const& url, const char* data, S32 size, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void postRaw(std::string const& url, const char* data, S32 size, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; postRaw(url, data, size, responder, headers); }
|
||||
|
||||
static void postFile4(std::string const& url, std::string const& filename, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void postFile4(std::string const& url, std::string const& filename, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; postFile4(url, filename, responder, headers); }
|
||||
static void postFile(std::string const& url, std::string const& filename, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void postFile(std::string const& url, std::string const& filename, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; postFile(url, filename, responder, headers); }
|
||||
|
||||
static void postFile4(std::string const& url, const LLUUID& uuid, LLAssetType::EType asset_type, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void postFile4(std::string const& url, const LLUUID& uuid, LLAssetType::EType asset_type, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; postFile4(url, uuid, asset_type, responder, headers); }
|
||||
static void postFile(std::string const& url, const LLUUID& uuid, LLAssetType::EType asset_type, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void postFile(std::string const& url, const LLUUID& uuid, LLAssetType::EType asset_type, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; postFile(url, uuid, asset_type, responder, headers); }
|
||||
|
||||
static void del4(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void del4(std::string const& url, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; del4(url, responder, headers); }
|
||||
static void del(std::string const& url, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void del(std::string const& url, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; del(url, responder, headers); }
|
||||
|
||||
///< sends a DELETE method, but we can't call it delete in c++
|
||||
|
||||
@@ -123,9 +123,9 @@ public:
|
||||
* @param headers A map of key:value headers to pass to the request
|
||||
* @param timeout The number of seconds to give the server to respond.
|
||||
*/
|
||||
static void move4(std::string const& url, std::string const& destination, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void move4(std::string const& url, std::string const& destination, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; move4(url, destination, responder, headers); }
|
||||
static void move(std::string const& url, std::string const& destination, ResponderPtr responder, AIHTTPHeaders& headers);
|
||||
static void move(std::string const& url, std::string const& destination, ResponderPtr responder)
|
||||
{ AIHTTPHeaders headers; move(url, destination, responder, headers); }
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
@@ -36,18 +36,18 @@ void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr respo
|
||||
// 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::get4(url, responder, empty_pragma_header);
|
||||
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::get4(url, responder, empty_pragma_header);
|
||||
LLHTTPClient::get(url, responder, empty_pragma_header);
|
||||
}
|
||||
|
||||
void LLHTTPClientAdapter::put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder)
|
||||
{
|
||||
LLHTTPClient::put4(url, body, responder);
|
||||
LLHTTPClient::put(url, body, responder);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ void LLHTTPSender::send(const LLHost& host, const std::string& name,
|
||||
std::ostringstream stream;
|
||||
stream << "http://" << host << "/trusted-message/" << name;
|
||||
llinfos << "LLHTTPSender::send: POST to " << stream.str() << llendl;
|
||||
LLHTTPClient::post4(stream.str(), body, response);
|
||||
LLHTTPClient::post(stream.str(), body, response);
|
||||
}
|
||||
|
||||
//static
|
||||
|
||||
@@ -83,7 +83,7 @@ bool LLSDMessage::httpListener(const LLSD& request)
|
||||
LLSDMessage::EventResponder* responder =
|
||||
new LLSDMessage::EventResponder(LLEventPumps::instance(), request, url, "POST", reply, error);
|
||||
responder->setTimeoutPolicy(timeoutpolicy);
|
||||
LLHTTPClient::post4(url, payload, responder);
|
||||
LLHTTPClient::post(url, payload, responder);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,43 +54,6 @@ static const U32 HTTP_STATUS_PIPE_ERROR = 499;
|
||||
*/
|
||||
const std::string CONTEXT_TRANSFERED_BYTES("transfered_bytes");
|
||||
|
||||
|
||||
//static size_t headerCallback(char* data, size_t size, size_t nmemb, void* user);
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* class LLURLRequestDetail
|
||||
*/
|
||||
class LLURLRequestDetail
|
||||
{
|
||||
public:
|
||||
LLURLRequestDetail();
|
||||
~LLURLRequestDetail();
|
||||
std::string mURL;
|
||||
AICurlEasyRequestStateMachine* mStateMachine;
|
||||
LLIOPipe::buffer_ptr_t mResponseBuffer;
|
||||
LLChannelDescriptors mChannels;
|
||||
U8* mLastRead;
|
||||
U32 mBodyLimit;
|
||||
S32 mByteAccumulator;
|
||||
bool mIsBodyLimitSet;
|
||||
};
|
||||
|
||||
LLURLRequestDetail::LLURLRequestDetail() :
|
||||
mStateMachine(new AICurlEasyRequestStateMachine(false)),
|
||||
mLastRead(NULL),
|
||||
mBodyLimit(0),
|
||||
mByteAccumulator(0),
|
||||
mIsBodyLimitSet(false)
|
||||
{
|
||||
}
|
||||
|
||||
LLURLRequestDetail::~LLURLRequestDetail()
|
||||
{
|
||||
mLastRead = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* class LLURLRequest
|
||||
*/
|
||||
@@ -186,39 +149,12 @@ void LLURLRequest::initialize_impl(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void LLURLRequest::setURL2(const std::string& url)
|
||||
{
|
||||
mDetail->mURL = url;
|
||||
}
|
||||
|
||||
std::string LLURLRequest::getURL2() const
|
||||
{
|
||||
return mDetail->mURL;
|
||||
}
|
||||
#endif
|
||||
|
||||
void LLURLRequest::addHeader(const char* header)
|
||||
{
|
||||
AICurlEasyRequest_wat curlEasyRequest_w(*mCurlEasyRequest);
|
||||
curlEasyRequest_w->addHeader(header);
|
||||
}
|
||||
|
||||
#ifdef AI_UNUSED
|
||||
void LLURLRequest::setBodyLimit(U32 size)
|
||||
{
|
||||
mDetail->mBodyLimit = size;
|
||||
mDetail->mIsBodyLimitSet = true;
|
||||
}
|
||||
|
||||
void LLURLRequest::setCallback(LLURLRequestComplete* callback)
|
||||
{
|
||||
mCompletionCallback = callback;
|
||||
AICurlEasyRequest_wat curlEasyRequest_w(*mCurlEasyRequest);
|
||||
curlEasyRequest_w->setHeaderCallback(&headerCallback, (void*)callback);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Added to mitigate the effect of libcurl looking
|
||||
// for the ALL_PROXY and http_proxy env variables
|
||||
// and deciding to insert a Pragma: no-cache
|
||||
@@ -270,226 +206,6 @@ void LLURLRequest::allowCookies()
|
||||
curlEasyRequest_w->setoptString(CURLOPT_COOKIEFILE, "");
|
||||
}
|
||||
|
||||
#ifdef AI_UNUSED // no longer derived from LLIOPipe
|
||||
//virtual
|
||||
bool LLURLRequest::hasExpiration(void) const
|
||||
{
|
||||
// Currently, this ALWAYS returns false -- because only AICurlEasyRequestStateMachine uses buffered
|
||||
// AICurlEasyRequest objects, and LLURLRequest uses (unbuffered) AICurlEasyRequest directly, which
|
||||
// have no expiration facility.
|
||||
return mDetail->mStateMachine->isBuffered();
|
||||
}
|
||||
|
||||
//virtual
|
||||
bool LLURLRequest::hasNotExpired(void) const
|
||||
{
|
||||
if (!mDetail->mStateMachine->isBuffered())
|
||||
return true;
|
||||
AICurlEasyRequest_wat buffered_easy_request_w(*mCurlEasyRequest);
|
||||
AICurlResponderBuffer_wat buffer_w(*mCurlEasyRequest);
|
||||
return buffer_w->isValid();
|
||||
}
|
||||
|
||||
// virtual
|
||||
LLIOPipe::EStatus LLURLRequest::handleError(
|
||||
LLIOPipe::EStatus status,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
DoutEntering(dc::curl, "LLURLRequest::handleError(" << LLIOPipe::lookupStatusString(status) << ", " << (void*)pump << ") [" << (void*)mCurlEasyRequest.get_ptr().get() << "]");
|
||||
|
||||
if (LL_LIKELY(!mDetail->mStateMachine->isBuffered())) // Currently always true.
|
||||
{
|
||||
// The last reference will be deleted when the pump that this chain belongs to
|
||||
// is removed from the running chains vector, upon returning from this function.
|
||||
// This keeps the CurlEasyRequest object alive until the curl thread cleanly removed it.
|
||||
Dout(dc::curl, "Calling mDetail->mStateMachine->removeRequest() [" << (void*)mCurlEasyRequest.get_ptr().get() << "]");
|
||||
mDetail->mStateMachine->removeRequest();
|
||||
}
|
||||
else if (!hasNotExpired())
|
||||
{
|
||||
// The buffered version has it's own time out handling, and that already expired,
|
||||
// so we can ignore the expiration of this timer (currently never happens).
|
||||
// I left it here because it's what LL did (in the form if (!isValid() ...),
|
||||
// and it would be relevant if this characteristic of mDetail->mStateMachine
|
||||
// would change. --Aleric
|
||||
return STATUS_EXPIRED ;
|
||||
}
|
||||
|
||||
if(mCompletionCallback && pump)
|
||||
{
|
||||
LLURLRequestComplete* complete = NULL;
|
||||
complete = (LLURLRequestComplete*)mCompletionCallback.get();
|
||||
complete->httpStatus(
|
||||
HTTP_STATUS_PIPE_ERROR,
|
||||
LLIOPipe::lookupStatusString(status));
|
||||
complete->responseStatus(status);
|
||||
pump->respond(complete);
|
||||
mCompletionCallback = NULL;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_URL_REQUEST("URL Request");
|
||||
|
||||
// virtual
|
||||
LLIOPipe::EStatus LLURLRequest::process_impl(
|
||||
const LLChannelDescriptors& channels,
|
||||
buffer_ptr_t& buffer,
|
||||
bool& eos,
|
||||
LLSD& context,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_URL_REQUEST);
|
||||
PUMP_DEBUG;
|
||||
//llinfos << "LLURLRequest::process_impl()" << llendl;
|
||||
if (!buffer) return STATUS_ERROR;
|
||||
|
||||
if (!mDetail) return STATUS_ERROR; //Seems to happen on occasion. Need to hunt down why.
|
||||
|
||||
// we're still waiting or processing, check how many
|
||||
// bytes we have accumulated.
|
||||
const S32 MIN_ACCUMULATION = 100000;
|
||||
if(pump && (mDetail->mByteAccumulator > MIN_ACCUMULATION))
|
||||
{
|
||||
static LLFastTimer::DeclareTimer FTM_URL_ADJUST_TIMEOUT("Adjust Timeout");
|
||||
LLFastTimer t(FTM_URL_ADJUST_TIMEOUT);
|
||||
// This is a pretty sloppy calculation, but this
|
||||
// tries to make the gross assumption that if data
|
||||
// is coming in at 56kb/s, then this transfer will
|
||||
// probably succeed. So, if we're accumlated
|
||||
// 100,000 bytes (MIN_ACCUMULATION) then let's
|
||||
// give this client another 2s to complete.
|
||||
const F32 TIMEOUT_ADJUSTMENT = 2.0f;
|
||||
mDetail->mByteAccumulator = 0;
|
||||
pump->adjustTimeoutSeconds(TIMEOUT_ADJUSTMENT);
|
||||
lldebugs << "LLURLRequest adjustTimeoutSeconds for request: " << mDetail->mURL << llendl;
|
||||
if (mState == STATE_INITIALIZED)
|
||||
{
|
||||
llinfos << "LLURLRequest adjustTimeoutSeconds called during upload" << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
switch(mState)
|
||||
{
|
||||
case STATE_INITIALIZED:
|
||||
{
|
||||
PUMP_DEBUG;
|
||||
// We only need to wait for input if we are uploading
|
||||
// something.
|
||||
if(((HTTP_PUT == mAction) || (HTTP_POST == mAction)) && !eos)
|
||||
{
|
||||
// we're waiting to get all of the information
|
||||
return STATUS_BREAK;
|
||||
}
|
||||
|
||||
// *FIX: bit of a hack, but it should work. The configure and
|
||||
// callback method expect this information to be ready.
|
||||
mDetail->mResponseBuffer = buffer;
|
||||
mDetail->mChannels = channels;
|
||||
if(!configure())
|
||||
{
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
mRemoved = false;
|
||||
mState = STATE_WAITING_FOR_RESPONSE;
|
||||
mDetail->mStateMachine->addRequest(); // Add easy handle to multi handle.
|
||||
|
||||
return STATUS_BREAK;
|
||||
}
|
||||
case STATE_WAITING_FOR_RESPONSE:
|
||||
case STATE_PROCESSING_RESPONSE:
|
||||
{
|
||||
if (!mRemoved) // Not removed from multi handle yet?
|
||||
{
|
||||
// Easy handle is still being processed.
|
||||
return STATUS_BREAK;
|
||||
}
|
||||
// Curl thread finished with this easy handle.
|
||||
mState = STATE_CURL_FINISHED;
|
||||
}
|
||||
case STATE_CURL_FINISHED:
|
||||
{
|
||||
PUMP_DEBUG;
|
||||
LLIOPipe::EStatus status = STATUS_NO_CONNECTION; // Catch-all failure code.
|
||||
|
||||
// Left braces in order not to change indentation.
|
||||
{
|
||||
CURLcode result;
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_URL_REQUEST_GET_RESULT("Get Result");
|
||||
|
||||
AICurlEasyRequest_wat(*mCurlEasyRequest)->getResult(&result);
|
||||
|
||||
mState = STATE_HAVE_RESPONSE;
|
||||
context[CONTEXT_REQUEST][CONTEXT_TRANSFERED_BYTES] = mRequestTransferedBytes;
|
||||
context[CONTEXT_RESPONSE][CONTEXT_TRANSFERED_BYTES] = mResponseTransferedBytes;
|
||||
lldebugs << this << "Setting context to " << context << llendl;
|
||||
switch(result)
|
||||
{
|
||||
case CURLE_OK:
|
||||
case CURLE_WRITE_ERROR:
|
||||
// NB: The error indication means that we stopped the
|
||||
// writing due the body limit being reached
|
||||
if(mCompletionCallback && pump)
|
||||
{
|
||||
LLURLRequestComplete* complete = NULL;
|
||||
complete = (LLURLRequestComplete*)
|
||||
mCompletionCallback.get();
|
||||
complete->responseStatus(
|
||||
result == CURLE_OK
|
||||
? STATUS_OK : STATUS_STOP);
|
||||
LLPumpIO::links_t chain;
|
||||
LLPumpIO::LLLinkInfo link;
|
||||
link.mPipe = mCompletionCallback;
|
||||
link.mChannels = LLBufferArray::makeChannelConsumer(
|
||||
channels);
|
||||
chain.push_back(link);
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_URL_PUMP_RESPOND("Pump Respond");
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_URL_PUMP_RESPOND);
|
||||
pump->respond(chain, buffer, context);
|
||||
}
|
||||
mCompletionCallback = NULL;
|
||||
}
|
||||
status = STATUS_BREAK; // This is what the old code returned. Does it make sense?
|
||||
break;
|
||||
case CURLE_FAILED_INIT:
|
||||
case CURLE_COULDNT_CONNECT:
|
||||
status = STATUS_NO_CONNECTION;
|
||||
break;
|
||||
default:
|
||||
llwarns << "URLRequest Error: " << result
|
||||
<< ", "
|
||||
<< LLCurl::strerror(result)
|
||||
<< ", "
|
||||
<< (mDetail->mURL.empty() ? "<EMPTY URL>" : mDetail->mURL)
|
||||
<< llendl;
|
||||
status = STATUS_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
case STATE_HAVE_RESPONSE:
|
||||
PUMP_DEBUG;
|
||||
// we already stuffed everything into channel in in the curl
|
||||
// callback, so we are done.
|
||||
eos = true;
|
||||
context[CONTEXT_REQUEST][CONTEXT_TRANSFERED_BYTES] = mRequestTransferedBytes;
|
||||
context[CONTEXT_RESPONSE][CONTEXT_TRANSFERED_BYTES] = mResponseTransferedBytes;
|
||||
lldebugs << this << "Setting context to " << context << llendl;
|
||||
return STATUS_DONE;
|
||||
|
||||
default:
|
||||
PUMP_DEBUG;
|
||||
context[CONTEXT_REQUEST][CONTEXT_TRANSFERED_BYTES] = mRequestTransferedBytes;
|
||||
context[CONTEXT_RESPONSE][CONTEXT_TRANSFERED_BYTES] = mResponseTransferedBytes;
|
||||
lldebugs << this << "Setting context to " << context << llendl;
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
}
|
||||
#endif // AI_UNUSED
|
||||
|
||||
bool LLURLRequest::configure(AICurlEasyRequest_wat const& curlEasyRequest_w)
|
||||
{
|
||||
bool rv = false;
|
||||
@@ -559,198 +275,3 @@ bool LLURLRequest::configure(AICurlEasyRequest_wat const& curlEasyRequest_w)
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// static
|
||||
size_t LLURLRequest::downCallback(
|
||||
char* data,
|
||||
size_t size,
|
||||
size_t nmemb,
|
||||
void* user)
|
||||
{
|
||||
LLURLRequest* req = (LLURLRequest*)user;
|
||||
if(STATE_WAITING_FOR_RESPONSE == req->mState)
|
||||
{
|
||||
req->mState = STATE_PROCESSING_RESPONSE;
|
||||
}
|
||||
U32 bytes = size * nmemb;
|
||||
if (req->mDetail->mIsBodyLimitSet)
|
||||
{
|
||||
if (bytes > req->mDetail->mBodyLimit)
|
||||
{
|
||||
bytes = req->mDetail->mBodyLimit;
|
||||
req->mDetail->mBodyLimit = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
req->mDetail->mBodyLimit -= bytes;
|
||||
}
|
||||
}
|
||||
|
||||
req->mDetail->mResponseBuffer->append(
|
||||
req->mDetail->mChannels.out(),
|
||||
(U8*)data,
|
||||
bytes);
|
||||
req->mResponseTransferedBytes += bytes;
|
||||
req->mDetail->mByteAccumulator += bytes;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
// static
|
||||
size_t LLURLRequest::upCallback(
|
||||
char* data,
|
||||
size_t size,
|
||||
size_t nmemb,
|
||||
void* user)
|
||||
{
|
||||
LLURLRequest* req = (LLURLRequest*)user;
|
||||
S32 bytes = llmin(
|
||||
(S32)(size * nmemb),
|
||||
req->mDetail->mResponseBuffer->countAfter(
|
||||
req->mDetail->mChannels.in(),
|
||||
req->mDetail->mLastRead));
|
||||
req->mDetail->mLastRead = req->mDetail->mResponseBuffer->readAfter(
|
||||
req->mDetail->mChannels.in(),
|
||||
req->mDetail->mLastRead,
|
||||
(U8*)data,
|
||||
bytes);
|
||||
req->mRequestTransferedBytes += bytes;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
static size_t headerCallback(char* header_line, size_t size, size_t nmemb, void* user)
|
||||
{
|
||||
size_t header_len = size * nmemb;
|
||||
LLURLRequestComplete* complete = (LLURLRequestComplete*)user;
|
||||
|
||||
if (!complete || !header_line)
|
||||
{
|
||||
return header_len;
|
||||
}
|
||||
|
||||
// *TODO: This should be a utility in llstring.h: isascii()
|
||||
for (size_t i = 0; i < header_len; ++i)
|
||||
{
|
||||
if (header_line[i] < 0)
|
||||
{
|
||||
return header_len;
|
||||
}
|
||||
}
|
||||
|
||||
std::string header(header_line, header_len);
|
||||
|
||||
// Per HTTP spec the first header line must be the status line.
|
||||
if (header.substr(0,5) == "HTTP/")
|
||||
{
|
||||
std::string::iterator end = header.end();
|
||||
std::string::iterator pos1 = std::find(header.begin(), end, ' ');
|
||||
if (pos1 != end) ++pos1;
|
||||
std::string::iterator pos2 = std::find(pos1, end, ' ');
|
||||
if (pos2 != end) ++pos2;
|
||||
std::string::iterator pos3 = std::find(pos2, end, '\r');
|
||||
|
||||
std::string version(header.begin(), pos1);
|
||||
std::string status(pos1, pos2);
|
||||
std::string reason(pos2, pos3);
|
||||
|
||||
S32 status_code = atoi(status.c_str());
|
||||
if (status_code > 0)
|
||||
{
|
||||
complete->httpStatus((U32)status_code, reason);
|
||||
return header_len;
|
||||
}
|
||||
}
|
||||
|
||||
std::string::iterator sep = std::find(header.begin(),header.end(),':');
|
||||
|
||||
if (sep != header.end())
|
||||
{
|
||||
std::string key(header.begin(), sep);
|
||||
std::string value(sep + 1, header.end());
|
||||
|
||||
key = utf8str_tolower(utf8str_trim(key));
|
||||
value = utf8str_trim(value);
|
||||
|
||||
complete->header(key, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLStringUtil::trim(header);
|
||||
if (!header.empty())
|
||||
{
|
||||
llwarns << "Unable to parse header: " << header << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
return header_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef AI_UNUSED
|
||||
/**
|
||||
* LLURLRequestComplete
|
||||
*/
|
||||
LLURLRequestComplete::LLURLRequestComplete() :
|
||||
mRequestStatus(LLIOPipe::STATUS_ERROR)
|
||||
{
|
||||
}
|
||||
|
||||
// virtual
|
||||
LLURLRequestComplete::~LLURLRequestComplete()
|
||||
{
|
||||
}
|
||||
|
||||
//virtual
|
||||
void LLURLRequestComplete::header(const std::string& header, const std::string& value)
|
||||
{
|
||||
}
|
||||
|
||||
//virtual
|
||||
void LLURLRequestComplete::complete(const LLChannelDescriptors& channels,
|
||||
const buffer_ptr_t& buffer)
|
||||
{
|
||||
if(STATUS_OK == mRequestStatus)
|
||||
{
|
||||
response(channels, buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
noResponse();
|
||||
}
|
||||
}
|
||||
|
||||
//virtual
|
||||
void LLURLRequestComplete::response(const LLChannelDescriptors& channels,
|
||||
const buffer_ptr_t& buffer)
|
||||
{
|
||||
llwarns << "LLURLRequestComplete::response default implementation called"
|
||||
<< llendl;
|
||||
}
|
||||
|
||||
//virtual
|
||||
void LLURLRequestComplete::noResponse()
|
||||
{
|
||||
llwarns << "LLURLRequestComplete::noResponse default implementation called"
|
||||
<< llendl;
|
||||
}
|
||||
|
||||
void LLURLRequestComplete::responseStatus(LLIOPipe::EStatus status)
|
||||
{
|
||||
mRequestStatus = status;
|
||||
}
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_PROCESS_URL_COMPLETE("URL Complete");
|
||||
// virtual
|
||||
LLIOPipe::EStatus LLURLRequestComplete::process_impl(
|
||||
const LLChannelDescriptors& channels,
|
||||
buffer_ptr_t& buffer,
|
||||
bool& eos,
|
||||
LLSD& context,
|
||||
LLPumpIO* pump)
|
||||
{
|
||||
LLFastTimer t(FTM_PROCESS_URL_COMPLETE);
|
||||
PUMP_DEBUG;
|
||||
complete(channels, buffer);
|
||||
return STATUS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -126,294 +126,4 @@ class LLURLRequest : public AICurlEasyRequestStateMachine {
|
||||
/*virtual*/ void initialize_impl(void);
|
||||
};
|
||||
|
||||
#if 0
|
||||
extern const std::string CONTEXT_REQUEST;
|
||||
extern const std::string CONTEXT_RESPONSE;
|
||||
extern const std::string CONTEXT_TRANSFERED_BYTES;
|
||||
|
||||
class LLURLRequestDetail;
|
||||
|
||||
class LLURLRequestComplete;
|
||||
|
||||
struct x509_store_ctx_st;
|
||||
typedef struct x509_store_ctx_st X509_STORE_CTX;
|
||||
|
||||
/**
|
||||
* @class LLURLRequest
|
||||
* @brief Class to handle url based requests.
|
||||
* @see LLIOPipe
|
||||
*
|
||||
* Currently, this class is implemented on top of curl. From the
|
||||
* vantage of a programmer using this class, you do not care so much,
|
||||
* but it's useful to know since in order to accomplish 'non-blocking'
|
||||
* behavior, we have to use a more expensive curl interface which can
|
||||
* still block if the server enters a half-accepted state. It would be
|
||||
* worth the time and effort to eventually port this to a raw client
|
||||
* socket.
|
||||
*/
|
||||
class LLURLRequest : public LLIOPipe
|
||||
{
|
||||
LOG_CLASS(LLURLRequest);
|
||||
public:
|
||||
|
||||
typedef int (* SSLCertVerifyCallback)(X509_STORE_CTX *ctx, void *param);
|
||||
/**
|
||||
* @brief This enumeration is for specifying the type of request.
|
||||
*/
|
||||
enum ERequestAction
|
||||
{
|
||||
INVALID,
|
||||
HTTP_HEAD,
|
||||
HTTP_GET,
|
||||
HTTP_PUT,
|
||||
HTTP_POST,
|
||||
HTTP_DELETE,
|
||||
HTTP_MOVE, // Caller will need to set 'Destination' header
|
||||
REQUEST_ACTION_COUNT
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Turn the requst action into an http verb.
|
||||
*/
|
||||
static std::string actionAsVerb(ERequestAction action);
|
||||
|
||||
/**
|
||||
* @brief Constructor.
|
||||
*
|
||||
* @param action One of the ERequestAction enumerations.
|
||||
*/
|
||||
LLURLRequest(ERequestAction action);
|
||||
|
||||
/**
|
||||
* @brief Constructor.
|
||||
*
|
||||
* @param action One of the ERequestAction enumerations.
|
||||
* @param url The url of the request. It should already be encoded.
|
||||
*/
|
||||
LLURLRequest(ERequestAction action, const std::string& url);
|
||||
|
||||
/**
|
||||
* @brief Destructor.
|
||||
*/
|
||||
virtual ~LLURLRequest();
|
||||
|
||||
/* @name Instance methods
|
||||
*/
|
||||
//@{
|
||||
/**
|
||||
* @brief Set the url for the request
|
||||
*
|
||||
* This method assumes the url is encoded appropriately for the
|
||||
* request.
|
||||
* The url must be set somehow before the first call to process(),
|
||||
* or the url will not be set correctly.
|
||||
*
|
||||
*/
|
||||
void setURL(const std::string& url);
|
||||
std::string getURL() const;
|
||||
/**
|
||||
* @brief Add a header to the http post.
|
||||
*
|
||||
* The header must be correctly formatted for HTTP requests. This
|
||||
* provides a raw interface if you know what kind of request you
|
||||
* will be making during construction of this instance. All
|
||||
* required headers will be automatically constructed, so this is
|
||||
* usually useful for encoding parameters.
|
||||
*/
|
||||
void addHeader(const char* header);
|
||||
|
||||
/**
|
||||
* @brief Return at most size bytes of body.
|
||||
*
|
||||
* If the body had more bytes than this limit, they will not be
|
||||
* returned and the connection closed. In this case, STATUS_STOP
|
||||
* will be passed to responseStatus();
|
||||
*/
|
||||
void setBodyLimit(U32 size);
|
||||
|
||||
/**
|
||||
* @brief Set a completion callback for this URLRequest.
|
||||
*
|
||||
* The callback is added to this URLRequet's pump when either the
|
||||
* entire buffer is known or an error like timeout or connection
|
||||
* refused has happened. In the case of a complete transfer, this
|
||||
* object builds a response chain such that the callback and the
|
||||
* next process consumer get to read the output.
|
||||
*
|
||||
* This setup is a little fragile since the url request consumer
|
||||
* might not just read the data - it may do a channel change,
|
||||
* which invalidates the input to the callback, but it works well
|
||||
* in practice.
|
||||
*/
|
||||
void setCallback(LLURLRequestComplete* callback);
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @ brief Turn off (or on) the CURLOPT_PROXY header.
|
||||
*/
|
||||
void useProxy(bool use_proxy);
|
||||
|
||||
/**
|
||||
* @ brief Set the CURLOPT_PROXY header to the given value.
|
||||
*/
|
||||
void useProxy(const std::string& proxy);
|
||||
|
||||
/**
|
||||
* @brief Turn on cookie handling for this request with CURLOPT_COOKIEFILE.
|
||||
*/
|
||||
void allowCookies();
|
||||
|
||||
/* @name LLIOPipe virtual implementations
|
||||
*/
|
||||
|
||||
/*virtual*/ bool hasExpiration(void) const;
|
||||
/*virtual*/ bool hasNotExpired(void) const;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Give this pipe a chance to handle a generated error
|
||||
*/
|
||||
virtual EStatus handleError(EStatus status, LLPumpIO* pump);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Process the data in buffer
|
||||
*/
|
||||
virtual EStatus process_impl(
|
||||
const LLChannelDescriptors& channels,
|
||||
buffer_ptr_t& buffer,
|
||||
bool& eos,
|
||||
LLSD& context,
|
||||
LLPumpIO* pump);
|
||||
//@}
|
||||
|
||||
protected:
|
||||
enum EState
|
||||
{
|
||||
STATE_INITIALIZED,
|
||||
STATE_WAITING_FOR_RESPONSE,
|
||||
STATE_PROCESSING_RESPONSE,
|
||||
STATE_CURL_FINISHED,
|
||||
STATE_HAVE_RESPONSE,
|
||||
};
|
||||
EState mState;
|
||||
ERequestAction mAction;
|
||||
LLURLRequestDetail* mDetail;
|
||||
LLIOPipe::ptr_t mCompletionCallback;
|
||||
S32 mRequestTransferedBytes;
|
||||
S32 mResponseTransferedBytes;
|
||||
|
||||
bool mRemoved;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Initialize the object. Called during construction.
|
||||
*/
|
||||
void initialize();
|
||||
|
||||
/**
|
||||
* @brief Handle action specific url request configuration.
|
||||
*
|
||||
* @return Returns true if this is configured.
|
||||
*/
|
||||
bool configure();
|
||||
|
||||
/**
|
||||
* @brief Download callback method.
|
||||
*/
|
||||
static size_t downCallback(
|
||||
char* data,
|
||||
size_t size,
|
||||
size_t nmemb,
|
||||
void* user);
|
||||
|
||||
/**
|
||||
* @brief Upload callback method.
|
||||
*/
|
||||
static size_t upCallback(
|
||||
char* data,
|
||||
size_t size,
|
||||
size_t nmemb,
|
||||
void* user);
|
||||
|
||||
/**
|
||||
* @brief Declaration of unimplemented method to prevent copy
|
||||
* construction.
|
||||
*/
|
||||
LLURLRequest(const LLURLRequest&);
|
||||
};
|
||||
|
||||
/**
|
||||
* @class LLURLRequestComplete
|
||||
* @brief Class which can optionally be used with an LLURLRequest to
|
||||
* get notification when the url request is complete.
|
||||
*/
|
||||
class LLURLRequestComplete : public LLIOPipe
|
||||
{
|
||||
public:
|
||||
|
||||
// Called once for each header received, except status lines
|
||||
virtual void header(const std::string& header, const std::string& value);
|
||||
|
||||
// May be called more than once, particularly for redirects and proxy madness.
|
||||
// Ex. a 200 for a connection to https through a proxy, followed by the "real" status
|
||||
// a 3xx for a redirect followed by a "real" status, or more redirects.
|
||||
virtual void httpStatus(U32 status, const std::string& reason) { }
|
||||
|
||||
virtual void complete(
|
||||
const LLChannelDescriptors& channels,
|
||||
const buffer_ptr_t& buffer);
|
||||
|
||||
/**
|
||||
* @brief This method is called when we got a valid response.
|
||||
*
|
||||
* It is up to class implementers to do something useful here.
|
||||
*/
|
||||
virtual void response(
|
||||
const LLChannelDescriptors& channels,
|
||||
const buffer_ptr_t& buffer);
|
||||
|
||||
/**
|
||||
* @brief This method is called if there was no response.
|
||||
*
|
||||
* It is up to class implementers to do something useful here.
|
||||
*/
|
||||
virtual void noResponse();
|
||||
|
||||
/**
|
||||
* @brief This method will be called by the LLURLRequest object.
|
||||
*
|
||||
* If this is set to STATUS_OK or STATUS_STOP, then the transfer
|
||||
* is asssumed to have worked. This will lead to calling response()
|
||||
* on the next call to process(). Otherwise, this object will call
|
||||
* noResponse() on the next call to process.
|
||||
* @param status The status of the URLRequest.
|
||||
*/
|
||||
void responseStatus(EStatus status);
|
||||
|
||||
// constructor & destructor.
|
||||
LLURLRequestComplete();
|
||||
virtual ~LLURLRequestComplete();
|
||||
|
||||
protected:
|
||||
/* @name LLIOPipe virtual implementations
|
||||
*/
|
||||
//@{
|
||||
/**
|
||||
* @brief Process the data in buffer
|
||||
*/
|
||||
virtual EStatus process_impl(
|
||||
const LLChannelDescriptors& channels,
|
||||
buffer_ptr_t& buffer,
|
||||
bool& eos,
|
||||
LLSD& context,
|
||||
LLPumpIO* pump);
|
||||
//@}
|
||||
|
||||
// value to note if we actually got the response. This value
|
||||
// depends on correct useage from the LLURLRequest instance.
|
||||
EStatus mRequestStatus;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // LL_LLURLREQUEST_H
|
||||
|
||||
@@ -133,7 +133,7 @@ BOOL FloaterVoiceLicense::postBuild()
|
||||
std::string url = getString( "real_url" );
|
||||
if(url.substr(0,4) == "http") {
|
||||
gResponsePtr = LLIamHereVoice::build( this );
|
||||
LLHTTPClient::get4( url, gResponsePtr );
|
||||
LLHTTPClient::get( url, gResponsePtr );
|
||||
} else {
|
||||
setSiteIsAlive(false);
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ void HGFloaterTextEditor::onClickSave(void* user_data)
|
||||
|
||||
if(caps)
|
||||
{
|
||||
LLHTTPClient::post4(url, body,
|
||||
LLHTTPClient::post(url, body,
|
||||
new LLUpdateAgentInventoryResponder(body, fake_asset_id, item->getType()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,345 +0,0 @@
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "hipporestrequest.h"
|
||||
|
||||
#ifndef CURL_STATICLIB
|
||||
#define CURL_STATICLIB 1
|
||||
#endif
|
||||
|
||||
#include <stdtypes.h>
|
||||
#include "llbufferstream.h"
|
||||
#include "llerror.h"
|
||||
#include "llhttpclient.h"
|
||||
#include "llurlrequest.h"
|
||||
#include "llxmltree.h"
|
||||
|
||||
#include <curl/curl.h>
|
||||
#ifdef DEBUG_CURLIO
|
||||
#include "debug_libcurl.h"
|
||||
#endif
|
||||
|
||||
// ********************************************************************
|
||||
|
||||
|
||||
class HippoRestComplete /* AIFIXME: public LLURLRequestComplete*/
|
||||
{
|
||||
public:
|
||||
HippoRestComplete(HippoRestHandler *handler) :
|
||||
mHandler(handler),
|
||||
mStatus(499),
|
||||
mReason("Request completed w/o status")
|
||||
{
|
||||
}
|
||||
|
||||
~HippoRestComplete()
|
||||
{
|
||||
delete mHandler;
|
||||
}
|
||||
|
||||
// Called once for each header received, prior to httpStatus
|
||||
void header(const std::string& header, const std::string& value)
|
||||
{
|
||||
mHandler->addHeader(header, value);
|
||||
}
|
||||
|
||||
#if 0 // AIFIXME: doesn't compile
|
||||
// Always called on request completion, prior to complete
|
||||
void httpStatus(U32 status, const std::string& reason)
|
||||
{
|
||||
LLURLRequestComplete::httpStatus(status, reason);
|
||||
mStatus = status;
|
||||
mReason = reason;
|
||||
}
|
||||
|
||||
void complete(const LLChannelDescriptors &channels, const buffer_ptr_t &buffer)
|
||||
{
|
||||
mHandler->handle(mStatus, mReason, channels, buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
HippoRestHandler *mHandler;
|
||||
int mStatus;
|
||||
std::string mReason;
|
||||
};
|
||||
|
||||
|
||||
// ********************************************************************
|
||||
|
||||
|
||||
static std::string gEmptyString;
|
||||
|
||||
void HippoRestHandler::addHeader(const std::string &header, const std::string &content)
|
||||
{
|
||||
mHeaders[header] = content;
|
||||
}
|
||||
|
||||
bool HippoRestHandler::hasHeader(const std::string &header) const
|
||||
{
|
||||
return (mHeaders.find(header) != mHeaders.end());
|
||||
}
|
||||
|
||||
const std::string &HippoRestHandler::getHeader(const std::string &header) const
|
||||
{
|
||||
std::map<std::string, std::string>::const_iterator it;
|
||||
it = mHeaders.find(header);
|
||||
if (it != mHeaders.end()) {
|
||||
return it->second;
|
||||
} else {
|
||||
return gEmptyString;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ********************************************************************
|
||||
|
||||
|
||||
void HippoRestHandlerRaw::handle(int status, const std::string &reason,
|
||||
const LLChannelDescriptors &channels,
|
||||
const boost::shared_ptr<LLBufferArray> &body)
|
||||
{
|
||||
if (status == 200) {
|
||||
std::string data;
|
||||
LLBufferArray *buffer = body.get();
|
||||
LLBufferArray::segment_iterator_t it, end = buffer->endSegment();
|
||||
for (it=buffer->beginSegment(); it!=end; ++it)
|
||||
if (it->isOnChannel(channels.in()))
|
||||
data.append((char*)it->data(), it->size());
|
||||
result(data);
|
||||
} else {
|
||||
llwarns << "Rest request error " << status << ": " << reason << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
void HippoRestHandlerXml::handle(int status, const std::string &reason,
|
||||
const LLChannelDescriptors &channels,
|
||||
const boost::shared_ptr<LLBufferArray> &body)
|
||||
{
|
||||
if (status == 200) {
|
||||
LLXmlTree *tree = new LLXmlTree();
|
||||
bool success = tree->parseBufferStart();
|
||||
LLBufferArray *buffer = body.get();
|
||||
LLBufferArray::segment_iterator_t it, end = buffer->endSegment();
|
||||
for (it=buffer->beginSegment(); success && (it!=end); ++it)
|
||||
if (it->isOnChannel(channels.in()))
|
||||
success = success && tree->parseBuffer((char*)it->data(), it->size());
|
||||
success = success && tree->parseBufferFinalize();
|
||||
if (success) result(tree);
|
||||
delete tree;
|
||||
} else {
|
||||
llwarns << "Rest request error " << status << ": " << reason << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ********************************************************************
|
||||
|
||||
class BodyDataRaw : public Injector
|
||||
{
|
||||
public:
|
||||
explicit BodyDataRaw(const std::string &data) : mData(data) { }
|
||||
|
||||
/*virtual*/ char const* contentType(void) const { return "application/octet-stream"; }
|
||||
|
||||
/*virtual*/ U32 get_body(LLChannelDescriptors const& channels, buffer_ptr_t& buffer)
|
||||
{
|
||||
LLBufferStream ostream(channels, buffer.get());
|
||||
ostream.write(mData.data(), mData.size());
|
||||
ostream << std::flush;
|
||||
return mData.size();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string mData;
|
||||
};
|
||||
|
||||
class BodyDataXml : public Injector
|
||||
{
|
||||
public:
|
||||
explicit BodyDataXml(const LLXmlTree *tree) :
|
||||
mTree(tree)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~BodyDataXml()
|
||||
{
|
||||
if (mTree) delete mTree;
|
||||
}
|
||||
|
||||
/*virtual*/ char const* contentType(void) const { return "application/xml"; }
|
||||
|
||||
/*virtual*/ U32 get_body(LLChannelDescriptors const& channels, buffer_ptr_t& buffer)
|
||||
{
|
||||
std::string data;
|
||||
mTree->write(data);
|
||||
LLBufferStream ostream(channels, buffer.get());
|
||||
ostream.write(data.data(), data.size());
|
||||
ostream << std::flush;
|
||||
return data.size();
|
||||
}
|
||||
|
||||
private:
|
||||
const LLXmlTree *mTree;
|
||||
};
|
||||
|
||||
|
||||
// ********************************************************************
|
||||
|
||||
|
||||
static void request(const std::string &url,
|
||||
LLURLRequest::ERequestAction method,
|
||||
Injector *body,
|
||||
HippoRestHandler *handler, float timeout);
|
||||
|
||||
|
||||
// static
|
||||
void HippoRestRequest::get5(const std::string &url,
|
||||
HippoRestHandler *handler, float timeout)
|
||||
{
|
||||
request(url, LLURLRequest::HTTP_GET, 0, handler, timeout);
|
||||
}
|
||||
|
||||
// static
|
||||
void HippoRestRequest::put5(const std::string &url, const std::string &body,
|
||||
HippoRestHandler *handler, float timeout)
|
||||
{
|
||||
request(url, LLURLRequest::HTTP_PUT, new BodyDataRaw(body), handler, timeout);
|
||||
}
|
||||
|
||||
// static
|
||||
void HippoRestRequest::put5(const std::string &url, const LLXmlTree *body,
|
||||
HippoRestHandler *handler, float timeout)
|
||||
{
|
||||
request(url, LLURLRequest::HTTP_PUT, new BodyDataXml(body), handler, timeout);
|
||||
}
|
||||
|
||||
// static
|
||||
void HippoRestRequest::post5(const std::string &url, const std::string &body,
|
||||
HippoRestHandler *handler, float timeout)
|
||||
{
|
||||
request(url, LLURLRequest::HTTP_POST, new BodyDataRaw(body), handler, timeout);
|
||||
}
|
||||
|
||||
// static
|
||||
void HippoRestRequest::post5(const std::string &url, const LLXmlTree *body,
|
||||
HippoRestHandler *handler, float timeout)
|
||||
{
|
||||
request(url, LLURLRequest::HTTP_POST, new BodyDataXml(body), handler, timeout);
|
||||
}
|
||||
|
||||
|
||||
// ********************************************************************
|
||||
|
||||
|
||||
static void request(const std::string &url,
|
||||
LLURLRequest::ERequestAction method,
|
||||
Injector *body,
|
||||
HippoRestHandler *handler, float timeout)
|
||||
{
|
||||
LLURLRequest *req;
|
||||
try
|
||||
{
|
||||
AIHTTPHeaders empty_headers;
|
||||
//AIFIXME (doesn't compile): req = new LLURLRequest(method, url, body, handler, empty_headers);
|
||||
}
|
||||
catch(AICurlNoEasyHandle const& error)
|
||||
{
|
||||
llwarns << "Failed to create LLURLRequest: " << error.what() << llendl;
|
||||
return;
|
||||
}
|
||||
// Already done by default. req->checkRootCertificate(true);
|
||||
|
||||
/*
|
||||
// Insert custom headers if the caller sent any
|
||||
if (headers.isMap())
|
||||
{
|
||||
LLSD::map_const_iterator iter = headers.beginMap();
|
||||
LLSD::map_const_iterator end = headers.endMap();
|
||||
|
||||
for (; iter != end; ++iter)
|
||||
{
|
||||
std::ostringstream header;
|
||||
//if the header is "Pragma" with no value
|
||||
//the caller intends to force libcurl to drop
|
||||
//the Pragma header it so gratuitously inserts
|
||||
//Before inserting the header, force libcurl
|
||||
//to not use the proxy (read: llurlrequest.cpp)
|
||||
static const std::string PRAGMA("Pragma");
|
||||
if ((iter->first == PRAGMA) && (iter->second.asString().empty()))
|
||||
{
|
||||
req->useProxy(false);
|
||||
}
|
||||
header << iter->first << ": " << iter->second.asString() ;
|
||||
lldebugs << "header = " << header.str() << llendl;
|
||||
req->addHeader(header.str().c_str());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if ((method != LLURLRequest::HTTP_PUT) && (method != LLURLRequest::HTTP_POST)) {
|
||||
std::string accept = "Accept: ";
|
||||
accept += handler->getAcceptMimeType();
|
||||
//AIFIXME req is not defined: req->addHeader(accept.c_str());
|
||||
}
|
||||
|
||||
//AIFIXME: req->setCallback(new HippoRestComplete(handler));
|
||||
|
||||
if ((method == LLURLRequest::HTTP_PUT) || (method == LLURLRequest::HTTP_POST)) {
|
||||
std::string content = "Content-Type: ";
|
||||
content += body->contentType();
|
||||
//AIFIXME req is not defined: req->addHeader(content.c_str());
|
||||
//AIFIXME: chain.push_back(LLIOPipe::ptr_t(body));
|
||||
}
|
||||
|
||||
//AIFIXME: chain.push_back(LLIOPipe::ptr_t(req));
|
||||
//LLHTTPClient::getPump().addChain(chain, timeout);
|
||||
}
|
||||
|
||||
|
||||
// ********************************************************************
|
||||
|
||||
|
||||
static size_t curlWrite(void *ptr, size_t size, size_t nmemb, void *userData)
|
||||
{
|
||||
std::string *result = (std::string*)userData;
|
||||
size_t bytes = (size * nmemb);
|
||||
result->append((char*)ptr, bytes);
|
||||
return nmemb;
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
int HippoRestRequest::getBlocking(const std::string &url, std::string *result)
|
||||
{
|
||||
llinfos << "Requesting: " << url << llendl;
|
||||
|
||||
char curlErrorBuffer[CURL_ERROR_SIZE];
|
||||
CURL* curlp = curl_easy_init();
|
||||
llassert_always(curlp);
|
||||
|
||||
curl_easy_setopt(curlp, CURLOPT_NOSIGNAL, 1); // don't use SIGALRM for timeouts
|
||||
curl_easy_setopt(curlp, CURLOPT_TIMEOUT, 30); // seconds (including DNS lookups)
|
||||
curl_easy_setopt(curlp, CURLOPT_CAINFO, gDirUtilp->getCAFile().c_str());
|
||||
|
||||
curl_easy_setopt(curlp, CURLOPT_WRITEFUNCTION, curlWrite);
|
||||
curl_easy_setopt(curlp, CURLOPT_WRITEDATA, result);
|
||||
curl_easy_setopt(curlp, CURLOPT_URL, url.c_str());
|
||||
curl_easy_setopt(curlp, CURLOPT_ERRORBUFFER, curlErrorBuffer);
|
||||
curl_easy_setopt(curlp, CURLOPT_FAILONERROR, 1);
|
||||
|
||||
*result = "";
|
||||
S32 curlSuccess = curl_easy_perform(curlp);
|
||||
long httpStatus = 499L; // curl_easy_getinfo demands pointer to long.
|
||||
curl_easy_getinfo(curlp, CURLINFO_RESPONSE_CODE, &httpStatus);
|
||||
|
||||
if (curlSuccess != 0) {
|
||||
llwarns << "CURL ERROR (HTTP Status " << httpStatus << "): " << curlErrorBuffer << llendl;
|
||||
} else if (httpStatus != 200) {
|
||||
llwarns << "HTTP Error " << httpStatus << ", but no Curl error." << llendl;
|
||||
}
|
||||
|
||||
curl_easy_cleanup(curlp);
|
||||
return httpStatus;
|
||||
}
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
#ifndef __HIPPO_REST_REQUEST_H__
|
||||
#define __HIPPO_REST_REQUEST_H__
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
class LLBufferArray;
|
||||
class LLChannelDescriptors;
|
||||
class LLXmlTree;
|
||||
|
||||
#define HIPPO_REST_TIMEOUT 60.f
|
||||
|
||||
// ********************************************************************
|
||||
|
||||
class HippoRestHandler
|
||||
{
|
||||
public:
|
||||
virtual ~HippoRestHandler() { }
|
||||
|
||||
virtual const char *getAcceptMimeType() const = 0;
|
||||
|
||||
bool hasHeader(const std::string &header) const;
|
||||
const std::string &getHeader(const std::string &header) const;
|
||||
|
||||
private:
|
||||
// These functions are called by the request engine
|
||||
void addHeader(const std::string &header, const std::string &content);
|
||||
virtual void handle(int status, const std::string &reason,
|
||||
const LLChannelDescriptors &channels,
|
||||
const boost::shared_ptr<LLBufferArray> &body) = 0;
|
||||
|
||||
std::map<std::string, std::string> mHeaders;
|
||||
|
||||
friend class HippoRestComplete;
|
||||
};
|
||||
|
||||
class HippoRestHandlerRaw : public HippoRestHandler
|
||||
{
|
||||
public:
|
||||
virtual ~HippoRestHandlerRaw() { }
|
||||
|
||||
const char *getAcceptMimeType() const { return "application/octet-stream"; }
|
||||
|
||||
private:
|
||||
// This function must be implemented to receive the content
|
||||
// it is executed on (status == 200) only
|
||||
virtual void result(const std::string &content) = 0;
|
||||
|
||||
// This function is called by the request engine
|
||||
void handle(int status, const std::string &reason,
|
||||
const LLChannelDescriptors &channels,
|
||||
const boost::shared_ptr<LLBufferArray> &body);
|
||||
};
|
||||
|
||||
class HippoRestHandlerXml : public HippoRestHandler
|
||||
{
|
||||
public:
|
||||
virtual ~HippoRestHandlerXml() { }
|
||||
|
||||
const char *getAcceptMimeType() const { return "application/xml"; }
|
||||
|
||||
private:
|
||||
// This function must be implemented to receive the content
|
||||
virtual void result(LLXmlTree *content) = 0;
|
||||
|
||||
// This function is called by the request engine
|
||||
void handle(int status, const std::string &reason,
|
||||
const LLChannelDescriptors &channels,
|
||||
const boost::shared_ptr<LLBufferArray> &body);
|
||||
};
|
||||
|
||||
// ********************************************************************
|
||||
|
||||
class HippoRestRequest
|
||||
{
|
||||
public:
|
||||
// asynchronous interface
|
||||
static void get5(const std::string &url,
|
||||
HippoRestHandler *handler, float timeout=HIPPO_REST_TIMEOUT);
|
||||
static void put5(const std::string &url, const std::string &body,
|
||||
HippoRestHandler *handler, float timeout=HIPPO_REST_TIMEOUT);
|
||||
static void put5(const std::string &url, const LLXmlTree *body,
|
||||
HippoRestHandler *handler, float timeout=HIPPO_REST_TIMEOUT);
|
||||
static void post5(const std::string &url, const std::string &body,
|
||||
HippoRestHandler *handler, float timeout=HIPPO_REST_TIMEOUT);
|
||||
static void post5(const std::string &url, const LLXmlTree *body,
|
||||
HippoRestHandler *handler, float timeout=HIPPO_REST_TIMEOUT);
|
||||
|
||||
// synchronous interface
|
||||
static int getBlocking(const std::string &url, std::string *result);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -134,8 +134,8 @@ void lggDicDownloadFloater::onClickDownload(void* data)
|
||||
if (!comboBox->getSelectedItemLabel().empty())
|
||||
{
|
||||
std::string newDict(self->sNames[comboBox->getCurrentIndex()]);
|
||||
LLHTTPClient::get4(gSavedSettings.getString("SpellDownloadURL")+newDict+".aff", new EmeraldDicDownloader(self,newDict+".aff"));
|
||||
LLHTTPClient::get4(gSavedSettings.getString("SpellDownloadURL")+newDict+".dic", new EmeraldDicDownloader(NULL,newDict+".dic"));
|
||||
LLHTTPClient::get(gSavedSettings.getString("SpellDownloadURL")+newDict+".aff", new EmeraldDicDownloader(self,newDict+".aff"));
|
||||
LLHTTPClient::get(gSavedSettings.getString("SpellDownloadURL")+newDict+".dic", new EmeraldDicDownloader(NULL,newDict+".dic"));
|
||||
|
||||
LLButton* button = self->getChild<LLButton>("Emerald_dic_download");
|
||||
if (button)
|
||||
|
||||
@@ -142,7 +142,7 @@ void LLAccountingCostManager::fetchCosts( eSelectionType selectionType, const st
|
||||
LLSD dataToPost = LLSD::emptyMap();
|
||||
dataToPost[keystr.c_str()] = objectList;
|
||||
|
||||
LLHTTPClient::post4( url, dataToPost, new LLAccountingCostResponder( objectList ));
|
||||
LLHTTPClient::post( url, dataToPost, new LLAccountingCostResponder( objectList ));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -2402,7 +2402,7 @@ bool LLAgent::sendMaturityPreferenceToServer(int preferredMaturity)
|
||||
body["access_prefs"] = access_prefs;
|
||||
llinfos << "Sending access prefs update to " << (access_prefs["max"].asString()) << " via capability to: "
|
||||
<< url << llendl;
|
||||
LLHTTPClient::post4(url, body, new LLHTTPClient::ResponderIgnore); // Ignore response
|
||||
LLHTTPClient::post(url, body, new LLHTTPClient::ResponderIgnore); // Ignore response
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -61,7 +61,7 @@ bool LLAgentLanguage::update()
|
||||
body["language"] = language;
|
||||
body["language_is_public"] = gSavedSettings.getBOOL("LanguageIsPublic");
|
||||
|
||||
LLHTTPClient::post4(url, body, new LLHTTPClient::ResponderIgnore);
|
||||
LLHTTPClient::post(url, body, new LLHTTPClient::ResponderIgnore);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
llinfos << "Compiling " << llendl;
|
||||
|
||||
// postRaw takes ownership of mData and will delete it.
|
||||
LLHTTPClient::postRaw4(uploader, mData, mDataSize, this);
|
||||
LLHTTPClient::postRaw(uploader, mData, mDataSize, this);
|
||||
mData = NULL;
|
||||
mDataSize = 0;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ void LLAssetUploadQueue::request(LLAssetUploadQueueSupplier** supplier)
|
||||
if (object)
|
||||
{
|
||||
url = object->getRegion()->getCapability("UpdateScriptTask");
|
||||
LLHTTPClient::post4(url, body,
|
||||
LLHTTPClient::post(url, body,
|
||||
new LLAssetUploadChainResponder(
|
||||
body, data.mFilename, data.mQueueId,
|
||||
data.mData, data.mDataSize, data.mScriptName, *supplier));
|
||||
|
||||
@@ -281,11 +281,11 @@ void LLAssetUploadResponder::uploadUpload(const LLSD& content)
|
||||
std::string uploader = content["uploader"];
|
||||
if (mFileName.empty())
|
||||
{
|
||||
LLHTTPClient::postFile4(uploader, mVFileID, mAssetType, this);
|
||||
LLHTTPClient::postFile(uploader, mVFileID, mAssetType, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLHTTPClient::postFile4(uploader, mFileName, this);
|
||||
LLHTTPClient::postFile(uploader, mFileName, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -944,7 +944,7 @@ public:
|
||||
if ( getFilename().empty() )
|
||||
{
|
||||
// we have no filename, use virtual file ID instead
|
||||
LLHTTPClient::postFile4(
|
||||
LLHTTPClient::postFile(
|
||||
confirmation_url,
|
||||
getVFileID(),
|
||||
getAssetType(),
|
||||
@@ -952,7 +952,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
LLHTTPClient::postFile4(
|
||||
LLHTTPClient::postFile(
|
||||
confirmation_url,
|
||||
getFilename(),
|
||||
responder);
|
||||
|
||||
@@ -103,7 +103,7 @@ bool LLCapabilityListener::capListener(const LLSD& request)
|
||||
new LLSDMessage::EventResponder(LLEventPumps::instance(), request, mProvider.getDescription(), cap, reply, error);
|
||||
responder->setTimeoutPolicy(timeoutpolicy);
|
||||
// This capability is supported by the region to which we're talking.
|
||||
LLHTTPClient::post4(url, payload, responder);
|
||||
LLHTTPClient::post(url, payload, responder);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -50,5 +50,5 @@ void LLCapHTTPSender::send(const LLHost& host, const std::string& message,
|
||||
LLSD llsd;
|
||||
llsd["message"] = message;
|
||||
llsd["body"] = body;
|
||||
LLHTTPClient::post4(mCap, llsd, response);
|
||||
LLHTTPClient::post(mCap, llsd, response);
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace
|
||||
|
||||
lldebugs << "LLEventPollResponder::makeRequest <" << mCount << "> ack = "
|
||||
<< LLSDXMLStreamer(mAcknowledge) << llendl;
|
||||
LLHTTPClient::post4(mPollURL, request, this);
|
||||
LLHTTPClient::post(mPollURL, request, this);
|
||||
}
|
||||
|
||||
void LLEventPollResponder::handleMessage(const LLSD& content)
|
||||
|
||||
@@ -893,7 +893,7 @@ void LLPanelActiveSpeakers::onModeratorMuteVoice(LLUICtrl* ctrl, void* user_data
|
||||
LLUUID mSessionID;
|
||||
};
|
||||
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
data,
|
||||
new MuteVoiceResponder(self->mSpeakerMgr->getSessionID()));
|
||||
@@ -960,7 +960,7 @@ void LLPanelActiveSpeakers::onModeratorMuteText(LLUICtrl* ctrl, void* user_data)
|
||||
LLUUID mSessionID;
|
||||
};
|
||||
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
data,
|
||||
new MuteTextResponder(self->mSpeakerMgr->getSessionID()));
|
||||
@@ -999,7 +999,7 @@ void LLPanelActiveSpeakers::onChangeModerationMode(LLUICtrl* ctrl, void* user_da
|
||||
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return moderationModeResponder_timeout; }
|
||||
};
|
||||
|
||||
LLHTTPClient::post4(url, data, new ModerationModeResponder());
|
||||
LLHTTPClient::post(url, data, new ModerationModeResponder());
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -53,7 +53,7 @@ void LLFloaterModelUploadBase::requestAgentUploadPermissions()
|
||||
if (!url.empty())
|
||||
{
|
||||
llinfos<< typeid(*this).name() <<"::requestAgentUploadPermissions() requesting for upload model permissions from: "<< url <<llendl;
|
||||
LLHTTPClient::get4(url, new LLUploadModelPremissionsResponder(getPermObserverHandle()));
|
||||
LLHTTPClient::get(url, new LLUploadModelPremissionsResponder(getPermObserverHandle()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -396,7 +396,7 @@ void LLFloaterPostcard::sendPostcard()
|
||||
body["name"] = childGetValue("name_form").asString();
|
||||
body["subject"] = childGetValue("subject_form").asString();
|
||||
body["msg"] = childGetValue("msg_form").asString();
|
||||
LLHTTPClient::post4(url, body, new LLSendPostcardResponder(body, mAssetID, LLAssetType::AT_IMAGE_JPEG));
|
||||
LLHTTPClient::post(url, body, new LLSendPostcardResponder(body, mAssetID, LLAssetType::AT_IMAGE_JPEG));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -217,7 +217,7 @@ void LLFloaterRegionDebugConsole::onInput(LLUICtrl* ctrl, const LLSD& param)
|
||||
else
|
||||
{
|
||||
// Using SimConsole (deprecated)
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
LLSD(input->getText()),
|
||||
new ConsoleResponder(mOutput));
|
||||
@@ -226,7 +226,7 @@ void LLFloaterRegionDebugConsole::onInput(LLUICtrl* ctrl, const LLSD& param)
|
||||
else
|
||||
{
|
||||
// Using SimConsoleAsync
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
LLSD(input->getText()),
|
||||
new AsyncConsoleResponder);
|
||||
|
||||
@@ -765,7 +765,7 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate()
|
||||
body["allow_parcel_changes"] = childGetValue("allow_parcel_changes_check");
|
||||
body["block_parcel_search"] = childGetValue("block_parcel_search_check");
|
||||
|
||||
LLHTTPClient::post4(url, body, new LLHTTPClient::ResponderIgnore);
|
||||
LLHTTPClient::post(url, body, new LLHTTPClient::ResponderIgnore);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2370,7 +2370,7 @@ bool LLPanelEstateInfo::commitEstateInfoCaps()
|
||||
body["owner_abuse_email"] = childGetValue("abuse_email_address").asString();
|
||||
|
||||
// we use a responder so that we can re-get the data after committing to the database
|
||||
LLHTTPClient::post4(url, body, new LLEstateChangeInfoResponder((void*)this));
|
||||
LLHTTPClient::post(url, body, new LLEstateChangeInfoResponder((void*)this));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -881,14 +881,14 @@ void LLFloaterReporter::sendReportViaCaps(std::string url, std::string sshot_url
|
||||
if(childGetValue("screen_check").asBoolean() && !sshot_url.empty())
|
||||
{
|
||||
// try to upload screenshot
|
||||
LLHTTPClient::post4(sshot_url, report, new LLUserReportScreenshotResponder(report,
|
||||
LLHTTPClient::post(sshot_url, report, new LLUserReportScreenshotResponder(report,
|
||||
mResourceDatap->mAssetInfo.mUuid,
|
||||
mResourceDatap->mAssetInfo.mType));
|
||||
}
|
||||
else
|
||||
{
|
||||
// screenshot not wanted or we don't have screenshot cap
|
||||
LLHTTPClient::post4(url, report, new LLUserReportResponder);
|
||||
LLHTTPClient::post(url, report, new LLUserReportResponder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ void LLFloaterTeleport::onClickTeleport(void* userdata)
|
||||
args["public_region_seed_capability"] = text;
|
||||
args["position"] = ll_sd_from_vector3(LLVector3(128, 128, 50)); // default to middle of region above base terrain
|
||||
LL_INFOS("OGPX") << " args to placeavatar cap " << placeAvatarCap << " on teleport: " << LLSDOStreamer<LLSDXMLFormatter>(args) << LL_ENDL;
|
||||
LLHTTPClient::post4(placeAvatarCap, args, new LLPlaceAvatarTeleportResponder());
|
||||
LLHTTPClient::post(placeAvatarCap, args, new LLPlaceAvatarTeleportResponder());
|
||||
gAgent.setTeleportMessage(
|
||||
LLAgent::sTeleportProgressMessages["requesting"]);
|
||||
gViewerWindow->setShowProgress(TRUE);
|
||||
|
||||
@@ -171,7 +171,7 @@ BOOL LLFloaterTOS::postBuild()
|
||||
{
|
||||
web_browser->addObserver(this);
|
||||
gResponsePtr = LLIamHere::build( this );
|
||||
LLHTTPClient::get4( getString( "real_url" ), gResponsePtr );
|
||||
LLHTTPClient::get( getString( "real_url" ), gResponsePtr );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -239,7 +239,7 @@ void LLFloaterURLEntry::onBtnOK( void* userdata )
|
||||
// Discover the MIME type only for "http" scheme.
|
||||
if(scheme == "http" || scheme == "https")
|
||||
{
|
||||
LLHTTPClient::getHeaderOnly4( media_url,
|
||||
LLHTTPClient::getHeaderOnly( media_url,
|
||||
new LLMediaTypeResponder(self->getHandle()));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -279,7 +279,7 @@ bool send_start_session_messages(
|
||||
|
||||
data["params"] = agents;
|
||||
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
data,
|
||||
new LLStartConferenceChatResponder(
|
||||
@@ -724,7 +724,7 @@ void LLVoiceChannelGroup::getChannelInfo()
|
||||
LLSD data;
|
||||
data["method"] = "call";
|
||||
data["session-id"] = mSessionID;
|
||||
LLHTTPClient::post4(url,
|
||||
LLHTTPClient::post(url,
|
||||
data,
|
||||
new LLVoiceCallCapResponder(mSessionID));
|
||||
}
|
||||
@@ -1604,7 +1604,7 @@ BOOL LLFloaterIMPanel::inviteToSession(const LLDynamicArray<LLUUID>& ids)
|
||||
|
||||
data["method"] = "invite";
|
||||
data["session-id"] = mSessionUUID;
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
data,
|
||||
new LLSessionInviteResponder(
|
||||
|
||||
@@ -310,7 +310,7 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
|
||||
LLSD data;
|
||||
data["method"] = "accept invitation";
|
||||
data["session-id"] = session_id;
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
data,
|
||||
new LLViewerChatterBoxInvitationAcceptResponder(
|
||||
@@ -348,7 +348,7 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
|
||||
LLSD data;
|
||||
data["method"] = "decline invitation";
|
||||
data["session-id"] = session_id;
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
data,
|
||||
NULL);
|
||||
@@ -1627,7 +1627,7 @@ public:
|
||||
LLSD data;
|
||||
data["method"] = "accept invitation";
|
||||
data["session-id"] = session_id;
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
data,
|
||||
new LLViewerChatterBoxInvitationAcceptResponder(
|
||||
|
||||
@@ -578,7 +578,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
|
||||
// request["payload"] = body;
|
||||
|
||||
// viewer_region->getCapAPI().post(request);
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
body,
|
||||
new LLCreateInventoryCategoryResponder(this, callback, user_data) );
|
||||
|
||||
@@ -705,14 +705,14 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
|
||||
if (folder_request_body["folders"].size())
|
||||
{
|
||||
LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(folder_request_body, recursive_cats);
|
||||
LLHTTPClient::post4(url, folder_request_body, fetcher);
|
||||
LLHTTPClient::post(url, folder_request_body, fetcher);
|
||||
}
|
||||
if (folder_request_body_lib["folders"].size())
|
||||
{
|
||||
std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents2");
|
||||
|
||||
LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(folder_request_body_lib, recursive_cats);
|
||||
LLHTTPClient::post4(url_lib, folder_request_body_lib, fetcher);
|
||||
LLHTTPClient::post(url_lib, folder_request_body_lib, fetcher);
|
||||
}
|
||||
}
|
||||
if (item_count)
|
||||
@@ -729,7 +729,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
|
||||
body["agent_id"] = gAgent.getID();
|
||||
body["items"] = item_request_body;
|
||||
|
||||
LLHTTPClient::post4(url, body, new LLInventoryModelFetchItemResponder(body));
|
||||
LLHTTPClient::post(url, body, new LLInventoryModelFetchItemResponder(body));
|
||||
}
|
||||
//else
|
||||
//{
|
||||
@@ -756,7 +756,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
|
||||
body["agent_id"] = gAgent.getID();
|
||||
body["items"] = item_request_body_lib;
|
||||
|
||||
LLHTTPClient::post4(url, body, new LLInventoryModelFetchItemResponder(body));
|
||||
LLHTTPClient::post(url, body, new LLInventoryModelFetchItemResponder(body));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ void fetch_items_from_llsd(const LLSD& items_llsd)
|
||||
if (!url.empty())
|
||||
{
|
||||
body[i]["agent_id"] = gAgent.getID();
|
||||
LLHTTPClient::post4(url, body[i], new LLInventoryModel::fetchInventoryResponder(body[i]));
|
||||
LLHTTPClient::post(url, body[i], new LLInventoryModel::fetchInventoryResponder(body[i]));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "llappviewer.h"
|
||||
#include "llbufferstream.h"
|
||||
#include "llcallbacklist.h"
|
||||
#include "llcurlrequest.h"
|
||||
#include "lldatapacker.h"
|
||||
#include "llfasttimer.h"
|
||||
#if MESH_IMPORT
|
||||
@@ -499,7 +498,6 @@ LLMeshRepoThread::~LLMeshRepoThread()
|
||||
|
||||
void LLMeshRepoThread::run()
|
||||
{
|
||||
mCurlRequest = new AICurlInterface::Request;
|
||||
#if MESH_IMPORT
|
||||
LLCDResult res = LLConvexDecomposition::initThread();
|
||||
if (res != LLCD_OK)
|
||||
@@ -654,9 +652,6 @@ void LLMeshRepoThread::run()
|
||||
llwarns << "convex decomposition unable to be quit" << llendl;
|
||||
}
|
||||
#endif //MESH_IMPORT
|
||||
|
||||
delete mCurlRequest;
|
||||
mCurlRequest = NULL;
|
||||
}
|
||||
|
||||
void LLMeshRepoThread::loadMeshSkinInfo(const LLUUID& mesh_id)
|
||||
@@ -788,9 +783,8 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id)
|
||||
std::string http_url = constructUrl(mesh_id);
|
||||
if (!http_url.empty())
|
||||
{
|
||||
// This might throw AICurlNoEasyHandle.
|
||||
mCurlRequest->getByteRange2(http_url, headers, offset, size,
|
||||
new LLMeshSkinInfoResponder(mesh_id, offset, size));
|
||||
LLHTTPClient::getByteRange(http_url, offset, size,
|
||||
new LLMeshSkinInfoResponder(mesh_id, offset, size), headers);
|
||||
LLMeshRepository::sHTTPRequestCount++;
|
||||
}
|
||||
}
|
||||
@@ -863,8 +857,8 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id)
|
||||
if (!http_url.empty())
|
||||
{
|
||||
// This might throw AICurlNoEasyHandle.
|
||||
mCurlRequest->getByteRange2(http_url, headers, offset, size,
|
||||
new LLMeshDecompositionResponder(mesh_id, offset, size));
|
||||
LLHTTPClient::getByteRange(http_url, offset, size,
|
||||
new LLMeshDecompositionResponder(mesh_id, offset, size), headers);
|
||||
LLMeshRepository::sHTTPRequestCount++;
|
||||
}
|
||||
}
|
||||
@@ -937,8 +931,8 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id)
|
||||
if (!http_url.empty())
|
||||
{
|
||||
// This might throw AICurlNoEasyHandle.
|
||||
mCurlRequest->getByteRange2(http_url, headers, offset, size,
|
||||
new LLMeshPhysicsShapeResponder(mesh_id, offset, size));
|
||||
LLHTTPClient::getByteRange(http_url, offset, size,
|
||||
new LLMeshPhysicsShapeResponder(mesh_id, offset, size), headers);
|
||||
LLMeshRepository::sHTTPRequestCount++;
|
||||
}
|
||||
}
|
||||
@@ -989,7 +983,7 @@ bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params, U32& c
|
||||
//within the first 4KB
|
||||
//NOTE -- this will break of headers ever exceed 4KB
|
||||
// This might throw AICurlNoEasyHandle.
|
||||
mCurlRequest->getByteRange2(http_url, headers, 0, 4096, new LLMeshHeaderResponder(mesh_params));
|
||||
LLHTTPClient::getByteRange(http_url, 0, 4096, new LLMeshHeaderResponder(mesh_params), headers);
|
||||
LLMeshRepository::sHTTPRequestCount++;
|
||||
count++;
|
||||
}
|
||||
@@ -1050,8 +1044,8 @@ void LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod,
|
||||
if (!http_url.empty())
|
||||
{
|
||||
// This might throw AICurlNoEasyHandle.
|
||||
mCurlRequest->getByteRange2(constructUrl(mesh_id), headers, offset, size,
|
||||
new LLMeshLODResponder(mesh_params, lod, offset, size));
|
||||
LLHTTPClient::getByteRange(constructUrl(mesh_id), offset, size,
|
||||
new LLMeshLODResponder(mesh_params, lod, offset, size), headers);
|
||||
LLMeshRepository::sHTTPRequestCount++;
|
||||
count++;
|
||||
}
|
||||
@@ -1287,9 +1281,7 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data,
|
||||
mUploadSkin = upload_skin;
|
||||
mUploadJoints = upload_joints;
|
||||
mMutex = new LLMutex();
|
||||
mCurlRequest = NULL;
|
||||
mPendingUploads = 0;
|
||||
mFinished = false;
|
||||
mOrigin = gAgent.getPositionAgent();
|
||||
mHost = gAgent.getRegionHost();
|
||||
|
||||
@@ -1615,8 +1607,6 @@ void LLMeshUploadThread::generateHulls()
|
||||
|
||||
void LLMeshUploadThread::doWholeModelUpload()
|
||||
{
|
||||
mCurlRequest = new AICurlInterface::Request();
|
||||
|
||||
if (mWholeModelUploadURL.empty())
|
||||
{
|
||||
llinfos << "unable to upload, fee request failed" << llendl;
|
||||
@@ -1629,33 +1619,15 @@ void LLMeshUploadThread::doWholeModelUpload()
|
||||
wholeModelToLLSD(full_model_data, true);
|
||||
LLSD body = full_model_data["asset_resources"];
|
||||
dump_llsd_to_file(body,make_dump_name("whole_model_body_",dump_num));
|
||||
AIHTTPHeaders headers;
|
||||
// This might throw AICurlNoEasyHandle.
|
||||
mCurlRequest->post2(mWholeModelUploadURL, headers, body,
|
||||
new LLWholeModelUploadResponder(this, full_model_data, mUploadObserverHandle), mMeshUploadTimeOut);
|
||||
do
|
||||
{
|
||||
mCurlRequest->process(); // FIXME: This function does not exist anymore. The post() gets CPU time from AICurlEasyRequestStateMachine.
|
||||
// Therefore, if we do not want to continue here unless this upload is done... no wait, that would
|
||||
// be blocking and we don't want blocking...
|
||||
//sleep for 10ms to prevent eating a whole core
|
||||
apr_sleep(10000);
|
||||
} while (mCurlRequest->getQueued() > 0);
|
||||
LLHTTPClient::post(mWholeModelUploadURL, body,
|
||||
new LLWholeModelUploadResponder(this, full_model_data, mUploadObserverHandle));
|
||||
}
|
||||
|
||||
delete mCurlRequest;
|
||||
mCurlRequest = NULL;
|
||||
|
||||
// Currently a no-op.
|
||||
mFinished = true;
|
||||
}
|
||||
|
||||
void LLMeshUploadThread::requestWholeModelFee()
|
||||
{
|
||||
dump_num++;
|
||||
|
||||
mCurlRequest = new AICurlInterface::Request;
|
||||
|
||||
generateHulls();
|
||||
|
||||
LLSD model_data;
|
||||
@@ -1663,23 +1635,9 @@ void LLMeshUploadThread::requestWholeModelFee()
|
||||
dump_llsd_to_file(model_data,make_dump_name("whole_model_fee_request_",dump_num));
|
||||
|
||||
mPendingUploads++;
|
||||
AIHTTPHeaders headers;
|
||||
// This might throw AICurlNoEasyHandle.
|
||||
mCurlRequest->post2(mWholeModelFeeCapability, headers, model_data,
|
||||
new LLWholeModelFeeResponder(this,model_data, mFeeObserverHandle), mMeshUploadTimeOut);
|
||||
|
||||
do
|
||||
{
|
||||
mCurlRequest->process();
|
||||
//sleep for 10ms to prevent eating a whole core
|
||||
apr_sleep(10000);
|
||||
} while (mCurlRequest->getQueued() > 0);
|
||||
|
||||
delete mCurlRequest;
|
||||
mCurlRequest = NULL;
|
||||
|
||||
// Currently a no-op.
|
||||
mFinished = true;
|
||||
LLHTTPClient::post(mWholeModelFeeCapability, model_data,
|
||||
new LLWholeModelFeeResponder(this, model_data, mFeeObserverHandle));
|
||||
}
|
||||
#endif //MESH_IMPORT
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "lluuid.h"
|
||||
#include "llviewertexture.h"
|
||||
#include "llvolume.h"
|
||||
#include "llcurlrequest.h"
|
||||
|
||||
#if MESH_IMPORT
|
||||
#define LLCONVEXDECOMPINTER_STATIC 1
|
||||
@@ -246,7 +245,6 @@ public:
|
||||
static S32 sActiveLODRequests;
|
||||
static U32 sMaxConcurrentRequests;
|
||||
|
||||
AICurlInterface::Request* mCurlRequest;
|
||||
LLMutex* mMutex;
|
||||
LLMutex* mHeaderMutex;
|
||||
LLCondition* mSignal;
|
||||
@@ -413,10 +411,8 @@ public:
|
||||
instance_map mInstance;
|
||||
|
||||
LLMutex* mMutex;
|
||||
LLCurlRequest* mCurlRequest;
|
||||
S32 mPendingUploads;
|
||||
LLVector3 mOrigin;
|
||||
bool mFinished;
|
||||
bool mUploadTextures;
|
||||
bool mUploadSkin;
|
||||
bool mUploadJoints;
|
||||
@@ -431,7 +427,6 @@ public:
|
||||
LLHandle<LLWholeModelFeeObserver> fee_observer= (LLHandle<LLWholeModelFeeObserver>()), LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>()));
|
||||
~LLMeshUploadThread();
|
||||
|
||||
bool finished() { return mFinished; }
|
||||
virtual void run();
|
||||
void preStart();
|
||||
void discard() ;
|
||||
|
||||
@@ -587,7 +587,7 @@ void LLPanelClassified::sendClassifiedInfoRequest()
|
||||
if (!url.empty())
|
||||
{
|
||||
llinfos << "Classified stat request via capability" << llendl;
|
||||
LLHTTPClient::post4(url, body, new LLClassifiedStatsResponder(((LLView*)this)->getHandle(), mClassifiedID));
|
||||
LLHTTPClient::post(url, body, new LLClassifiedStatsResponder(((LLView*)this)->getHandle(), mClassifiedID));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -999,7 +999,7 @@ void LLPanelClassified::sendClassifiedClickMessage(const std::string& type)
|
||||
|
||||
std::string url = gAgent.getRegion()->getCapability("SearchStatTracking");
|
||||
llinfos << "LLPanelClassified::sendClassifiedClickMessage via capability" << llendl;
|
||||
LLHTTPClient::post4(url, body, new LLHTTPClient::ResponderIgnore);
|
||||
LLHTTPClient::post(url, body, new LLHTTPClient::ResponderIgnore);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -790,7 +790,7 @@ void LLPanelGroupVoting::impl::sendStartGroupProposal()
|
||||
body["duration"] = duration_seconds;
|
||||
body["proposal-text"] = mProposalText->getText();
|
||||
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
body,
|
||||
new LLStartGroupVoteResponder(mGroupID));
|
||||
@@ -836,7 +836,7 @@ void LLPanelGroupVoting::impl::sendGroupProposalBallot(const std::string& vote)
|
||||
body["group-id"] = mGroupID;
|
||||
body["vote"] = vote;
|
||||
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
body,
|
||||
new LLGroupProposalBallotResponder(mGroupID));
|
||||
|
||||
@@ -887,7 +887,7 @@ void LLPanelLogin::refreshLoginPage()
|
||||
|
||||
std::string login_page = gHippoGridManager->getConnectedGrid()->getLoginPage();
|
||||
if (!login_page.empty()) {
|
||||
LLHTTPClient::head4(login_page, gResponsePtr);
|
||||
LLHTTPClient::head(login_page, gResponsePtr);
|
||||
} else {
|
||||
sInstance->setSiteIsAlive(false);
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ void LLPanelPlace::displayParcelInfo(const LLVector3& pos_region,
|
||||
U64 region_handle = to_region_handle(pos_global);
|
||||
body["region_handle"] = ll_sd_from_U64(region_handle);
|
||||
}
|
||||
LLHTTPClient::post4(url, body, new LLRemoteParcelRequestResponder(this->getHandle()));
|
||||
LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(this->getHandle()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -377,7 +377,7 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion, b
|
||||
llassert(!navMeshStatusURL.empty());
|
||||
navMeshPtr->handleNavMeshCheckVersion();
|
||||
LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion, pIsGetStatusOnly);
|
||||
LLHTTPClient::get4(navMeshStatusURL, navMeshStatusResponder);
|
||||
LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,12 +411,12 @@ void LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, object_re
|
||||
LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, true, doRequestTerrain));
|
||||
|
||||
LLHTTPClient::ResponderPtr objectLinksetsResponder = new ObjectLinksetsResponder(objectLinksetsURL, linksetsResponderPtr);
|
||||
LLHTTPClient::get4(objectLinksetsURL, objectLinksetsResponder);
|
||||
LLHTTPClient::get(objectLinksetsURL, objectLinksetsResponder);
|
||||
|
||||
if (doRequestTerrain)
|
||||
{
|
||||
LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr);
|
||||
LLHTTPClient::get4(terrainLinksetsURL, terrainLinksetsResponder);
|
||||
LLHTTPClient::get(terrainLinksetsURL, terrainLinksetsResponder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -460,13 +460,13 @@ void LLPathfindingManager::requestSetLinksets(request_id_t pRequestId, const LLP
|
||||
if (!objectPostData.isUndefined())
|
||||
{
|
||||
LLHTTPClient::ResponderPtr objectLinksetsResponder = new ObjectLinksetsResponder(objectLinksetsURL, linksetsResponderPtr);
|
||||
LLHTTPClient::put4(objectLinksetsURL, objectPostData, objectLinksetsResponder);
|
||||
LLHTTPClient::put(objectLinksetsURL, objectPostData, objectLinksetsResponder);
|
||||
}
|
||||
|
||||
if (!terrainPostData.isUndefined())
|
||||
{
|
||||
LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr);
|
||||
LLHTTPClient::put4(terrainLinksetsURL, terrainPostData, terrainLinksetsResponder);
|
||||
LLHTTPClient::put(terrainLinksetsURL, terrainPostData, terrainLinksetsResponder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -499,7 +499,7 @@ void LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, object_
|
||||
pCharactersCallback(pRequestId, kRequestStarted, emptyCharacterListPtr);
|
||||
|
||||
LLHTTPClient::ResponderPtr charactersResponder = new CharactersResponder(charactersURL, pRequestId, pCharactersCallback);
|
||||
LLHTTPClient::get4(charactersURL, charactersResponder);
|
||||
LLHTTPClient::get(charactersURL, charactersResponder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -532,7 +532,7 @@ void LLPathfindingManager::requestGetAgentState()
|
||||
std::string agentStateURL = getAgentStateURLForRegion(currentRegion);
|
||||
llassert(!agentStateURL.empty());
|
||||
LLHTTPClient::ResponderPtr responder = new AgentStateResponder(agentStateURL);
|
||||
LLHTTPClient::get4(agentStateURL, responder);
|
||||
LLHTTPClient::get(agentStateURL, responder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -556,7 +556,7 @@ void LLPathfindingManager::requestRebakeNavMesh(rebake_navmesh_callback_t pRebak
|
||||
LLSD postData;
|
||||
postData["command"] = "rebuild";
|
||||
LLHTTPClient::ResponderPtr responder = new NavMeshRebakeResponder(navMeshStatusURL, pRebakeNavMeshCallback);
|
||||
LLHTTPClient::post4(navMeshStatusURL, postData, responder);
|
||||
LLHTTPClient::post(navMeshStatusURL, postData, responder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -580,7 +580,7 @@ void LLPathfindingManager::sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPt
|
||||
LLHTTPClient::ResponderPtr responder = new NavMeshResponder(navMeshURL, pNavMeshStatus.getVersion(), navMeshPtr);
|
||||
|
||||
LLSD postData;
|
||||
LLHTTPClient::post4(navMeshURL, postData, responder);
|
||||
LLHTTPClient::post(navMeshURL, postData, responder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1183,7 +1183,7 @@ void LLPreviewGesture::saveIfNeeded()
|
||||
// Saving into agent inventory
|
||||
LLSD body;
|
||||
body["item_id"] = mItemUUID;
|
||||
LLHTTPClient::post4(agent_url, body,
|
||||
LLHTTPClient::post(agent_url, body,
|
||||
new LLUpdateAgentInventoryResponder(body, asset_id, LLAssetType::AT_GESTURE));
|
||||
delayedUpload = TRUE;
|
||||
}
|
||||
@@ -1193,7 +1193,7 @@ void LLPreviewGesture::saveIfNeeded()
|
||||
LLSD body;
|
||||
body["task_id"] = mObjectUUID;
|
||||
body["item_id"] = mItemUUID;
|
||||
LLHTTPClient::post4(task_url, body,
|
||||
LLHTTPClient::post(task_url, body,
|
||||
new LLUpdateTaskInventoryResponder(body, asset_id, LLAssetType::AT_GESTURE));
|
||||
}
|
||||
else if (gAssetStorage)
|
||||
|
||||
@@ -569,7 +569,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem)
|
||||
body["item_id"] = mItemUUID;
|
||||
llinfos << "Saving notecard " << mItemUUID
|
||||
<< " into agent inventory via " << agent_url << llendl;
|
||||
LLHTTPClient::post4(agent_url, body,
|
||||
LLHTTPClient::post(agent_url, body,
|
||||
new LLUpdateAgentInventoryResponder(body, asset_id, LLAssetType::AT_NOTECARD));
|
||||
}
|
||||
else if (!mObjectUUID.isNull() && !task_url.empty())
|
||||
@@ -582,7 +582,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem)
|
||||
body["item_id"] = mItemUUID;
|
||||
llinfos << "Saving notecard " << mItemUUID << " into task "
|
||||
<< mObjectUUID << " via " << task_url << llendl;
|
||||
LLHTTPClient::post4(task_url, body,
|
||||
LLHTTPClient::post(task_url, body,
|
||||
new LLUpdateTaskInventoryResponder(body, asset_id, LLAssetType::AT_NOTECARD));
|
||||
}
|
||||
else if (gAssetStorage)
|
||||
|
||||
@@ -1494,7 +1494,7 @@ void LLPreviewLSL::uploadAssetViaCaps(const std::string& url,
|
||||
{
|
||||
body["target"] = "lsl2";
|
||||
}
|
||||
LLHTTPClient::post4(url, body, new LLUpdateAgentInventoryResponder(body, filename, LLAssetType::AT_LSL_TEXT));
|
||||
LLHTTPClient::post(url, body, new LLUpdateAgentInventoryResponder(body, filename, LLAssetType::AT_LSL_TEXT));
|
||||
}
|
||||
|
||||
void LLPreviewLSL::uploadAssetLegacy(const std::string& filename,
|
||||
@@ -2393,7 +2393,7 @@ void LLLiveLSLEditor::uploadAssetViaCaps(const std::string& url,
|
||||
body["item_id"] = item_id;
|
||||
body["is_script_running"] = is_running;
|
||||
body["target"] = monoChecked() ? "mono" : "lsl2";
|
||||
LLHTTPClient::post4(url, body,
|
||||
LLHTTPClient::post(url, body,
|
||||
new LLUpdateTaskInventoryResponder(body, filename, LLAssetType::AT_LSL_TEXT));
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ void LLProductInfoRequestManager::initSingleton()
|
||||
std::string url = gAgent.getRegion()->getCapability("ProductInfoRequest");
|
||||
if (!url.empty())
|
||||
{
|
||||
LLHTTPClient::get4(url, new LLProductInfoRequestResponder());
|
||||
LLHTTPClient::get(url, new LLProductInfoRequestResponder());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -541,7 +541,7 @@ void LLTexLayerSetBuffer::doUpload()
|
||||
{
|
||||
LLSD body = LLSD::emptyMap();
|
||||
// The responder will call LLTexLayerSetBuffer::onTextureUploadComplete()
|
||||
LLHTTPClient::post4(url, body, new LLSendTexLayerResponder(body, mUploadID, LLAssetType::AT_TEXTURE, baked_upload_data));
|
||||
LLHTTPClient::post(url, body, new LLSendTexLayerResponder(body, mUploadID, LLAssetType::AT_TEXTURE, baked_upload_data));
|
||||
llinfos << "Baked texture upload via capability of " << mUploadID << " to " << url << llendl;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1323,12 +1323,13 @@ bool LLTextureFetchWorker::doWork(S32 param)
|
||||
LLImageBase::TYPE_AVATAR_BAKE == mType);
|
||||
#endif
|
||||
|
||||
// Will call callbackHttpGet when curl request completes
|
||||
AIHTTPHeaders headers("Accept", "image/x-j2c");
|
||||
try
|
||||
{
|
||||
res = mFetcher->mCurlGetRequest->getByteRange2(mUrl, headers, offset, mRequestedSize,
|
||||
new HTTPGetResponder(mFetcher, mID, LLTimer::getTotalTime(), mRequestedSize, offset, true));
|
||||
// Will call callbackHttpGet when curl request completes
|
||||
AIHTTPHeaders headers("Accept", "image/x-j2c");
|
||||
LLHTTPClient::getByteRange(mUrl, offset, mRequestedSize,
|
||||
new HTTPGetResponder(mFetcher, mID, LLTimer::getTotalTime(), mRequestedSize, offset, true), headers);
|
||||
res = true;
|
||||
}
|
||||
catch(AICurlNoEasyHandle const& error)
|
||||
{
|
||||
@@ -1994,8 +1995,7 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image
|
||||
mImageDecodeThread(imagedecodethread),
|
||||
mTextureBandwidth(0),
|
||||
mHTTPTextureBits(0),
|
||||
mTotalHTTPRequests(0),
|
||||
mCurlGetRequest(NULL)
|
||||
mTotalHTTPRequests(0)
|
||||
#if HTTP_METRICS
|
||||
,mQAMode(qa_mode)
|
||||
#endif
|
||||
@@ -2429,26 +2429,9 @@ void LLTextureFetch::shutDownImageDecodeThread()
|
||||
}
|
||||
}
|
||||
|
||||
// WORKER THREAD
|
||||
void LLTextureFetch::startThread()
|
||||
{
|
||||
// Construct mCurlGetRequest from Worker Thread
|
||||
mCurlGetRequest = new AICurlInterface::Request;
|
||||
}
|
||||
|
||||
// WORKER THREAD
|
||||
void LLTextureFetch::endThread()
|
||||
{
|
||||
// Destroy mCurlGetRequest from Worker Thread
|
||||
delete mCurlGetRequest;
|
||||
mCurlGetRequest = NULL;
|
||||
}
|
||||
|
||||
// WORKER THREAD
|
||||
void LLTextureFetch::threadedUpdate()
|
||||
{
|
||||
llassert_always(mCurlGetRequest);
|
||||
|
||||
// Limit update frequency
|
||||
const F32 PROCESS_TIME = 0.05f;
|
||||
static LLFrameTimer process_timer;
|
||||
@@ -3118,9 +3101,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
|
||||
|
||||
if (! mCapsURL.empty())
|
||||
{
|
||||
LLCurlRequest::headers_t headers;
|
||||
fetcher->getCurlRequest().post(mCapsURL,
|
||||
headers,
|
||||
LLHTTPClient::post(mCapsURL,
|
||||
merged_llsd,
|
||||
new lcl_responder(fetcher,
|
||||
report_sequence,
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "llimage.h"
|
||||
#include "lluuid.h"
|
||||
#include "llworkerthread.h"
|
||||
#include "llcurlrequest.h"
|
||||
#include "lltextureinfo.h"
|
||||
#include "llapr.h"
|
||||
|
||||
@@ -107,8 +106,6 @@ public:
|
||||
LLViewerAssetStats * main_stats);
|
||||
void commandDataBreak();
|
||||
|
||||
AICurlInterface::Request& getCurlRequest() { return *mCurlGetRequest; }
|
||||
|
||||
bool isQAMode() const { return mQAMode; }
|
||||
|
||||
// Curl POST counter maintenance
|
||||
@@ -128,8 +125,6 @@ protected:
|
||||
|
||||
private:
|
||||
void sendRequestListToSimulators();
|
||||
/*virtual*/ void startThread(void);
|
||||
/*virtual*/ void endThread(void);
|
||||
/*virtual*/ void threadedUpdate(void);
|
||||
void commonUpdate();
|
||||
|
||||
@@ -178,7 +173,6 @@ private:
|
||||
|
||||
LLTextureCache* mTextureCache;
|
||||
LLImageDecodeThread* mImageDecodeThread;
|
||||
AICurlInterface::Request* mCurlGetRequest;
|
||||
|
||||
// Map of all requests by UUID
|
||||
typedef std::map<LLUUID,LLTextureFetchWorker*> map_t;
|
||||
|
||||
@@ -47,7 +47,7 @@ void LLTextureStatsUploader::uploadStatsToSimulator(const std::string texture_ca
|
||||
{
|
||||
if ( texture_cap_url != "" )
|
||||
{
|
||||
LLHTTPClient::post4(texture_cap_url, texture_stats, NULL);
|
||||
LLHTTPClient::post(texture_cap_url, texture_stats, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -74,7 +74,7 @@ void LLTranslate::translateMessage(LLHTTPClient::ResponderPtr &result, const std
|
||||
m_Header.addHeader(m_AgentHeader, user_agent);
|
||||
}
|
||||
|
||||
LLHTTPClient::get4(url, result, m_Header, m_GoogleTimeout);
|
||||
LLHTTPClient::get(url, result, m_Header, m_GoogleTimeout);
|
||||
}
|
||||
|
||||
//static
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <map>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
|
||||
class LLURLRequest;
|
||||
class XMLRPCResponder;
|
||||
|
||||
// forward decl of types from xlrpc.h
|
||||
|
||||
@@ -114,7 +114,7 @@ void LLViewerDisplayName::set(const std::string& display_name, const set_name_sl
|
||||
// communicates with the back-end.
|
||||
LLSD body;
|
||||
body["display_name"] = change_array;
|
||||
LLHTTPClient::post4(cap_url, body, new LLSetDisplayNameResponder, headers);
|
||||
LLHTTPClient::post(cap_url, body, new LLSetDisplayNameResponder, headers);
|
||||
}
|
||||
|
||||
class LLSetDisplayNameReply : public LLHTTPNode
|
||||
|
||||
@@ -256,7 +256,7 @@ void LLViewerInventoryItem::fetchFromServer(void) const
|
||||
body["items"][0]["owner_id"] = mPermissions.getOwner();
|
||||
body["items"][0]["item_id"] = mUUID;
|
||||
|
||||
LLHTTPClient::post4(url, body, new LLInventoryModel::fetchInventoryResponder(body));
|
||||
LLHTTPClient::post(url, body, new LLInventoryModel::fetchInventoryResponder(body));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -684,7 +684,7 @@ void LLViewerMedia::setOpenIDCookie()
|
||||
|
||||
LL_DEBUGS("MediaAuth") << "Requesting " << profile_url << llendl;
|
||||
LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << sOpenIDCookie << "]" << llendl;
|
||||
LLHTTPClient::get4(profile_url,
|
||||
LLHTTPClient::get(profile_url,
|
||||
new LLViewerMediaWebProfileResponder(raw_profile_url.getAuthority()),
|
||||
headers);
|
||||
}
|
||||
@@ -716,7 +716,7 @@ void LLViewerMedia::openIDSetup(const std::string &openid_url, const std::string
|
||||
char* data = new char[size];
|
||||
memcpy(data, openid_token.data(), size);
|
||||
|
||||
LLHTTPClient::postRaw4(
|
||||
LLHTTPClient::postRaw(
|
||||
openid_url,
|
||||
data,
|
||||
size,
|
||||
@@ -1307,7 +1307,7 @@ void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mi
|
||||
{
|
||||
if(mime_type.empty())
|
||||
{
|
||||
LLHTTPClient::getHeaderOnly4( url, new LLMimeDiscoveryResponder(this));
|
||||
LLHTTPClient::getHeaderOnly( url, new LLMimeDiscoveryResponder(this));
|
||||
}
|
||||
else if(initializeMedia(mime_type) && (plugin = getMediaPlugin()))
|
||||
{
|
||||
|
||||
@@ -1206,7 +1206,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
|
||||
body["everyone_mask"] = LLSD::Integer(everyone_perms);
|
||||
body["expected_upload_cost"] = LLSD::Integer(expected_upload_cost);
|
||||
|
||||
LLHTTPClient::post4(url, body,
|
||||
LLHTTPClient::post(url, body,
|
||||
new LLNewAgentInventoryResponder(body, uuid, asset_type));
|
||||
}
|
||||
else
|
||||
@@ -1379,7 +1379,7 @@ void NewResourceItemCallback::fire(const LLUUID& new_item_id)
|
||||
}
|
||||
|
||||
if(agent_url.empty()) return;
|
||||
LLHTTPClient::post4(agent_url, body,
|
||||
LLHTTPClient::post(agent_url, body,
|
||||
new LLUpdateAgentInventoryResponder(body, vfile_id, new_item->getType()));
|
||||
}
|
||||
// </edit>
|
||||
|
||||
@@ -3625,7 +3625,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
|
||||
std::string authUrl = mesg.substr(8);
|
||||
authUrl += (authUrl.find('?') != std::string::npos)? "&auth=": "?auth=";
|
||||
authUrl += gAuthString;
|
||||
LLHTTPClient::get4(authUrl, new AuthHandler);
|
||||
LLHTTPClient::get(authUrl, new AuthHandler);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1214,7 +1214,7 @@ void myupload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_
|
||||
LLSDSerialize::toXML(body, llsdxml);
|
||||
LL_DEBUGS("ObjectBackup") << "posting body to capability: " << llsdxml.str() << LL_ENDL;
|
||||
//LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, uuid, asset_type));
|
||||
LLHTTPClient::post4(url, body, new importResponder(body, uuid, asset_type));
|
||||
LLHTTPClient::post(url, body, new importResponder(body, uuid, asset_type));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1106,7 +1106,7 @@ void LLViewerObjectList::fetchObjectCosts()
|
||||
LLSD post_data = LLSD::emptyMap();
|
||||
|
||||
post_data["object_ids"] = id_list;
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
post_data,
|
||||
new LLObjectCostResponder(id_list));
|
||||
@@ -1162,7 +1162,7 @@ void LLViewerObjectList::fetchPhysicsFlags()
|
||||
LLSD post_data = LLSD::emptyMap();
|
||||
|
||||
post_data["object_ids"] = id_list;
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
post_data,
|
||||
new LLPhysicsFlagsResponder(id_list));
|
||||
|
||||
@@ -467,7 +467,7 @@ void LLViewerParcelMedia::sendMediaNavigateMessage(const std::string& url)
|
||||
body["agent-id"] = gAgent.getID();
|
||||
body["local-id"] = LLViewerParcelMgr::getInstance()->getAgentParcel()->getLocalID();
|
||||
body["url"] = url;
|
||||
LLHTTPClient::post4(region_url, body, new LLHTTPClient::ResponderIgnore);
|
||||
LLHTTPClient::post(region_url, body, new LLHTTPClient::ResponderIgnore);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1310,7 +1310,7 @@ void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, bool use_ag
|
||||
parcel->packMessage(body);
|
||||
llinfos << "Sending parcel properties update via capability to: "
|
||||
<< url << llendl;
|
||||
LLHTTPClient::post4(url, body, new LLHTTPClient::ResponderIgnore);
|
||||
LLHTTPClient::post(url, body, new LLHTTPClient::ResponderIgnore);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1666,7 +1666,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
|
||||
llinfos << "posting to seed " << url << llendl;
|
||||
|
||||
S32 id = ++mImpl->mHttpResponderID;
|
||||
LLHTTPClient::post4(url, capabilityNames,
|
||||
LLHTTPClient::post(url, capabilityNames,
|
||||
BaseCapabilitiesComplete::build(getHandle(), id));
|
||||
}
|
||||
|
||||
@@ -1701,7 +1701,7 @@ void LLViewerRegion::failedSeedCapability()
|
||||
<< mImpl->mSeedCapAttempts << ")" << llendl;
|
||||
|
||||
S32 id = ++mImpl->mHttpResponderID;
|
||||
LLHTTPClient::post4(url, capabilityNames,
|
||||
LLHTTPClient::post(url, capabilityNames,
|
||||
BaseCapabilitiesComplete::build(getHandle(), id));
|
||||
}
|
||||
else
|
||||
@@ -1748,7 +1748,7 @@ private:
|
||||
{
|
||||
mAttempt++;
|
||||
LL_WARNS2("AppInit", "SimulatorFeatures") << "Re-trying '" << mRetryURL << "'. Retry #" << mAttempt << LL_ENDL;
|
||||
LLHTTPClient::get4(mRetryURL, new SimulatorFeaturesReceived(*this));
|
||||
LLHTTPClient::get(mRetryURL, new SimulatorFeaturesReceived(*this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1774,7 +1774,7 @@ void LLViewerRegion::setCapability(const std::string& name, const std::string& u
|
||||
else if (name == "SimulatorFeatures")
|
||||
{
|
||||
// kick off a request for simulator features
|
||||
LLHTTPClient::get4(url, new SimulatorFeaturesReceived(url, getHandle()));
|
||||
LLHTTPClient::get(url, new SimulatorFeaturesReceived(url, getHandle()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -878,6 +878,6 @@ void send_stats()
|
||||
body["MinimalSkin"] = false;
|
||||
|
||||
LLViewerStats::getInstance()->addToMessage(body);
|
||||
LLHTTPClient::post4(url, body, new ViewerStatsResponder);
|
||||
LLHTTPClient::post(url, body, new ViewerStatsResponder);
|
||||
}
|
||||
|
||||
|
||||
@@ -1370,7 +1370,7 @@ void LLVoiceClient::requestVoiceAccountProvision(S32 retries)
|
||||
|
||||
if ( url == "" ) return;
|
||||
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
LLSD(),
|
||||
new LLViewerVoiceAccountProvisionResponder(retries));
|
||||
@@ -5067,7 +5067,7 @@ void LLVoiceClient::parcelChanged()
|
||||
|
||||
std::string url = gAgent.getRegion()->getCapability("ParcelVoiceInfoRequest");
|
||||
LLSD data;
|
||||
LLHTTPClient::post4(
|
||||
LLHTTPClient::post(
|
||||
url,
|
||||
data,
|
||||
new LLVoiceClientCapResponder);
|
||||
|
||||
@@ -284,7 +284,7 @@ bool LLWaterParamManager::savePresetToNotecard(const std::string & name)
|
||||
file.write((U8*)buffer.c_str(), size);
|
||||
LLSD body;
|
||||
body["item_id"] = item->getUUID();
|
||||
LLHTTPClient::post4(agent_url, body, new LLUpdateAgentInventoryResponder(body, asset_id, LLAssetType::AT_NOTECARD));
|
||||
LLHTTPClient::post(agent_url, body, new LLUpdateAgentInventoryResponder(body, asset_id, LLAssetType::AT_NOTECARD));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -88,7 +88,7 @@ bool LLEnvironmentRequest::doRequest()
|
||||
}
|
||||
|
||||
LL_INFOS("WindlightCaps") << "Requesting region windlight settings via " << url << LL_ENDL;
|
||||
LLHTTPClient::get4(url, new LLEnvironmentRequestResponder());
|
||||
LLHTTPClient::get(url, new LLEnvironmentRequestResponder());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ bool LLEnvironmentApply::initiateRequest(const LLSD& content)
|
||||
|
||||
LL_INFOS("WindlightCaps") << "Sending windlight settings to " << url << LL_ENDL;
|
||||
LL_DEBUGS("WindlightCaps") << "content: " << content << LL_ENDL;
|
||||
LLHTTPClient::post4(url, content, new LLEnvironmentApplyResponder());
|
||||
LLHTTPClient::post(url, content, new LLEnvironmentApplyResponder());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -943,7 +943,7 @@ bool LLWLParamManager::savePresetToNotecard(const std::string & name)
|
||||
file.write((U8*)buffer.c_str(), size);
|
||||
LLSD body;
|
||||
body["item_id"] = item->getUUID();
|
||||
LLHTTPClient::post4(agent_url, body, new LLUpdateAgentInventoryResponder(body, asset_id, LLAssetType::AT_NOTECARD));
|
||||
LLHTTPClient::post(agent_url, body, new LLUpdateAgentInventoryResponder(body, asset_id, LLAssetType::AT_NOTECARD));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -441,7 +441,7 @@ void LLWorldMap::sendMapLayerRequest()
|
||||
if (!url.empty())
|
||||
{
|
||||
llinfos << "LLWorldMap::sendMapLayerRequest via capability" << llendl;
|
||||
LLHTTPClient::post4(url, body, new LLMapLayerResponder);
|
||||
LLHTTPClient::post(url, body, new LLMapLayerResponder);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user