summaryrefslogtreecommitdiff
path: root/src/modules/m_httpd.cpp
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2019-03-08 10:50:53 +0000
committerPeter Powell <petpow@saberuk.com>2019-03-08 10:50:53 +0000
commitf97c88f6f64e66fe2abb38860ab1e3f8c0702439 (patch)
treec44b9654e895c53cfc2822678637d26569b7400e /src/modules/m_httpd.cpp
parent83d2331a032b18346b967a6bdf6f336c0e2a26ef (diff)
m_httpd: use http_response_str() instead of Response().
Lets not reinvent the wheel pointlessly.
Diffstat (limited to 'src/modules/m_httpd.cpp')
-rw-r--r--src/modules/m_httpd.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index e5d0a08e4..78c25f6d9 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -224,24 +224,12 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru
AddToCull();
}
- const char* Response(unsigned int response)
- {
- switch (response)
- {
-#define HTTP_STATUS_CASE(n, m, s) case n: return #s;
- HTTP_STATUS_MAP(HTTP_STATUS_CASE)
- default:
- return "WTF";
- break;
- }
- }
-
void SendHTTPError(unsigned int response)
{
HTTPHeaders empty;
std::string data = InspIRCd::Format(
"<html><head></head><body>Server error %u: %s<br>"
- "<small>Powered by <a href='http://www.inspircd.org'>InspIRCd</a></small></body></html>", response, Response(response));
+ "<small>Powered by <a href='http://www.inspircd.org'>InspIRCd</a></small></body></html>", response, http_status_str((http_status)response));
SendHeaders(data.length(), response, empty);
WriteData(data);
@@ -250,7 +238,7 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru
void SendHeaders(unsigned long size, unsigned int response, HTTPHeaders &rheaders)
{
- WriteData(InspIRCd::Format("HTTP/%u.%u %u %s\r\n", parser.http_major ? parser.http_major : 1, parser.http_major ? parser.http_minor : 1, response, Response(response)));
+ WriteData(InspIRCd::Format("HTTP/%u.%u %u %s\r\n", parser.http_major ? parser.http_major : 1, parser.http_major ? parser.http_minor : 1, response, http_status_str((http_status)response)));
rheaders.CreateHeader("Date", InspIRCd::TimeString(ServerInstance->Time(), "%a, %d %b %Y %H:%M:%S GMT", true));
rheaders.CreateHeader("Server", INSPIRCD_BRANCH);