diff options
| author | 2020-12-04 14:16:19 +0000 | |
|---|---|---|
| committer | 2020-12-04 14:18:01 +0000 | |
| commit | 08572a9376e6f41109e233cb45d7e491ad1ebf07 (patch) | |
| tree | 0df675b77db0cc8efe895e53cb9a6f794fade9a7 /src/modules/m_httpd.cpp | |
| parent | Be more specific when a HTTP parser error happens. (diff) | |
Improve HTTP logging.
Diffstat (limited to 'src/modules/m_httpd.cpp')
| -rw-r--r-- | src/modules/m_httpd.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index b4e221e62..efed34799 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -266,12 +266,16 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru void SendHTTPError(unsigned int response, const char* errstr = NULL) { + if (!errstr) + errstr = http_status_str((http_status)response); + + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Sending HTTP error %u: %s", response, errstr); static HTTPHeaders empty; std::string data = InspIRCd::Format( "<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, errstr ? errstr : http_status_str((http_status)response)); + response, errstr); Page(data, response, &empty); } |
