From 1e4120dd22e70782a72057a0d41f35daffbd6b01 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 11 Jul 2006 14:05:52 +0000 Subject: Craq fixing git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4330 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/httpd.h | 9 ++++++--- src/modules/m_httpd.cpp | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src/modules') 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; } -- cgit v1.2.3