summaryrefslogtreecommitdiff
path: root/indra/llmessage/llhttpnode.cpp
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2013-04-04 21:50:45 +0000
committerDon Kjer <don@lindenlab.com>2013-04-04 21:50:45 +0000
commitbeeefb45269f45ea717f58b30a0985951ae23c20 (patch)
tree34f48c7703588b64bb625984f77a74752997099f /indra/llmessage/llhttpnode.cpp
parent7c37af37d4459425b3ab705156eeff316531bc81 (diff)
Renaming HTTP_HEADER_* into HTTP_IN_HEADER_* and HTTP_OUT_HEADER_* to make it more clear which header strings should be used for incoming vs outgoing situations.
Using constants for commonly used llhttpnode context strings.
Diffstat (limited to 'indra/llmessage/llhttpnode.cpp')
-rw-r--r--indra/llmessage/llhttpnode.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/indra/llmessage/llhttpnode.cpp b/indra/llmessage/llhttpnode.cpp
index e3b42b1b16..c0c3d0bcbe 100644
--- a/indra/llmessage/llhttpnode.cpp
+++ b/indra/llmessage/llhttpnode.cpp
@@ -31,9 +31,14 @@
#include "llstl.h"
#include "llhttpconstants.h"
-#include "lliohttpserver.h" // for string constants
-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
@@ -177,9 +182,8 @@ void LLHTTPNode::options(ResponsePtr response, const LLSD& context) const
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][HTTP_HEADER_LOWER_HOST].asString());
+ context[CONTEXT_REQUEST][CONTEXT_HEADERS][HTTP_IN_HEADER_HOST].asString());
if(host.empty())
{
response->status(HTTP_BAD_REQUEST, "Bad Request -- need Host header");
@@ -187,7 +191,7 @@ void LLHTTPNode::options(ResponsePtr response, const LLSD& context) const
}
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(HTTP_OK, "OK");