diff options
-rw-r--r-- | src/modules/httpd.h | 9 | ||||
-rw-r--r-- | src/modules/m_httpd.cpp | 5 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/modules/httpd.h b/src/modules/httpd.h index 3f8ee215c..5ac4d0c85 100644 --- a/src/modules/httpd.h +++ b/src/modules/httpd.h @@ -52,7 +52,10 @@ class HTTPDocument : public classbase int responsecode; public: - HTTPDocument(std::stringstream* doc, int response) : document(doc), responsecode(response) + + void* sock; + + HTTPDocument(void* opaque, std::stringstream* doc, int response) : document(doc), responsecode(response), sock(opaque) { } @@ -61,9 +64,9 @@ class HTTPDocument : public classbase return this->document; } - std::stringstream* GetDocumentSize() + unsigned long GetDocumentSize() { - return this->document.size(); + return this->document->str().length(); } int GetResponseCode() diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 3bfc8d16a..7d670ea2b 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -232,7 +232,7 @@ class HttpSocket : public InspSocket void Page(std::stringstream* n, int response) { - SendHeaders(n->size(),response); + SendHeaders(n->str().length(),response); this->Write(n->str()); } }; @@ -284,6 +284,9 @@ class ModuleHttp : public Module char* OnRequest(Request* request) { claimed = true; + HTTPDocument* doc = (HTTPDocument*)request->GetData(); + HttpSocket* sock = (HttpSocket*)doc->sock; + sock->Page(doc->GetDocument(), doc->GetResponseCode()); return NULL; } |