diff options
author | Kyle Ambroff <ambroff@lindenlab.com> | 2008-06-21 07:39:52 +0000 |
---|---|---|
committer | Kyle Ambroff <ambroff@lindenlab.com> | 2008-06-21 07:39:52 +0000 |
commit | dc3f5ff87cfa085998bf69db6dedad45440419d3 (patch) | |
tree | e6c54376390a110e0e91ea0139ce6bb54925ffae /indra/llmessage/llhttpnode.cpp | |
parent | af080d1c62f1a2cdc17c3870427f07ad0cf9534f (diff) |
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
Diffstat (limited to 'indra/llmessage/llhttpnode.cpp')
-rw-r--r-- | indra/llmessage/llhttpnode.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
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)"); |