]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Improve HTTP logging.
authorSadie Powell <sadie@witchery.services>
Fri, 4 Dec 2020 14:16:19 +0000 (14:16 +0000)
committerSadie Powell <sadie@witchery.services>
Fri, 4 Dec 2020 14:18:01 +0000 (14:18 +0000)
src/modules/m_httpd.cpp
src/modules/m_httpd_config.cpp
src/modules/m_httpd_stats.cpp

index b4e221e621094a11cd2dc393c594406d867742ff..efed34799bb9ee1d1ee892da7a830fcbc7ffde12 100644 (file)
@@ -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);
        }
index fe14277728ba5c99aed60d8763ed6fc9f600b115..bc669dae33fb3a812e14859df884d2993490c016 100644 (file)
@@ -42,7 +42,7 @@ class ModuleHttpConfig : public Module, public HTTPRequestEventListener
                if ((request.GetPath() != "/config") && (request.GetPath() != "/config/"))
                        return MOD_RES_PASSTHRU;
 
-               ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling request for the HTTP /config route");
+               ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling HTTP request for %s", request.GetPath().c_str());
                std::stringstream buffer;
 
                ConfigDataHash& config = ServerInstance->Config->config_data;
index b40c44d120067fdf38cca0c41b42ecec80c1ad4d..0b674cf6490217c4276d2c582c6affc8fc58cc1a 100644 (file)
@@ -431,7 +431,7 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener
                if (path[path.size() - 1] == '/')
                        path.erase(path.size() - 1, 1);
 
-               ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling httpd event");
+               ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling HTTP request for %s", http->GetPath().c_str());
 
                bool found = true;
                std::stringstream data;