summaryrefslogtreecommitdiff
path: root/indra/llmessage/lliohttpserver.cpp
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2007-05-01 21:39:25 +0000
committerDon Kjer <don@lindenlab.com>2007-05-01 21:39:25 +0000
commit4ecb9cb63e4993b3b4bc65d73ed255139b5c3f75 (patch)
tree48d9bb9a1ae468ecdbd53cf21a598d66ee8eced3 /indra/llmessage/lliohttpserver.cpp
parentf5e9ce7e47694e349a4eb28b052016b11e1bdf81 (diff)
svn merge -r 59163:61099 svn+ssh://svn/svn/linden/branches/release-candidate into release
Diffstat (limited to 'indra/llmessage/lliohttpserver.cpp')
-rw-r--r--indra/llmessage/lliohttpserver.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp
index c1a9bc442e..869012e431 100644
--- a/indra/llmessage/lliohttpserver.cpp
+++ b/indra/llmessage/lliohttpserver.cpp
@@ -27,6 +27,8 @@
#include "llsdserialize_xml.h"
#include "llstl.h"
+#include <sstream>
+
static const char HTTP_VERSION_STR[] = "HTTP/1.0";
static const std::string CONTEXT_REQUEST("request");
static const std::string HTTP_VERB_GET("GET");
@@ -374,7 +376,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
class LLHTTPResponder : public LLIOPipe
{
public:
- LLHTTPResponder(const LLHTTPNode& tree);
+ LLHTTPResponder(const LLHTTPNode& tree, const LLSD& ctx);
~LLHTTPResponder();
protected:
@@ -435,6 +437,7 @@ protected:
STATE_SHORT_CIRCUIT
};
+ LLSD mBuildContext;
EState mState;
U8* mLastRead;
std::string mVerb;
@@ -443,12 +446,14 @@ protected:
std::string mQuery;
std::string mVersion;
S32 mContentLength;
+ LLSD mHeaders;
// handle the urls
const LLHTTPNode& mRootNode;
};
-LLHTTPResponder::LLHTTPResponder(const LLHTTPNode& tree) :
+LLHTTPResponder::LLHTTPResponder(const LLHTTPNode& tree, const LLSD& ctx) :
+ mBuildContext(ctx),
mState(STATE_NOTHING),
mLastRead(NULL),
mContentLength(0),
@@ -636,6 +641,11 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
lldebugs << "Content-Length: " << value << llendl;
mContentLength = atoi(value.c_str());
}
+ else
+ {
+ LLString::trimTail(value);
+ mHeaders[name] = value;
+ }
}
}
}
@@ -701,6 +711,11 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
chain.push_back(LLIOPipe::ptr_t(new LLIOFlush));
context[CONTEXT_REQUEST]["path"] = mPath;
context[CONTEXT_REQUEST]["query-string"] = mQuery;
+ context[CONTEXT_REQUEST]["remote-host"]
+ = mBuildContext["remote-host"];
+ context[CONTEXT_REQUEST]["remote-port"]
+ = mBuildContext["remote-port"];
+ context[CONTEXT_REQUEST]["headers"] = mHeaders;
const LLChainIOFactory* protocolHandler
= node->getProtocolHandler();
@@ -785,9 +800,10 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
-void LLCreateHTTPPipe(LLPumpIO::chain_t& chain, const LLHTTPNode& root)
+void LLCreateHTTPPipe(LLPumpIO::chain_t& chain,
+ const LLHTTPNode& root, const LLSD& ctx)
{
- chain.push_back(LLIOPipe::ptr_t(new LLHTTPResponder(root)));
+ chain.push_back(LLIOPipe::ptr_t(new LLHTTPResponder(root, ctx)));
}
@@ -796,7 +812,7 @@ class LLHTTPResponseFactory : public LLChainIOFactory
public:
bool build(LLPumpIO::chain_t& chain, LLSD ctx) const
{
- LLCreateHTTPPipe(chain, mTree);
+ LLCreateHTTPPipe(chain, mTree, ctx);
return true;
}