X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_httpd.cpp;h=f9e5bc0fdca282acb328208c51deef4780847e02;hb=09f35749aa7bf7dc20951d85bad60de3d219e4eb;hp=168e09bb830b3e151fbd67b67e0f4262f02c7066;hpb=d4a1ea70451abb333e71f9cff09b624db59531a0;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 168e09bb8..f9e5bc0fd 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -40,7 +40,9 @@ #endif // Fix warnings about shadowing in http_parser. -#pragma GCC diagnostic ignored "-Wshadow" +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wshadow" +#endif #include @@ -222,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( "Server error %u: %s
" - "Powered by InspIRCd", response, Response(response)); + "Powered by InspIRCd", response, http_status_str((http_status)response)); SendHeaders(data.length(), response, empty); WriteData(data); @@ -248,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);