summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-02-14 06:25:06 +0000
committerSadie Powell <sadie@witchery.services>2020-02-14 06:25:06 +0000
commit45d5e5c7526a00784d2366bd1a2ca7d0c5384027 (patch)
tree788365a2f8955c387345713ab2f4bd9d8e961de7
parent7324001939c567c60f5bd08407d20e228f808722 (diff)
Marginally improve the error pages created by httpd and httpd_acl.
-rw-r--r--src/modules/m_httpd.cpp8
-rw-r--r--src/modules/m_httpd_acl.cpp8
2 files changed, 12 insertions, 4 deletions
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index cec52f66a..bdb1d50fc 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -251,10 +251,12 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru
void SendHTTPError(unsigned int response)
{
- HTTPHeaders empty;
+ static HTTPHeaders empty;
std::string data = InspIRCd::Format(
- "<html><head></head><body>Server error %u: %s<br>"
- "<small>Powered by <a href='https://www.inspircd.org'>InspIRCd</a></small></body></html>", response, http_status_str((http_status)response));
+ "<html><head></head><body style='font-family: sans-serif; text-align: center'>"
+ "<h1 style='font-size: 48pt'>Error %u</h1><h2 style='font-size: 24pt'>%s</h2><hr>"
+ "<small>Powered by <a href='https://www.inspircd.org'>InspIRCd</a></small></body></html>",
+ response, http_status_str((http_status)response));
Page(data, response, &empty);
}
diff --git a/src/modules/m_httpd_acl.cpp b/src/modules/m_httpd_acl.cpp
index 25b7a73f5..cb82b15fa 100644
--- a/src/modules/m_httpd_acl.cpp
+++ b/src/modules/m_httpd_acl.cpp
@@ -103,7 +103,13 @@ class ModuleHTTPAccessList : public Module, public HTTPACLEventListener
{
ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "BlockAccess (%u)", returnval);
- std::stringstream data("Access to this resource is denied by an access control list. Please contact your IRC administrator.");
+ std::stringstream data;
+ data << "<html><head></head><body style='font-family: sans-serif; text-align: center'>"
+ << "<h1 style='font-size: 48pt'>Error " << returnval << "</h1>"
+ << "<h2 style='font-size: 24pt'>Access to this resource is denied by an access control list.</h2>"
+ << "<h2 style='font-size: 24pt'>Please contact your IRC administrator.</h2><hr>"
+ << "<small>Powered by <a href='https://www.inspircd.org'>InspIRCd</a></small></body></html>";
+
HTTPDocumentResponse response(this, *http, &data, returnval);
response.headers.SetHeader("X-Powered-By", MODNAME);
if (!extraheaderkey.empty())