diff options
author | simon <none@none> | 2014-06-17 10:40:42 -0700 |
---|---|---|
committer | simon <none@none> | 2014-06-17 10:40:42 -0700 |
commit | 592024b5805a116c9d0bef893127427df0741b41 (patch) | |
tree | bcadc0685873b40e23254cf3d6232e8f1f3f0e1b /indra/llmessage/llhttpnode.cpp | |
parent | 9e855b03b7f285794520eaf781b6a963b6cd51d9 (diff) | |
parent | 977476171ddcc057d7c28b6c14ae988b8189ed75 (diff) |
Merge viewer-release and become version 3.7.9
Diffstat (limited to 'indra/llmessage/llhttpnode.cpp')
-rwxr-xr-x | indra/llmessage/llhttpnode.cpp | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/indra/llmessage/llhttpnode.cpp b/indra/llmessage/llhttpnode.cpp index f1f4a95005..f235965879 100755 --- a/indra/llmessage/llhttpnode.cpp +++ b/indra/llmessage/llhttpnode.cpp @@ -30,9 +30,15 @@ #include <boost/tokenizer.hpp> #include "llstl.h" -#include "lliohttpserver.h" // for string constants +#include "llhttpconstants.h" -static const std::string CONTEXT_WILDCARD("wildcard"); +const std::string CONTEXT_HEADERS("headers"); +const std::string CONTEXT_PATH("path"); +const std::string CONTEXT_QUERY_STRING("query-string"); +const std::string CONTEXT_REQUEST("request"); +const std::string CONTEXT_RESPONSE("response"); +const std::string CONTEXT_VERB("verb"); +const std::string CONTEXT_WILDCARD("wildcard"); /** * LLHTTPNode @@ -173,21 +179,23 @@ LLSD LLHTTPNode::simpleDel(const LLSD&) const void LLHTTPNode::options(ResponsePtr response, const LLSD& context) const { //LL_INFOS() << "options context: " << context << LL_ENDL; + LL_DEBUGS("LLHTTPNode") << "context: " << context << LL_ENDL; // default implementation constructs an url to the documentation. + // *TODO: Check for 'Host' header instead of 'host' header? std::string host( - context[CONTEXT_REQUEST][CONTEXT_HEADERS]["host"].asString()); + context[CONTEXT_REQUEST][CONTEXT_HEADERS][HTTP_IN_HEADER_HOST].asString()); if(host.empty()) { - response->status(400, "Bad Request -- need Host header"); + response->status(HTTP_BAD_REQUEST, "Bad Request -- need Host header"); return; } std::ostringstream ostr; ostr << "http://" << host << "/web/server/api"; - ostr << context[CONTEXT_REQUEST]["path"].asString(); + ostr << context[CONTEXT_REQUEST][CONTEXT_PATH].asString(); static const std::string DOC_HEADER("X-Documentation-URL"); response->addHeader(DOC_HEADER, ostr.str()); - response->status(200, "OK"); + response->status(HTTP_OK, "OK"); } @@ -389,17 +397,17 @@ void LLHTTPNode::Response::statusUnknownError(S32 code) void LLHTTPNode::Response::notFound(const std::string& message) { - status(404, message); + status(HTTP_NOT_FOUND, message); } void LLHTTPNode::Response::notFound() { - status(404, "Not Found"); + status(HTTP_NOT_FOUND, "Not Found"); } void LLHTTPNode::Response::methodNotAllowed() { - status(405, "Method Not Allowed"); + status(HTTP_METHOD_NOT_ALLOWED, "Method Not Allowed"); } void LLHTTPNode::Response::addHeader( @@ -467,7 +475,7 @@ LLSimpleResponse::~LLSimpleResponse() void LLSimpleResponse::result(const LLSD& result) { - status(200, "OK"); + status(HTTP_OK, "OK"); } void LLSimpleResponse::extendedResult(S32 code, const std::string& body, const LLSD& headers) @@ -475,6 +483,11 @@ void LLSimpleResponse::extendedResult(S32 code, const std::string& body, const L status(code,body); } +void LLSimpleResponse::extendedResult(S32 code, const LLSD& r, const LLSD& headers) +{ + status(code,"(LLSD)"); +} + void LLSimpleResponse::status(S32 code, const std::string& message) { mCode = code; |