diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llmessage/llhttpnode.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to '')
-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)"); |