diff options
| author | Kyle Ambroff <ambroff@lindenlab.com> | 2008-06-21 07:39:52 +0000 |
|---|---|---|
| committer | Kyle Ambroff <ambroff@lindenlab.com> | 2008-06-21 07:39:52 +0000 |
| commit | dc3f5ff87cfa085998bf69db6dedad45440419d3 (patch) | |
| tree | e6c54376390a110e0e91ea0139ce6bb54925ffae /indra/llmessage/llhttpnode.h | |
| parent | af080d1c62f1a2cdc17c3870427f07ad0cf9534f (diff) | |
svn merge -r90150:90340 svn+ssh://svn.lindenlab.com/svn/linden/branches/qar-699_combo-merge --> release
QAR-699 - Combo merge for QAR-687, QAR-637, QAR-586
* QAR-687 - Test build with libs on S3
* QAR-637 Test dynamic sound throttle
* QAR-586 Test new http features branch
Diffstat (limited to 'indra/llmessage/llhttpnode.h')
| -rw-r--r-- | indra/llmessage/llhttpnode.h | 88 |
1 files changed, 67 insertions, 21 deletions
diff --git a/indra/llmessage/llhttpnode.h b/indra/llmessage/llhttpnode.h index e27056a51f..54715f2b38 100644 --- a/indra/llmessage/llhttpnode.h +++ b/indra/llmessage/llhttpnode.h @@ -82,33 +82,79 @@ public: */ //@{ public: - virtual LLSD get() const; - virtual LLSD put(const LLSD& input) const; - virtual LLSD post(const LLSD& input) const; - virtual LLSD del(const LLSD& context) const; + virtual LLSD get() const; + virtual LLSD put(const LLSD& input) const; + virtual LLSD post(const LLSD& input) const; + virtual LLSD del(const LLSD& context) const; - class Response : public LLRefCount - { - protected: - virtual ~Response(); + class Response : public LLRefCount + { + protected: + virtual ~Response(); - public: - virtual void result(const LLSD&) = 0; - virtual void status(S32 code, const std::string& message) = 0; + public: + /** + * @brief Return the LLSD content and a 200 OK. + */ + virtual void result(const LLSD&) = 0; + + /** + * @brief return status code and reason string on http header, + * but do not return a payload. + */ + virtual void status(S32 code, const std::string& message) = 0; + + /** + * @brief Return no body, just status code and 'UNKNOWN ERROR'. + */ + void status(S32 code); + + void notFound(const std::string& message); + void notFound(); + void methodNotAllowed(); + + /** + * @breif Add a name: value http header. + * + * No effort is made to ensure the response is a valid http + * header. + * The headers are stored as a map of header name : value. + * Though HTTP allows the same header name to be transmitted + * more than once, this implementation only stores a header + * name once. + * @param name The name of the header, eg, "Content-Encoding" + * @param value The value of the header, eg, "gzip" + */ + void addHeader(const std::string& name, const std::string& value); + + protected: + /** + * @brief Headers to be sent back with the HTTP response. + * + * Protected class membership since derived classes are + * expected to use it and there is no use case yet for other + * uses. If such a use case arises, I suggest making a + * headers() public method, and moving this member data into + * private. + */ + LLSD mHeaders; + }; - void status(S32 code); - void notFound(const std::string& message); - void notFound(); - void methodNotAllowed(); - }; - typedef LLPointer<Response> ResponsePtr; + typedef LLPointer<Response> ResponsePtr; - virtual void get(ResponsePtr, const LLSD& context) const; - virtual void put(ResponsePtr, const LLSD& context, const LLSD& input) const; - virtual void post(ResponsePtr, const LLSD& context, const LLSD& input) const; - virtual void del(ResponsePtr, const LLSD& context) const; + virtual void get(ResponsePtr, const LLSD& context) const; + virtual void put( + ResponsePtr, + const LLSD& context, + const LLSD& input) const; + virtual void post( + ResponsePtr, + const LLSD& context, + const LLSD& input) const; + virtual void del(ResponsePtr, const LLSD& context) const; + virtual void options(ResponsePtr, const LLSD& context) const; //@} |
