+/** You must return a HTTPDocument to the httpd module by using the Request class.
+ * When you initialize this class you may initialize it with all components required to
+ * form a valid HTTP response, including document data, headers, and a response code.
+ */
+class HTTPDocument : public classbase
+{
+ protected:
+
+ std::stringstream* document;
+ int responsecode;
+ std::string extraheaders;
+
+ public:
+
+ /** The socket pointer from an earlier HTTPRequest
+ */
+ void* sock;
+
+ /** Initialize a HTTPRequest ready for sending to m_httpd.so.
+ * @param opaque The socket pointer you obtained from the HTTPRequest at an earlier time
+ * @param doc A stringstream containing the document body
+ * @param response A valid HTTP/1.0 or HTTP/1.1 response code. The response text will be determined for you
+ * based upon the response code.
+ * @param extra Any extra headers to include with the defaults, seperated by carriage return and linefeed.
+ */
+ HTTPDocument(void* opaque, std::stringstream* doc, int response, const std::string &extra) : document(doc), responsecode(response), extraheaders(extra), sock(opaque)
+ {
+ }
+
+ /** Get the document text.
+ * @return The document text
+ */
+ std::stringstream* GetDocument()
+ {
+ return this->document;
+ }
+
+ /** Get the document size.
+ * @return the size of the document text in bytes
+ */
+ unsigned long GetDocumentSize()
+ {
+ return this->document->str().length();
+ }