diff options
| author | Adam <Adam@anope.org> | 2014-01-02 11:02:14 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2014-01-02 11:03:33 -0500 |
| commit | 004c4cbe5f4c37cf455cb6d0caa434fbbb3406ea (patch) | |
| tree | 0e6675dfe28a829f5786b0b2f993566c61662de7 /modules/extra/webcpanel/static_fileserver.cpp | |
| parent | 072202c181943901c727782e64881adadf13d7dd (diff) | |
Move modules out of extras that dont have external dependencies
Diffstat (limited to 'modules/extra/webcpanel/static_fileserver.cpp')
| -rw-r--r-- | modules/extra/webcpanel/static_fileserver.cpp | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/modules/extra/webcpanel/static_fileserver.cpp b/modules/extra/webcpanel/static_fileserver.cpp deleted file mode 100644 index 21f4e7052..000000000 --- a/modules/extra/webcpanel/static_fileserver.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (C) 2003-2014 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - */ - -#include "webcpanel.h" -#include <fstream> -#include <errno.h> - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -StaticFileServer::StaticFileServer(const Anope::string &f_n, const Anope::string &u, const Anope::string &c_t) : HTTPPage(u, c_t), file_name(f_n) -{ -} - -bool StaticFileServer::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply) -{ - 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); - - client->SendError(HTTP_PAGE_NOT_FOUND, "Page not found"); - return true; - } - - reply.content_type = this->GetContentType(); - reply.headers["Cache-Control"] = "public"; - - int i; - char buffer[BUFSIZE]; - while ((i = read(fd, buffer, sizeof(buffer))) > 0) - reply.Write(buffer, i); - - close(fd); - return true; -} - |
