summaryrefslogtreecommitdiff
path: root/indra/llmessage/llhttpclient.cpp
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2007-05-01 21:39:25 +0000
committerDon Kjer <don@lindenlab.com>2007-05-01 21:39:25 +0000
commit4ecb9cb63e4993b3b4bc65d73ed255139b5c3f75 (patch)
tree48d9bb9a1ae468ecdbd53cf21a598d66ee8eced3 /indra/llmessage/llhttpclient.cpp
parentf5e9ce7e47694e349a4eb28b052016b11e1bdf81 (diff)
svn merge -r 59163:61099 svn+ssh://svn/svn/linden/branches/release-candidate into release
Diffstat (limited to 'indra/llmessage/llhttpclient.cpp')
-rw-r--r--indra/llmessage/llhttpclient.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 121cbd2e68..92c309f1bc 100644
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -18,6 +18,7 @@
#include "llvfile.h"
#include "llvfs.h"
+#include "message.h"
#include <curl/curl.h>
const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f;
@@ -92,6 +93,14 @@ namespace
if (200 <= mStatus && mStatus < 300)
{
LLSDSerialize::fromXML(content, istr);
+/*
+ const S32 parseError = -1;
+ if(LLSDSerialize::fromXML(content, istr) == parseError)
+ {
+ mStatus = 498;
+ mReason = "Client Parse Error";
+ }
+*/
}
if (mResponder.get())
@@ -232,10 +241,17 @@ static void request(const std::string& url, LLURLRequest::ERequestAction method,
}
req->setCallback(new LLHTTPClientURLAdaptor(responder));
+ if (method == LLURLRequest::HTTP_POST && gMessageSystem) {
+ req->addHeader(llformat("X-SecondLife-UDP-Listen-Port: %d",
+ gMessageSystem->mPort).c_str());
+ }
+
if (method == LLURLRequest::HTTP_PUT || method == LLURLRequest::HTTP_POST)
{
- req->addHeader(llformat("Content-Type: %s", body_injector->contentType()).c_str());
- chain.push_back(LLIOPipe::ptr_t(body_injector));
+ req->addHeader(llformat("Content-Type: %s",
+ body_injector->contentType()).c_str());
+
+ chain.push_back(LLIOPipe::ptr_t(body_injector));
}
chain.push_back(LLIOPipe::ptr_t(req));
@@ -293,6 +309,14 @@ LLSD LLHTTPClient::blockingGet(const std::string& url)
LLHTTPBuffer http_buffer;
+ // Without this timeout, blockingGet() calls have been observed to take
+ // up to 90 seconds to complete. Users of blockingGet() already must
+ // check the HTTP return code for validity, so this will not introduce
+ // new errors. A 5 second timeout will succeed > 95% of the time (and
+ // probably > 99% of the time) based on my statistics. JC
+ curl_easy_setopt(curlp, CURLOPT_NOSIGNAL, 1); // don't use SIGALRM for timeouts
+ curl_easy_setopt(curlp, CURLOPT_TIMEOUT, 5); // seconds
+
curl_easy_setopt(curlp, CURLOPT_WRITEFUNCTION, LLHTTPBuffer::curl_write);
curl_easy_setopt(curlp, CURLOPT_WRITEDATA, &http_buffer);
curl_easy_setopt(curlp, CURLOPT_URL, url.c_str());
@@ -382,7 +406,7 @@ namespace boost
void intrusive_ptr_release(LLHTTPClient::Responder* p)
{
- if(0 == --p->mReferenceCount)
+ if(p && 0 == --p->mReferenceCount)
{
delete p;
}