aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_httpd.cpp
diff options
context:
space:
mode:
authorGravatar brain2008-05-12 21:18:54 +0000
committerGravatar brain2008-05-12 21:18:54 +0000
commit3e2513b7b438bdf9ce0406f94e35e0b4bf01a860 (patch)
treeba6ae223f5d8d14a84667754b6fbb6ec9c97fa0b /src/modules/m_httpd.cpp
parentPatch ReadFile() not to bork on one line files, and ensure it works ok with w... (diff)
Backport socket closing fixes (stops sockets hanging sometimes)
git-svn-id: http://svn.inspircd.org/repository/branches/1_1_stable@9715 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_httpd.cpp')
-rw-r--r--src/modules/m_httpd.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index b7dd2b334..a6688dabb 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -187,6 +187,7 @@ class HttpServerSocket : public InspSocket
}
this->Write("Server: InspIRCd/m_httpd.so/1.1\r\nContent-Length: "+ConvToStr(size)+
"\r\nConnection: close\r\n\r\n");
+ this->FlushWriteBuffer();
}
virtual bool OnDataReady()
@@ -228,7 +229,7 @@ class HttpServerSocket : public InspSocket
{
InternalState = HTTP_SERVE_SEND_DATA;
SendHeaders(0, 400, "");
- Instance->SE->WantWrite(this);
+ SetWrite();
}
else
{
@@ -268,7 +269,7 @@ class HttpServerSocket : public InspSocket
if ((http_version != "HTTP/1.1") && (http_version != "HTTP/1.0"))
{
SendHeaders(0, 505, "");
- Instance->SE->WantWrite(this);
+ SetWrite();
}
else
{
@@ -276,7 +277,8 @@ class HttpServerSocket : public InspSocket
{
SendHeaders(index->ContentSize(), 200, "");
this->Write(index->Contents());
- Instance->SE->WantWrite(this);
+ this->FlushWriteBuffer();
+ SetWrite();
}
else
{
@@ -287,7 +289,7 @@ class HttpServerSocket : public InspSocket
if (!claimed)
{
SendHeaders(0, 404, "");
- Instance->SE->WantWrite(this);
+ SetWrite();
}
}
}
@@ -297,6 +299,13 @@ class HttpServerSocket : public InspSocket
{
SendHeaders(n->str().length(), response, extraheaders);
this->Write(n->str());
+ this->FlushWriteBuffer();
+ SetWrite();
+ }
+
+ void SetWrite()
+ {
+ this->WaitingForWriteEvent = true;
Instance->SE->WantWrite(this);
}