summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llcurl.cpp2
-rw-r--r--indra/llmessage/llhttpclient.cpp33
-rw-r--r--indra/llmessage/lliohttpserver.cpp2
3 files changed, 29 insertions, 8 deletions
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 8c7392090c..1107945b56 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -751,7 +751,7 @@ bool LLCurlRequest::post(const std::string& url, const LLSD& data, LLCurl::Respo
easy->setopt(CURLOPT_POSTFIELDS, (void*)NULL);
easy->setopt(CURLOPT_POSTFIELDSIZE, bytes);
- easy->slist_append("Content-Type: application/xml");
+ easy->slist_append("Content-Type: application/llsd+xml");
easy->setHeaders();
lldebugs << "POSTING: " << bytes << " bytes." << llendl;
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 2f822aee87..5bf0c08e67 100644
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -106,7 +106,7 @@ namespace
LLSDInjector(const LLSD& sd) : mSD(sd) {}
virtual ~LLSDInjector() {}
- const char* contentType() { return "application/xml"; }
+ const char* contentType() { return "application/llsd+xml"; }
virtual EStatus process_impl(const LLChannelDescriptors& channels,
buffer_ptr_t& buffer, bool& eos, LLSD& context, LLPumpIO* pump)
@@ -238,7 +238,8 @@ static void request(
//the Pragma header it so gratuitously inserts
//Before inserting the header, force libcurl
//to not use the proxy (read: llurlrequest.cpp)
- if ((iter->first == "Pragma") && (iter->second.asString() == ""))
+ static const std::string PRAGMA("Pragma");
+ if ((iter->first == PRAGMA) && (iter->second.asString().empty()))
{
req->useProxy(false);
}
@@ -247,6 +248,16 @@ static void request(
req->addHeader(header.str().c_str());
}
}
+
+ // Check to see if we have already set Accept or not. If no one
+ // set it, set it to application/llsd+xml since that's what we
+ // almost always want.
+ static const std::string ACCEPT("Accept");
+ if(!headers.has(ACCEPT))
+ {
+ req->addHeader("Accept: application/llsd+xml");
+ }
+
req->setCallback(new LLHTTPClientURLAdaptor(responder));
if (method == LLURLRequest::HTTP_POST && gMessageSystem)
@@ -254,12 +265,22 @@ static void request(
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());
-
+ static const std::string CONTENT_TYPE("Content-Type");
+ if(!headers.has(CONTENT_TYPE))
+ {
+ // If the Content-Type header was passed in, it has
+ // already been added as a header through req->addHeader
+ // in the loop above. We defer to the caller's wisdom, but
+ // if they did not specify a Content-Type, then ask the
+ // injector.
+ req->addHeader(
+ llformat(
+ "Content-Type: %s",
+ body_injector->contentType()).c_str());
+ }
chain.push_back(LLIOPipe::ptr_t(body_injector));
}
diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp
index a2e0325ae7..6d157206c8 100644
--- a/indra/llmessage/lliohttpserver.cpp
+++ b/indra/llmessage/lliohttpserver.cpp
@@ -240,7 +240,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl(
case STATE_GOOD_RESULT:
{
LLSD headers = mHeaders;
- headers["Content-Type"] = "application/xml";
+ headers["Content-Type"] = "application/llsd+xml";
context[CONTEXT_RESPONSE][CONTEXT_HEADERS] = headers;
LLBufferStream ostr(channels, buffer.get());
LLSDSerialize::toXML(mGoodResult, ostr);