diff options
Diffstat (limited to 'linden/indra/llmessage/llhttpnode.cpp')
-rw-r--r-- | linden/indra/llmessage/llhttpnode.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/linden/indra/llmessage/llhttpnode.cpp b/linden/indra/llmessage/llhttpnode.cpp index 46f2061..772fb17 100644 --- a/linden/indra/llmessage/llhttpnode.cpp +++ b/linden/indra/llmessage/llhttpnode.cpp | |||
@@ -174,6 +174,26 @@ LLSD LLHTTPNode::del(const LLSD&) const | |||
174 | throw NotImplemented(); | 174 | throw NotImplemented(); |
175 | } | 175 | } |
176 | 176 | ||
177 | // virtual | ||
178 | void LLHTTPNode::options(ResponsePtr response, const LLSD& context) const | ||
179 | { | ||
180 | //llinfos << "options context: " << context << llendl; | ||
181 | |||
182 | // default implementation constructs an url to the documentation. | ||
183 | std::string host = context[CONTEXT_REQUEST]["headers"]["host"].asString(); | ||
184 | if(host.empty()) | ||
185 | { | ||
186 | response->status(400, "Bad Request -- need Host header"); | ||
187 | return; | ||
188 | } | ||
189 | std::ostringstream ostr; | ||
190 | ostr << "http://" << host << "/web/server/api"; | ||
191 | ostr << context[CONTEXT_REQUEST]["path"].asString(); | ||
192 | static const std::string DOC_HEADER("X-Documentation-URL"); | ||
193 | response->addHeader(DOC_HEADER, ostr.str()); | ||
194 | response->status(200, "OK"); | ||
195 | } | ||
196 | |||
177 | 197 | ||
178 | // virtual | 198 | // virtual |
179 | LLHTTPNode* LLHTTPNode::getChild(const std::string& name, LLSD& context) const | 199 | LLHTTPNode* LLHTTPNode::getChild(const std::string& name, LLSD& context) const |
@@ -386,6 +406,13 @@ void LLHTTPNode::Response::methodNotAllowed() | |||
386 | status(405, "Method Not Allowed"); | 406 | status(405, "Method Not Allowed"); |
387 | } | 407 | } |
388 | 408 | ||
409 | void LLHTTPNode::Response::addHeader( | ||
410 | const std::string& name, | ||
411 | const std::string& value) | ||
412 | { | ||
413 | mHeaders[name] = value; | ||
414 | } | ||
415 | |||
389 | void LLHTTPNode::describe(Description& desc) const | 416 | void LLHTTPNode::describe(Description& desc) const |
390 | { | 417 | { |
391 | desc.shortInfo("unknown service (missing describe() method)"); | 418 | desc.shortInfo("unknown service (missing describe() method)"); |