Merge branch 'curlthreading2' into curlthreading3
Conflicts: indra/CMakeLists.txt indra/llcommon/llstring.h indra/llmessage/CMakeLists.txt indra/llmessage/llhttpclient.cpp indra/llmessage/llhttpclient.h indra/llmessage/llurlrequest.cpp indra/llmessage/llurlrequest.h indra/newview/hipporestrequest.cpp indra/newview/llappviewer.cpp
This commit is contained in:
@@ -37,8 +37,8 @@
|
||||
#include "apr_poll.h"
|
||||
|
||||
#include "llapr.h"
|
||||
#include "llaprpool.h"
|
||||
#include "llareslistener.h"
|
||||
#include "llscopedvolatileaprpool.h"
|
||||
|
||||
#if defined(LL_WINDOWS)
|
||||
#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
|
||||
@@ -468,6 +468,7 @@ bool LLAres::process(U64 timeout)
|
||||
ares_socket_t socks[ARES_GETSOCK_MAXNUM];
|
||||
apr_pollfd_t aprFds[ARES_GETSOCK_MAXNUM];
|
||||
apr_int32_t nsds = 0;
|
||||
apr_status_t status;
|
||||
int nactive = 0;
|
||||
int bitmask;
|
||||
|
||||
@@ -478,8 +479,6 @@ bool LLAres::process(U64 timeout)
|
||||
return nsds > 0;
|
||||
}
|
||||
|
||||
LLScopedVolatileAPRPool scoped_pool;
|
||||
|
||||
for (int i = 0; i < ARES_GETSOCK_MAXNUM; i++)
|
||||
{
|
||||
if (ARES_GETSOCK_READABLE(bitmask, i))
|
||||
@@ -495,7 +494,7 @@ bool LLAres::process(U64 timeout)
|
||||
|
||||
apr_socket_t *aprSock = NULL;
|
||||
|
||||
apr_status_t status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], scoped_pool);
|
||||
status = apr_os_sock_put(&aprSock, (apr_os_sock_t *) &socks[i], LLAPRRootPool::get()());
|
||||
if (status != APR_SUCCESS)
|
||||
{
|
||||
ll_apr_warn_status(status);
|
||||
@@ -504,7 +503,7 @@ bool LLAres::process(U64 timeout)
|
||||
|
||||
aprFds[nactive].desc.s = aprSock;
|
||||
aprFds[nactive].desc_type = APR_POLL_SOCKET;
|
||||
aprFds[nactive].p = scoped_pool;
|
||||
aprFds[nactive].p = LLAPRRootPool::get()();
|
||||
aprFds[nactive].rtnevents = 0;
|
||||
aprFds[nactive].client_data = &socks[i];
|
||||
|
||||
@@ -513,7 +512,7 @@ bool LLAres::process(U64 timeout)
|
||||
|
||||
if (nactive > 0)
|
||||
{
|
||||
apr_status_t status = apr_poll(aprFds, nactive, &nsds, timeout);
|
||||
status = apr_poll(aprFds, nactive, &nsds, timeout);
|
||||
|
||||
if (status != APR_SUCCESS && status != APR_TIMEUP)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llbuffer.h"
|
||||
#include <iterator>
|
||||
|
||||
#include "llmath.h"
|
||||
#include "llmemtype.h"
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include "llstl.h"
|
||||
#include "lltransfermanager.h"
|
||||
#include "llmodularmath.h"
|
||||
#include "llpacketring.h"
|
||||
|
||||
const S32 PING_START_BLOCK = 3; // How many pings behind we have to be to consider ourself blocked.
|
||||
const S32 PING_RELEASE_BLOCK = 2; // How many pings behind we have to be to consider ourself unblocked.
|
||||
@@ -346,7 +347,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now)
|
||||
|
||||
packetp->mBuffer[0] |= LL_RESENT_FLAG; // tag packet id as being a resend
|
||||
|
||||
gMessageSystem->mPacketRing.sendPacket(packetp->mSocket,
|
||||
gMessageSystem->mPacketRing->sendPacket(packetp->mSocket,
|
||||
(char *)packetp->mBuffer, packetp->mBufferLength,
|
||||
packetp->mHost);
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ bool Request::post(std::string const& url, headers_t const& headers, std::string
|
||||
llassert_always(success); // AIFIXME: Maybe throw an error.
|
||||
if (!success)
|
||||
return false;
|
||||
buffered_easy_request_w->setPost(NULL, bytes);
|
||||
buffered_easy_request_w->setPost(bytes);
|
||||
buffered_easy_request_w->addHeader("Content-Type: application/octet-stream");
|
||||
buffered_easy_request_w->finalizeRequest(url);
|
||||
|
||||
@@ -128,7 +128,7 @@ bool Request::post(std::string const& url, headers_t const& headers, LLSD const&
|
||||
LLBufferStream buffer_stream(buffer_w->sChannels, buffer_w->getInput().get());
|
||||
LLSDSerialize::toXML(data, buffer_stream);
|
||||
S32 bytes = buffer_w->getInput()->countAfter(buffer_w->sChannels.out(), NULL);
|
||||
buffered_easy_request_w->setPost(NULL, bytes);
|
||||
buffered_easy_request_w->setPost(bytes);
|
||||
buffered_easy_request_w->addHeader("Content-Type: application/llsd+xml");
|
||||
buffered_easy_request_w->finalizeRequest(url);
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "lldispatcher.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include "llstl.h"
|
||||
#include "message.h"
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@
|
||||
|
||||
#include "llbuffer.h"
|
||||
#include "llbufferstream.h"
|
||||
#include "llfasttimer.h"
|
||||
#include "llmemorystream.h"
|
||||
#include "llsd.h"
|
||||
#include "llsdserialize.h"
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
#include <openssl/x509_vfy.h>
|
||||
#include "llhttpclient.h"
|
||||
|
||||
#include "llassetstorage.h"
|
||||
@@ -36,16 +35,13 @@
|
||||
#include "llvfile.h"
|
||||
#include "llvfs.h"
|
||||
#include "lluri.h"
|
||||
#include "llpumpio.h" // LLPumpIO::chain_t
|
||||
|
||||
#include "message.h"
|
||||
#include <curl/curl.h>
|
||||
|
||||
|
||||
const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f;
|
||||
#ifdef AI_UNUSED
|
||||
LLURLRequest::SSLCertVerifyCallback LLHTTPClient::mCertVerifyCallback = NULL;
|
||||
#endif // AI_UNUSED
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Responder class moved to LLCurl
|
||||
@@ -128,7 +124,7 @@ namespace
|
||||
{
|
||||
public:
|
||||
RawInjector(const U8* data, S32 size) : mData(data), mSize(size) {}
|
||||
virtual ~RawInjector() {delete mData;}
|
||||
virtual ~RawInjector() {delete [] mData;}
|
||||
|
||||
const char* contentType() { return "application/octet-stream"; }
|
||||
|
||||
@@ -193,11 +189,9 @@ namespace
|
||||
|
||||
LLVFile vfile(gVFS, mUUID, mAssetType, LLVFile::READ);
|
||||
S32 fileSize = vfile.getSize();
|
||||
U8* fileBuffer;
|
||||
fileBuffer = new U8 [fileSize];
|
||||
vfile.read(fileBuffer, fileSize);
|
||||
ostream.write((char*)fileBuffer, fileSize);
|
||||
delete [] fileBuffer;
|
||||
std::vector<U8> fileBuffer(fileSize);
|
||||
vfile.read(&fileBuffer[0], fileSize);
|
||||
ostream.write((char*)&fileBuffer[0], fileSize);
|
||||
eos = true;
|
||||
return STATUS_DONE;
|
||||
}
|
||||
@@ -206,25 +200,16 @@ namespace
|
||||
LLAssetType::EType mAssetType;
|
||||
};
|
||||
|
||||
|
||||
LLPumpIO* theClientPump = NULL;
|
||||
}
|
||||
|
||||
#ifdef AI_UNUSED
|
||||
void LLHTTPClient::setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback callback)
|
||||
{
|
||||
LLHTTPClient::mCertVerifyCallback = callback;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void request(
|
||||
const std::string& url,
|
||||
LLURLRequest::ERequestAction method,
|
||||
Injector* body_injector,
|
||||
LLCurl::ResponderPtr responder,
|
||||
const F32 timeout = HTTP_REQUEST_EXPIRY_SECS,
|
||||
const LLSD& headers = LLSD()
|
||||
)
|
||||
const LLSD& headers = LLSD())
|
||||
{
|
||||
if (responder)
|
||||
{
|
||||
@@ -251,8 +236,7 @@ static void request(
|
||||
return ;
|
||||
}
|
||||
|
||||
//AIFIXME: getCertVerifyCallback() always return NULL, so we might as well not do this call:
|
||||
//req->setSSLVerifyCallback(LLHTTPClient::getCertVerifyCallback(), (void *)req);
|
||||
req->checkRootCertificate(true);
|
||||
|
||||
lldebugs << LLURLRequest::actionAsVerb(method) << " " << url << " " << headers << llendl;
|
||||
|
||||
@@ -460,10 +444,9 @@ static LLSD blocking_request(
|
||||
AICurlEasyRequest_wat curlEasyRequest_w(*easy_request);
|
||||
|
||||
LLHTTPBuffer http_buffer;
|
||||
std::string body_str;
|
||||
|
||||
// * Set curl handle options
|
||||
curlEasyRequest_w->setopt(CURLOPT_TIMEOUT, timeout); // seconds, see warning at top of function.
|
||||
curlEasyRequest_w->setopt(CURLOPT_TIMEOUT, (long)timeout); // seconds, see warning at top of function.
|
||||
curlEasyRequest_w->setWriteCallback(&LLHTTPBuffer::curl_write, &http_buffer);
|
||||
|
||||
// * Setup headers.
|
||||
@@ -480,6 +463,9 @@ static LLSD blocking_request(
|
||||
}
|
||||
}
|
||||
|
||||
// Needs to stay alive until after the call to perform().
|
||||
std::ostringstream ostr;
|
||||
|
||||
// * Setup specific method / "verb" for the URI (currently only GET and POST supported + poppy)
|
||||
if (method == LLURLRequest::HTTP_GET)
|
||||
{
|
||||
@@ -487,24 +473,13 @@ static LLSD blocking_request(
|
||||
}
|
||||
else if (method == LLURLRequest::HTTP_POST)
|
||||
{
|
||||
curlEasyRequest_w->setopt(CURLOPT_POST, 1);
|
||||
//serialize to ostr then copy to str - need to because ostr ptr is unstable :(
|
||||
std::ostringstream ostr;
|
||||
LLSDSerialize::toXML(body, ostr);
|
||||
body_str = ostr.str();
|
||||
curlEasyRequest_w->setopt(CURLOPT_POSTFIELDS, body_str.c_str());
|
||||
//copied from PHP libs, correct?
|
||||
curlEasyRequest_w->addHeader("Content-Type: application/llsd+xml");
|
||||
|
||||
// copied from llurlrequest.cpp
|
||||
// it appears that apache2.2.3 or django in etch is busted. If
|
||||
// we do not clear the expect header, we get a 500. May be
|
||||
// limited to django/mod_wsgi.
|
||||
curlEasyRequest_w->addHeader("Expect:");
|
||||
LLSDSerialize::toXML(body, ostr);
|
||||
curlEasyRequest_w->setPost(ostr.str().c_str(), ostr.str().length());
|
||||
}
|
||||
|
||||
// * Do the action using curl, handle results
|
||||
lldebugs << "HTTP body: " << body_str << llendl;
|
||||
curlEasyRequest_w->addHeader("Accept: application/llsd+xml");
|
||||
curlEasyRequest_w->finalizeRequest(url);
|
||||
|
||||
@@ -517,7 +492,7 @@ static LLSD blocking_request(
|
||||
llwarns << "CURL REQ URL: " << url << llendl;
|
||||
llwarns << "CURL REQ METHOD TYPE: " << LLURLRequest::actionAsVerb(method) << llendl;
|
||||
llwarns << "CURL REQ HEADERS: " << headers.asString() << llendl;
|
||||
llwarns << "CURL REQ BODY: " << body_str << llendl;
|
||||
llwarns << "CURL REQ BODY: " << ostr.str() << llendl;
|
||||
llwarns << "CURL HTTP_STATUS: " << http_status << llendl;
|
||||
llwarns << "CURL ERROR: " << curlEasyRequest_w->getErrorString() << llendl;
|
||||
llwarns << "CURL ERROR BODY: " << http_buffer.asString() << llendl;
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <string>
|
||||
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
//#include "llurlrequest.h"
|
||||
#include "llassettype.h"
|
||||
#include "llcurl.h"
|
||||
#include "lliopipe.h"
|
||||
@@ -155,13 +154,7 @@ public:
|
||||
///< for testing
|
||||
static LLPumpIO &getPump();
|
||||
///< Hippo special
|
||||
|
||||
#ifdef AI_UNUSED
|
||||
static void setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback callback);
|
||||
static LLURLRequest::SSLCertVerifyCallback getCertVerifyCallback() { return mCertVerifyCallback; }
|
||||
|
||||
protected:
|
||||
static LLURLRequest::SSLCertVerifyCallback mCertVerifyCallback;
|
||||
#endif // AI_UNUSED
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "llapr.h"
|
||||
#include "llbuffer.h"
|
||||
#include "llbufferstream.h"
|
||||
#include "llfasttimer.h"
|
||||
#include "llhttpnode.h"
|
||||
#include "lliopipe.h"
|
||||
#include "lliosocket.h"
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "llapr.h"
|
||||
|
||||
#include "llbuffer.h"
|
||||
#include "llfasttimer.h"
|
||||
#include "llhost.h"
|
||||
#include "llmemtype.h"
|
||||
#include "llpumpio.h"
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
* OS poll indicates it will not block.
|
||||
*/
|
||||
|
||||
#include "llaprpool.h"
|
||||
#include "lliopipe.h"
|
||||
#include "apr_network_io.h"
|
||||
#include "llchainio.h"
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llfasttimer.h"
|
||||
#include "llioutil.h"
|
||||
#include "llfasttimer.h"
|
||||
|
||||
/**
|
||||
* LLIOFlush
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#include "llstring.h"
|
||||
#include "lluuid.h"
|
||||
#include "net.h"
|
||||
#include "llaprpool.h"
|
||||
|
||||
//
|
||||
// constants
|
||||
@@ -58,7 +57,7 @@
|
||||
const size_t LL_MAX_KNOWN_GOOD_MAIL_SIZE = 4096;
|
||||
|
||||
static bool gMailEnabled = true;
|
||||
static LLAPRPool gMailPool;
|
||||
static apr_pool_t* gMailPool;
|
||||
static apr_sockaddr_t* gSockAddr;
|
||||
static apr_socket_t* gMailSocket;
|
||||
|
||||
@@ -83,7 +82,7 @@ bool connect_smtp()
|
||||
gSockAddr->sa.sin.sin_family,
|
||||
SOCK_STREAM,
|
||||
APR_PROTO_TCP,
|
||||
gMailPool());
|
||||
gMailPool);
|
||||
if(ll_apr_warn_status(status)) return false;
|
||||
status = apr_socket_connect(gMailSocket, gSockAddr);
|
||||
if(ll_apr_warn_status(status))
|
||||
@@ -140,19 +139,19 @@ BOOL LLMail::send(
|
||||
}
|
||||
|
||||
// static
|
||||
void LLMail::init(const std::string& hostname)
|
||||
void LLMail::init(const std::string& hostname, apr_pool_t* pool)
|
||||
{
|
||||
gMailSocket = NULL;
|
||||
if (hostname.empty())
|
||||
if(hostname.empty() || !pool)
|
||||
{
|
||||
gMailPool = NULL;
|
||||
gSockAddr = NULL;
|
||||
gMailPool.destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
gMailPool.create();
|
||||
gMailPool = pool;
|
||||
|
||||
// Collect all the information into a sockaddr structure. the
|
||||
// collect all the information into a socaddr sturcture. the
|
||||
// documentation is a bit unclear, but I either have to
|
||||
// specify APR_UNSPEC or not specify any flags. I am not sure
|
||||
// which option is better.
|
||||
@@ -162,7 +161,7 @@ void LLMail::init(const std::string& hostname)
|
||||
APR_UNSPEC,
|
||||
25,
|
||||
APR_IPV4_ADDR_OK,
|
||||
gMailPool());
|
||||
gMailPool);
|
||||
ll_apr_warn_status(status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,13 +27,15 @@
|
||||
#ifndef LL_LLMAIL_H
|
||||
#define LL_LLMAIL_H
|
||||
|
||||
typedef struct apr_pool_t apr_pool_t;
|
||||
|
||||
#include "llsd.h"
|
||||
|
||||
class LLMail
|
||||
{
|
||||
public:
|
||||
// if hostname is NULL, then the host is resolved as 'mail'
|
||||
static void init(const std::string& hostname);
|
||||
static void init(const std::string& hostname, apr_pool_t* pool);
|
||||
|
||||
// Allow all email transmission to be disabled/enabled.
|
||||
static void enable(bool mail_enabled);
|
||||
|
||||
@@ -388,7 +388,7 @@ bool LLMimeParser::Impl::parseHeaders(
|
||||
// not to read past limit when we get() the newline.
|
||||
S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
|
||||
istr.getline(mBuffer, max_get, '\r');
|
||||
mScanCount += istr.gcount();
|
||||
mScanCount += (S32)istr.gcount();
|
||||
int c = istr.get();
|
||||
if(EOF == c)
|
||||
{
|
||||
@@ -496,7 +496,7 @@ void LLMimeParser::Impl::scanPastSeparator(
|
||||
// past limit when we get() the newline.
|
||||
S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
|
||||
istr.getline(mBuffer, max_get, '\r');
|
||||
mScanCount += istr.gcount();
|
||||
mScanCount += (S32)istr.gcount();
|
||||
if(istr.gcount() >= LINE_BUFFER_LENGTH - 1)
|
||||
{
|
||||
// that's way too long to be a separator, so ignore it.
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include "llhost.h"
|
||||
#include "llpacketbuffer.h"
|
||||
#include "llproxy.h"
|
||||
//#include "llproxy.h"
|
||||
#include "llthrottle.h"
|
||||
#include "net.h"
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "llproxy.h"
|
||||
|
||||
#include <string>
|
||||
#include <curl/curl.h>
|
||||
|
||||
#include "llapr.h"
|
||||
#include "llcurl.h"
|
||||
|
||||
@@ -88,7 +88,7 @@ bool LLSDMessage::httpListener(const LLSD& request)
|
||||
request,
|
||||
url, "POST", reply, error),
|
||||
LLSD(), // headers
|
||||
timeout);
|
||||
(F32)timeout);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data)
|
||||
|
||||
// S64 not supported in LLSD so we just truncate it
|
||||
case MVT_S64:
|
||||
addS32(varname, *(S64*)mvci.getData());
|
||||
addS32(varname, (S32)*(S64*)mvci.getData());
|
||||
break;
|
||||
|
||||
case MVT_F32:
|
||||
|
||||
@@ -37,16 +37,15 @@
|
||||
#include <openssl/x509_vfy.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include "aicurleasyrequeststatemachine.h"
|
||||
#include "llfasttimer.h"
|
||||
#include "llioutil.h"
|
||||
#include "llmemtype.h"
|
||||
#include "llproxy.h"
|
||||
#include "llpumpio.h"
|
||||
#include "llsd.h"
|
||||
#include "llstring.h"
|
||||
#include "apr_env.h"
|
||||
#include "llapr.h"
|
||||
#include "llscopedvolatileaprpool.h"
|
||||
#include "llfasttimer.h"
|
||||
static const U32 HTTP_STATUS_PIPE_ERROR = 499;
|
||||
|
||||
/**
|
||||
@@ -91,40 +90,6 @@ LLURLRequestDetail::~LLURLRequestDetail()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if AI_UNUSED
|
||||
void LLURLRequest::setSSLVerifyCallback(SSLCertVerifyCallback callback, void *param)
|
||||
{
|
||||
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
|
||||
mDetail->mSSLVerifyCallback = callback;
|
||||
AICurlEasyRequest_wat curlEasyRequest_w(*mCurlEasyRequest);
|
||||
curlEasyRequest_w->setSSLCtxCallback(LLURLRequest::_sslCtxCallback, (void *)this);
|
||||
curlEasyRequest_w->setopt(CURLOPT_SSL_VERIFYPEER, true);
|
||||
curlEasyRequest_w->setopt(CURLOPT_SSL_VERIFYHOST, 2);
|
||||
}
|
||||
|
||||
// _sslCtxFunction
|
||||
// Callback function called when an SSL Context is created via CURL
|
||||
// used to configure the context for custom cert validation
|
||||
|
||||
CURLcode LLURLRequest::_sslCtxCallback(CURL * curl, void *sslctx, void *param)
|
||||
{
|
||||
LLURLRequest *req = (LLURLRequest *)param;
|
||||
if(req == NULL || req->mDetail->mSSLVerifyCallback == NULL)
|
||||
{
|
||||
SSL_CTX_set_cert_verify_callback((SSL_CTX *)sslctx, NULL, NULL);
|
||||
return CURLE_OK;
|
||||
}
|
||||
SSL_CTX * ctx = (SSL_CTX *) sslctx;
|
||||
// disable any default verification for server certs
|
||||
SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
|
||||
// set the verification callback.
|
||||
SSL_CTX_set_cert_verify_callback(ctx, req->mDetail->mSSLVerifyCallback, (void *)req);
|
||||
// the calls are void
|
||||
return CURLE_OK;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* class LLURLRequest
|
||||
*/
|
||||
@@ -172,6 +137,13 @@ void LLURLRequest::addHeader(const char* header)
|
||||
curlEasyRequest_w->addHeader(header);
|
||||
}
|
||||
|
||||
void LLURLRequest::checkRootCertificate(bool check)
|
||||
{
|
||||
AICurlEasyRequest_wat curlEasyRequest_w(*mCurlEasyRequest);
|
||||
curlEasyRequest_w->setopt(CURLOPT_SSL_VERIFYPEER, check ? 1L : 0L);
|
||||
curlEasyRequest_w->setoptString(CURLOPT_ENCODING, "");
|
||||
}
|
||||
|
||||
#ifdef AI_UNUSED
|
||||
void LLURLRequest::setBodyLimit(U32 size)
|
||||
{
|
||||
@@ -219,10 +191,10 @@ void LLURLRequest::useProxy(bool use_proxy)
|
||||
}
|
||||
}
|
||||
|
||||
lldebugs << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = \"" << env_proxy << "\"" << llendl;
|
||||
LL_DEBUGS("Proxy") << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = " << (!env_proxy.empty() ? env_proxy : "(null)") << LL_ENDL;
|
||||
|
||||
AICurlEasyRequest_wat curlEasyRequest_w(*mCurlEasyRequest);
|
||||
curlEasyRequest_w->setoptString(CURLOPT_PROXY, use_proxy ? env_proxy : std::string(""));
|
||||
curlEasyRequest_w->setoptString(CURLOPT_PROXY, (use_proxy && !env_proxy.empty()) ? env_proxy : std::string(""));
|
||||
}
|
||||
|
||||
#ifdef AI_UNUSED
|
||||
@@ -314,7 +286,9 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
|
||||
LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
|
||||
//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;
|
||||
@@ -483,6 +457,7 @@ bool LLURLRequest::configure()
|
||||
curlEasyRequest_w->setopt(CURLOPT_FOLLOWLOCATION, 1);
|
||||
rv = true;
|
||||
break;
|
||||
|
||||
case HTTP_GET:
|
||||
curlEasyRequest_w->setopt(CURLOPT_HTTPGET, 1);
|
||||
curlEasyRequest_w->setopt(CURLOPT_FOLLOWLOCATION, 1);
|
||||
@@ -496,8 +471,7 @@ bool LLURLRequest::configure()
|
||||
{
|
||||
// Disable the expect http 1.1 extension. POST and PUT default
|
||||
// to turning this on, and I am not too sure what it means.
|
||||
addHeader("Expect:");
|
||||
|
||||
curlEasyRequest_w->addHeader("Expect:");
|
||||
S32 bytes = bytes_to_send();
|
||||
curlEasyRequest_w->setopt(CURLOPT_UPLOAD, 1);
|
||||
curlEasyRequest_w->setopt(CURLOPT_INFILESIZE, bytes);
|
||||
@@ -506,17 +480,9 @@ bool LLURLRequest::configure()
|
||||
}
|
||||
case HTTP_POST:
|
||||
{
|
||||
// Disable the expect http 1.1 extension. POST and PUT default
|
||||
// to turning this on, and I am not too sure what it means.
|
||||
addHeader("Expect:");
|
||||
|
||||
// Disable the content type http header.
|
||||
// *FIX: what should it be?
|
||||
addHeader("Content-Type:");
|
||||
|
||||
// Set the handle for an http post
|
||||
S32 bytes = bytes_to_send();
|
||||
curlEasyRequest_w->setPost(NULL, bytes);
|
||||
curlEasyRequest_w->setPost(bytes);
|
||||
|
||||
// Set Accept-Encoding to allow response compression
|
||||
curlEasyRequest_w->setoptString(CURLOPT_ENCODING, "");
|
||||
|
||||
@@ -89,6 +89,14 @@ class LLURLRequest : public AICurlEasyRequestStateMachine {
|
||||
*/
|
||||
void addHeader(char const* header);
|
||||
|
||||
/**
|
||||
* @brief Check remote server certificate signed by a known root CA.
|
||||
*
|
||||
* Set whether request will check that remote server
|
||||
* certificates are signed by a known root CA when using HTTPS.
|
||||
*/
|
||||
void checkRootCertificate(bool check);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Handle action specific url request configuration.
|
||||
@@ -108,7 +116,6 @@ class LLURLRequest : public AICurlEasyRequestStateMachine {
|
||||
ERequestAction mAction;
|
||||
std::string mURL;
|
||||
};
|
||||
|
||||
#if 0
|
||||
extern const std::string CONTEXT_REQUEST;
|
||||
extern const std::string CONTEXT_RESPONSE;
|
||||
@@ -205,15 +212,6 @@ public:
|
||||
*/
|
||||
void addHeader(const char* header);
|
||||
|
||||
/**
|
||||
* @brief Check remote server certificate signed by a known root CA.
|
||||
*
|
||||
* Set whether request will check that remote server
|
||||
* certificates are signed by a known root CA when using HTTPS.
|
||||
*/
|
||||
void setSSLVerifyCallback(SSLCertVerifyCallback callback, void * param);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Return at most size bytes of body.
|
||||
*
|
||||
@@ -266,7 +264,6 @@ public:
|
||||
* @brief Give this pipe a chance to handle a generated error
|
||||
*/
|
||||
virtual EStatus handleError(EStatus status, LLPumpIO* pump);
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
@@ -293,11 +290,9 @@ protected:
|
||||
ERequestAction mAction;
|
||||
LLURLRequestDetail* mDetail;
|
||||
LLIOPipe::ptr_t mCompletionCallback;
|
||||
S32 mRequestTransferedBytes;
|
||||
S32 mResponseTransferedBytes;
|
||||
S32 mRequestTransferedBytes;
|
||||
S32 mResponseTransferedBytes;
|
||||
|
||||
static CURLcode _sslCtxCallback(CURL * curl, void *sslctx, void *param);
|
||||
|
||||
bool mRemoved;
|
||||
|
||||
private:
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "message.h"
|
||||
#include "lltimer.h"
|
||||
#include "llextendedstatus.h"
|
||||
|
||||
const S32 LL_XFER_LARGE_PAYLOAD = 7680;
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
#include "v4math.h"
|
||||
#include "lltransfertargetvfile.h"
|
||||
#include "llmemtype.h"
|
||||
#include "llpacketring.h"
|
||||
|
||||
// Constants
|
||||
//const char* MESSAGE_LOG_FILENAME = "message.log";
|
||||
@@ -97,10 +98,8 @@ std::string get_shared_secret();
|
||||
class LLMessagePollInfo
|
||||
{
|
||||
public:
|
||||
LLMessagePollInfo(void) : mPool(LLThread::tldata().mRootPool) { }
|
||||
apr_socket_t *mAPRSocketp;
|
||||
apr_pollfd_t mPollFD;
|
||||
LLAPRPool mPool;
|
||||
};
|
||||
|
||||
namespace
|
||||
@@ -245,7 +244,8 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
|
||||
bool failure_is_fatal,
|
||||
const F32 circuit_heartbeat_interval, const F32 circuit_timeout) :
|
||||
mCircuitInfo(circuit_heartbeat_interval, circuit_timeout),
|
||||
mLastMessageFromTrustedMessageService(false)
|
||||
mLastMessageFromTrustedMessageService(false),
|
||||
mPacketRing(new LLPacketRing)
|
||||
{
|
||||
init();
|
||||
|
||||
@@ -289,13 +289,15 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port,
|
||||
}
|
||||
// LL_DEBUGS("Messaging") << << "*** port: " << mPort << llendl;
|
||||
|
||||
mPollInfop = new LLMessagePollInfo;
|
||||
|
||||
//
|
||||
// Create the data structure that we can poll on
|
||||
//
|
||||
apr_socket_t *aprSocketp = NULL;
|
||||
apr_os_sock_put(&aprSocketp, (apr_os_sock_t*)&mSocket, mPollInfop->mPool());
|
||||
apr_os_sock_put(&aprSocketp, (apr_os_sock_t*)&mSocket, LLAPRRootPool::get()());
|
||||
|
||||
mPollInfop = new LLMessagePollInfo;
|
||||
mPollInfop->mAPRSocketp = aprSocketp;
|
||||
mPollInfop->mPollFD.p = mPollInfop->mPool();
|
||||
mPollInfop->mPollFD.p = LLAPRRootPool::get()();
|
||||
mPollInfop->mPollFD.desc_type = APR_POLL_SOCKET;
|
||||
mPollInfop->mPollFD.reqevents = APR_POLLIN;
|
||||
mPollInfop->mPollFD.rtnevents = 0;
|
||||
@@ -383,6 +385,9 @@ LLMessageSystem::~LLMessageSystem()
|
||||
delete mPollInfop;
|
||||
mPollInfop = NULL;
|
||||
|
||||
delete mPacketRing;
|
||||
mPacketRing = NULL;
|
||||
|
||||
mIncomingCompressedSize = 0;
|
||||
mCurrentRecvPacketID = 0;
|
||||
}
|
||||
@@ -548,13 +553,13 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count )
|
||||
|
||||
U8* buffer = mTrueReceiveBuffer;
|
||||
|
||||
mTrueReceiveSize = mPacketRing.receivePacket(mSocket, (char *)mTrueReceiveBuffer);
|
||||
mTrueReceiveSize = mPacketRing->receivePacket(mSocket, (char *)mTrueReceiveBuffer);
|
||||
// If you want to dump all received packets into SecondLife.log, uncomment this
|
||||
//dumpPacketToLog();
|
||||
|
||||
receive_size = mTrueReceiveSize;
|
||||
mLastSender = mPacketRing.getLastSender();
|
||||
mLastReceivingIF = mPacketRing.getLastReceivingInterface();
|
||||
mLastSender = mPacketRing->getLastSender();
|
||||
mLastReceivingIF = mPacketRing->getLastReceivingInterface();
|
||||
|
||||
if (receive_size < (S32) LL_MINIMUM_VALID_PACKET_SIZE)
|
||||
{
|
||||
@@ -1129,7 +1134,7 @@ S32 LLMessageSystem::flushReliable(const LLHost &host)
|
||||
return send_bytes;
|
||||
}
|
||||
|
||||
LLHTTPClient::ResponderPtr LLMessageSystem::createResponder(const std::string& name)
|
||||
LLFnPtrResponder* LLMessageSystem::createResponder(const std::string& name)
|
||||
{
|
||||
if(mSendReliable)
|
||||
{
|
||||
@@ -1328,7 +1333,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host)
|
||||
}
|
||||
|
||||
BOOL success;
|
||||
success = mPacketRing.sendPacket(mSocket, (char *)buf_ptr, buffer_length, host);
|
||||
success = mPacketRing->sendPacket(mSocket, (char *)buf_ptr, buffer_length, host);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
@@ -3142,7 +3147,7 @@ bool LLMessageSystem::generateDigestForWindowAndUUIDs(char* digest, const S32 wi
|
||||
LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << llendl;
|
||||
}
|
||||
|
||||
U32 now = time(NULL);
|
||||
U32 now = (U32)time(NULL);
|
||||
|
||||
now /= window;
|
||||
|
||||
@@ -3162,7 +3167,7 @@ bool LLMessageSystem::isMatchingDigestForWindowAndUUIDs(const char* digest, cons
|
||||
}
|
||||
|
||||
char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */
|
||||
U32 now = time(NULL);
|
||||
U32 now = (U32)time(NULL);
|
||||
|
||||
now /= window;
|
||||
|
||||
@@ -3208,7 +3213,7 @@ bool LLMessageSystem::generateDigestForWindow(char* digest, const S32 window) co
|
||||
LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << llendl;
|
||||
}
|
||||
|
||||
U32 now = time(NULL);
|
||||
U32 now = (U32)time(NULL);
|
||||
|
||||
now /= window;
|
||||
|
||||
@@ -3361,7 +3366,7 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_
|
||||
|
||||
void LLMessageSystem::dumpPacketToLog()
|
||||
{
|
||||
LL_WARNS("Messaging") << "Packet Dump from:" << mPacketRing.getLastSender() << llendl;
|
||||
LL_WARNS("Messaging") << "Packet Dump from:" << mPacketRing->getLastSender() << llendl;
|
||||
LL_WARNS("Messaging") << "Packet Size:" << mTrueReceiveSize << llendl;
|
||||
char line_buffer[256]; /* Flawfinder: ignore */
|
||||
S32 i;
|
||||
|
||||
@@ -48,9 +48,9 @@
|
||||
#include "string_table.h"
|
||||
#include "llcircuit.h"
|
||||
#include "lltimer.h"
|
||||
#include "llpacketring.h"
|
||||
//#include "llpacketring.h"
|
||||
#include "llhost.h"
|
||||
#include "llhttpclient.h"
|
||||
//#include "llhttpclient.h"
|
||||
#include "llhttpnode.h"
|
||||
#include "llpacketack.h"
|
||||
#include "llsingleton.h"
|
||||
@@ -61,6 +61,12 @@
|
||||
|
||||
#include "llstoredmessage.h"
|
||||
|
||||
class LLPacketRing;
|
||||
namespace
|
||||
{
|
||||
class LLFnPtrResponder;
|
||||
}
|
||||
|
||||
const U32 MESSAGE_MAX_STRINGS_LENGTH = 64;
|
||||
const U32 MESSAGE_NUMBER_OF_HASH_BUCKETS = 8192;
|
||||
|
||||
@@ -213,7 +219,7 @@ class LLMessageSystem : public LLMessageSenderInterface
|
||||
LLHost mUntrustedInterface;
|
||||
|
||||
public:
|
||||
LLPacketRing mPacketRing;
|
||||
LLPacketRing* mPacketRing;
|
||||
LLReliablePacketParams mReliablePacketParams;
|
||||
|
||||
// Set this flag to TRUE when you want *very* verbose logs.
|
||||
@@ -494,7 +500,7 @@ public:
|
||||
void (*callback)(void **,S32),
|
||||
void ** callback_data);
|
||||
|
||||
LLHTTPClient::ResponderPtr createResponder(const std::string& name);
|
||||
LLFnPtrResponder* createResponder(const std::string& name);
|
||||
S32 sendMessage(const LLHost &host);
|
||||
S32 sendMessage(const U32 circuit);
|
||||
private:
|
||||
|
||||
@@ -945,7 +945,6 @@ char const* const _PREHASH_SysGPU = LLMessageStringTable::getInstance()->getStri
|
||||
char const* const _PREHASH_AvatarInterestsReply = LLMessageStringTable::getInstance()->getString("AvatarInterestsReply");
|
||||
char const* const _PREHASH_StartLure = LLMessageStringTable::getInstance()->getString("StartLure");
|
||||
char const* const _PREHASH_SysRAM = LLMessageStringTable::getInstance()->getString("SysRAM");
|
||||
char const* const _PREHASH_ObjectPosition = LLMessageStringTable::getInstance()->getString("ObjectPosition");
|
||||
char const* const _PREHASH_SitPosition = LLMessageStringTable::getInstance()->getString("SitPosition");
|
||||
char const* const _PREHASH_StartTime = LLMessageStringTable::getInstance()->getString("StartTime");
|
||||
char const* const _PREHASH_BornOn = LLMessageStringTable::getInstance()->getString("BornOn");
|
||||
@@ -1001,7 +1000,6 @@ char const* const _PREHASH_SnapshotID = LLMessageStringTable::getInstance()->get
|
||||
char const* const _PREHASH_Aspect = LLMessageStringTable::getInstance()->getString("Aspect");
|
||||
char const* const _PREHASH_ParamSize = LLMessageStringTable::getInstance()->getString("ParamSize");
|
||||
char const* const _PREHASH_VoteCast = LLMessageStringTable::getInstance()->getString("VoteCast");
|
||||
char const* const _PREHASH_CastsShadows = LLMessageStringTable::getInstance()->getString("CastsShadows");
|
||||
char const* const _PREHASH_EveryoneMask = LLMessageStringTable::getInstance()->getString("EveryoneMask");
|
||||
char const* const _PREHASH_ObjectSpinUpdate = LLMessageStringTable::getInstance()->getString("ObjectSpinUpdate");
|
||||
char const* const _PREHASH_MaturePublish = LLMessageStringTable::getInstance()->getString("MaturePublish");
|
||||
@@ -1050,7 +1048,6 @@ char const* const _PREHASH_SimIP = LLMessageStringTable::getInstance()->getStrin
|
||||
char const* const _PREHASH_GodID = LLMessageStringTable::getInstance()->getString("GodID");
|
||||
char const* const _PREHASH_TeleportMinPrice = LLMessageStringTable::getInstance()->getString("TeleportMinPrice");
|
||||
char const* const _PREHASH_VoteItem = LLMessageStringTable::getInstance()->getString("VoteItem");
|
||||
char const* const _PREHASH_ObjectRotation = LLMessageStringTable::getInstance()->getString("ObjectRotation");
|
||||
char const* const _PREHASH_SitRotation = LLMessageStringTable::getInstance()->getString("SitRotation");
|
||||
char const* const _PREHASH_SnapSelection = LLMessageStringTable::getInstance()->getString("SnapSelection");
|
||||
char const* const _PREHASH_SoundTrigger = LLMessageStringTable::getInstance()->getString("SoundTrigger");
|
||||
|
||||
@@ -945,7 +945,6 @@ extern char const* const _PREHASH_SysGPU;
|
||||
extern char const* const _PREHASH_AvatarInterestsReply;
|
||||
extern char const* const _PREHASH_StartLure;
|
||||
extern char const* const _PREHASH_SysRAM;
|
||||
extern char const* const _PREHASH_ObjectPosition;
|
||||
extern char const* const _PREHASH_SitPosition;
|
||||
extern char const* const _PREHASH_StartTime;
|
||||
extern char const* const _PREHASH_BornOn;
|
||||
@@ -1001,7 +1000,6 @@ extern char const* const _PREHASH_SnapshotID;
|
||||
extern char const* const _PREHASH_Aspect;
|
||||
extern char const* const _PREHASH_ParamSize;
|
||||
extern char const* const _PREHASH_VoteCast;
|
||||
extern char const* const _PREHASH_CastsShadows;
|
||||
extern char const* const _PREHASH_EveryoneMask;
|
||||
extern char const* const _PREHASH_ObjectSpinUpdate;
|
||||
extern char const* const _PREHASH_MaturePublish;
|
||||
@@ -1050,7 +1048,6 @@ extern char const* const _PREHASH_SimIP;
|
||||
extern char const* const _PREHASH_GodID;
|
||||
extern char const* const _PREHASH_TeleportMinPrice;
|
||||
extern char const* const _PREHASH_VoteItem;
|
||||
extern char const* const _PREHASH_ObjectRotation;
|
||||
extern char const* const _PREHASH_SitRotation;
|
||||
extern char const* const _PREHASH_SnapSelection;
|
||||
extern char const* const _PREHASH_SoundTrigger;
|
||||
|
||||
Reference in New Issue
Block a user