summaryrefslogtreecommitdiff
path: root/modules/webcpanel/static_fileserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/webcpanel/static_fileserver.cpp')
-rw-r--r--modules/webcpanel/static_fileserver.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/modules/webcpanel/static_fileserver.cpp b/modules/webcpanel/static_fileserver.cpp
index 2e91f77e4..e540fe0ea 100644
--- a/modules/webcpanel/static_fileserver.cpp
+++ b/modules/webcpanel/static_fileserver.cpp
@@ -1,8 +1,20 @@
/*
- * (C) 2003-2017 Anope Team
- * Contact us at team@anope.org
+ * Anope IRC Services
*
- * Please read COPYING and README for further details.
+ * Copyright (C) 2012-2017 Anope Team <team@anope.org>
+ *
+ * This file is part of Anope. Anope is free software; you can
+ * redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software
+ * Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see see <http://www.gnu.org/licenses/>.
*/
#include "webcpanel.h"
@@ -22,7 +34,7 @@ bool StaticFileServer::OnRequest(HTTPProvider *server, const Anope::string &page
int fd = open((template_base + "/" + this->file_name).c_str(), O_RDONLY);
if (fd < 0)
{
- Log(LOG_NORMAL, "httpd") << "Error serving file " << page_name << " (" << (template_base + "/" + this->file_name) << "): " << strerror(errno);
+ Anope::Logger.Category("webcpanel").Log("Error serving file {0} ({1}/{2}): {3}", page_name, template_base, this->file_name, strerror(errno));
client->SendError(HTTP_PAGE_NOT_FOUND, "Page not found");
return true;
@@ -35,7 +47,7 @@ bool StaticFileServer::OnRequest(HTTPProvider *server, const Anope::string &page
char buffer[BUFSIZE];
while ((i = read(fd, buffer, sizeof(buffer))) > 0)
reply.Write(buffer, i);
-
+
close(fd);
return true;
}