aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/lliohttpserver.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:54 -0500
committerJacek Antonelli2008-08-15 23:44:54 -0500
commitb2afb8800bb033a04bb3ecdf0363068d56648ef1 (patch)
tree3568129b5bbddb47cd39d622b4137a8fbff4abaf /linden/indra/llmessage/lliohttpserver.cpp
parentSecond Life viewer sources 1.14.0.1 (diff)
downloadmeta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.zip
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.gz
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.bz2
meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.xz
Second Life viewer sources 1.15.0.2
Diffstat (limited to '')
-rw-r--r--linden/indra/llmessage/lliohttpserver.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/linden/indra/llmessage/lliohttpserver.cpp b/linden/indra/llmessage/lliohttpserver.cpp
index 25c1aef..9ea7272 100644
--- a/linden/indra/llmessage/lliohttpserver.cpp
+++ b/linden/indra/llmessage/lliohttpserver.cpp
@@ -6,6 +6,7 @@
6 * 6 *
7 * Copyright (c) 2005-2007, Linden Research, Inc. 7 * Copyright (c) 2005-2007, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code
9 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
10 * to you under the terms of the GNU General Public License, version 2.0 11 * to you under the terms of the GNU General Public License, version 2.0
11 * ("GPL"), unless you have obtained a separate licensing agreement 12 * ("GPL"), unless you have obtained a separate licensing agreement
@@ -46,6 +47,8 @@
46#include "llsdserialize_xml.h" 47#include "llsdserialize_xml.h"
47#include "llstl.h" 48#include "llstl.h"
48 49
50#include <sstream>
51
49static const char HTTP_VERSION_STR[] = "HTTP/1.0"; 52static const char HTTP_VERSION_STR[] = "HTTP/1.0";
50static const std::string CONTEXT_REQUEST("request"); 53static const std::string CONTEXT_REQUEST("request");
51static const std::string HTTP_VERB_GET("GET"); 54static const std::string HTTP_VERB_GET("GET");
@@ -393,7 +396,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
393class LLHTTPResponder : public LLIOPipe 396class LLHTTPResponder : public LLIOPipe
394{ 397{
395public: 398public:
396 LLHTTPResponder(const LLHTTPNode& tree); 399 LLHTTPResponder(const LLHTTPNode& tree, const LLSD& ctx);
397 ~LLHTTPResponder(); 400 ~LLHTTPResponder();
398 401
399protected: 402protected:
@@ -454,6 +457,7 @@ protected:
454 STATE_SHORT_CIRCUIT 457 STATE_SHORT_CIRCUIT
455 }; 458 };
456 459
460 LLSD mBuildContext;
457 EState mState; 461 EState mState;
458 U8* mLastRead; 462 U8* mLastRead;
459 std::string mVerb; 463 std::string mVerb;
@@ -462,12 +466,14 @@ protected:
462 std::string mQuery; 466 std::string mQuery;
463 std::string mVersion; 467 std::string mVersion;
464 S32 mContentLength; 468 S32 mContentLength;
469 LLSD mHeaders;
465 470
466 // handle the urls 471 // handle the urls
467 const LLHTTPNode& mRootNode; 472 const LLHTTPNode& mRootNode;
468}; 473};
469 474
470LLHTTPResponder::LLHTTPResponder(const LLHTTPNode& tree) : 475LLHTTPResponder::LLHTTPResponder(const LLHTTPNode& tree, const LLSD& ctx) :
476 mBuildContext(ctx),
471 mState(STATE_NOTHING), 477 mState(STATE_NOTHING),
472 mLastRead(NULL), 478 mLastRead(NULL),
473 mContentLength(0), 479 mContentLength(0),
@@ -655,6 +661,11 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
655 lldebugs << "Content-Length: " << value << llendl; 661 lldebugs << "Content-Length: " << value << llendl;
656 mContentLength = atoi(value.c_str()); 662 mContentLength = atoi(value.c_str());
657 } 663 }
664 else
665 {
666 LLString::trimTail(value);
667 mHeaders[name] = value;
668 }
658 } 669 }
659 } 670 }
660 } 671 }
@@ -720,6 +731,11 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
720 chain.push_back(LLIOPipe::ptr_t(new LLIOFlush)); 731 chain.push_back(LLIOPipe::ptr_t(new LLIOFlush));
721 context[CONTEXT_REQUEST]["path"] = mPath; 732 context[CONTEXT_REQUEST]["path"] = mPath;
722 context[CONTEXT_REQUEST]["query-string"] = mQuery; 733 context[CONTEXT_REQUEST]["query-string"] = mQuery;
734 context[CONTEXT_REQUEST]["remote-host"]
735 = mBuildContext["remote-host"];
736 context[CONTEXT_REQUEST]["remote-port"]
737 = mBuildContext["remote-port"];
738 context[CONTEXT_REQUEST]["headers"] = mHeaders;
723 739
724 const LLChainIOFactory* protocolHandler 740 const LLChainIOFactory* protocolHandler
725 = node->getProtocolHandler(); 741 = node->getProtocolHandler();
@@ -804,9 +820,10 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl(
804 820
805 821
806 822
807void LLCreateHTTPPipe(LLPumpIO::chain_t& chain, const LLHTTPNode& root) 823void LLCreateHTTPPipe(LLPumpIO::chain_t& chain,
824 const LLHTTPNode& root, const LLSD& ctx)
808{ 825{
809 chain.push_back(LLIOPipe::ptr_t(new LLHTTPResponder(root))); 826 chain.push_back(LLIOPipe::ptr_t(new LLHTTPResponder(root, ctx)));
810} 827}
811 828
812 829
@@ -815,7 +832,7 @@ class LLHTTPResponseFactory : public LLChainIOFactory
815public: 832public:
816 bool build(LLPumpIO::chain_t& chain, LLSD ctx) const 833 bool build(LLPumpIO::chain_t& chain, LLSD ctx) const
817 { 834 {
818 LLCreateHTTPPipe(chain, mTree); 835 LLCreateHTTPPipe(chain, mTree, ctx);
819 return true; 836 return true;
820 } 837 }
821 838