From dc3f5ff87cfa085998bf69db6dedad45440419d3 Mon Sep 17 00:00:00 2001 From: Kyle Ambroff Date: Sat, 21 Jun 2008 07:39:52 +0000 Subject: svn merge -r90150:90340 svn+ssh://svn.lindenlab.com/svn/linden/branches/qar-699_combo-merge --> release QAR-699 - Combo merge for QAR-687, QAR-637, QAR-586 * QAR-687 - Test build with libs on S3 * QAR-637 Test dynamic sound throttle * QAR-586 Test new http features branch --- indra/llmessage/llhttpnode.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'indra/llmessage/llhttpnode.cpp') diff --git a/indra/llmessage/llhttpnode.cpp b/indra/llmessage/llhttpnode.cpp index 196aa5f8cf..91605b4008 100644 --- a/indra/llmessage/llhttpnode.cpp +++ b/indra/llmessage/llhttpnode.cpp @@ -174,6 +174,26 @@ LLSD LLHTTPNode::del(const LLSD&) const throw NotImplemented(); } +// virtual +void LLHTTPNode::options(ResponsePtr response, const LLSD& context) const +{ + //llinfos << "options context: " << context << llendl; + + // default implementation constructs an url to the documentation. + std::string host = context[CONTEXT_REQUEST]["headers"]["host"].asString(); + if(host.empty()) + { + response->status(400, "Bad Request -- need Host header"); + return; + } + std::ostringstream ostr; + ostr << "http://" << host << "/web/server/api"; + ostr << context[CONTEXT_REQUEST]["path"].asString(); + static const std::string DOC_HEADER("X-Documentation-URL"); + response->addHeader(DOC_HEADER, ostr.str()); + response->status(200, "OK"); +} + // virtual LLHTTPNode* LLHTTPNode::getChild(const std::string& name, LLSD& context) const @@ -386,6 +406,13 @@ void LLHTTPNode::Response::methodNotAllowed() status(405, "Method Not Allowed"); } +void LLHTTPNode::Response::addHeader( + const std::string& name, + const std::string& value) +{ + mHeaders[name] = value; +} + void LLHTTPNode::describe(Description& desc) const { desc.shortInfo("unknown service (missing describe() method)"); -- cgit v1.2.3