summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-12 21:16:04 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-12 21:16:04 +0000
commitbc344671460c1675fbc31504fd1ffc03ff58a135 (patch)
tree468765e7312540a68b7551d02d39d26411dbd5cf /src
parent0aa899ee2f7d82ea59f4c34fd29abaac29824903 (diff)
httpd connection close fixes (these need to be backported to 1.1 at some point?) and acl tweaks to make http auth work
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9714 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_httpd.cpp21
-rw-r--r--src/modules/m_httpd_acl.cpp2
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");