diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_httpd.cpp | 21 | ||||
-rw-r--r-- | src/modules/m_httpd_acl.cpp | 2 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index ee4544371..7c93a70b6 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -180,6 +180,7 @@ class HttpServerSocket : public BufferedSocket SendHeaders(data.length(), response, empty); this->Write(data); + this->FlushWriteBuffer(); } void SendHeaders(unsigned long size, int response, HTTPHeaders &rheaders) @@ -265,7 +266,7 @@ class HttpServerSocket : public BufferedSocket if (request_type.empty() || uri.empty() || http_version.empty()) { SendHTTPError(400); - Instance->SE->WantWrite(this); + SetWrite(); return; } @@ -279,7 +280,7 @@ class HttpServerSocket : public BufferedSocket if ((fieldsep == std::string::npos) || (fieldsep == 0) || (fieldsep == cheader.length() - 1)) { SendHTTPError(400); - Instance->SE->WantWrite(this); + SetWrite(); return; } @@ -296,7 +297,7 @@ class HttpServerSocket : public BufferedSocket if ((http_version != "HTTP/1.1") && (http_version != "HTTP/1.0")) { SendHTTPError(505); - Instance->SE->WantWrite(this); + SetWrite(); return; } @@ -333,7 +334,8 @@ class HttpServerSocket : public BufferedSocket HTTPHeaders empty; SendHeaders(index->ContentSize(), 200, empty); this->Write(index->Contents()); - Instance->SE->WantWrite(this); + this->FlushWriteBuffer(); + SetWrite(); } else { @@ -348,7 +350,7 @@ class HttpServerSocket : public BufferedSocket if (!claimed) { SendHTTPError(404); - Instance->SE->WantWrite(this); + SetWrite(); } } } @@ -357,6 +359,7 @@ class HttpServerSocket : public BufferedSocket bool OnWriteReady() { + Instance->Logs->Log("m_httpd",DEBUG,"OnWriteReady()"); return false; } @@ -364,6 +367,14 @@ class HttpServerSocket : public BufferedSocket { SendHeaders(n->str().length(), response, *hheaders); this->Write(n->str()); + this->FlushWriteBuffer(); + SetWrite(); + } + + void SetWrite() + { + Instance->Logs->Log("m_httpd",DEBUG,"SetWrite()"); + this->WaitingForWriteEvent = true; Instance->SE->WantWrite(this); } }; diff --git a/src/modules/m_httpd_acl.cpp b/src/modules/m_httpd_acl.cpp index 36eab758b..153cb501b 100644 --- a/src/modules/m_httpd_acl.cpp +++ b/src/modules/m_httpd_acl.cpp @@ -98,6 +98,8 @@ class ModuleHTTPAccessList : public Module void BlockAccess(HTTPRequest* http, Event* event, int returnval, const std::string &extraheaderkey = "", const std::string &extraheaderval="") { + ServerInstance->Logs->Log("m_httpd_acl", DEBUG, "BlockAccess (%d)", returnval); + std::stringstream data("Access to this resource is denied by an access control list. Please contact your IRC administrator."); HTTPDocument response(http->sock, &data, returnval); response.headers.SetHeader("X-Powered-By", "m_httpd_acl.so"); |