X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_httpd.cpp;h=7c93a70b609418255da3bccd81854775039463f4;hb=bc344671460c1675fbc31504fd1ffc03ff58a135;hp=ee45443715baaa172c42b8cf2668d7a8b2cfb28f;hpb=dfdbcc2939dff8311bd38046f6be518021bcede1;p=user%2Fhenk%2Fcode%2Finspircd.git 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); } };