diff options
Diffstat (limited to 'modules/m_httpd.cpp')
-rw-r--r-- | modules/m_httpd.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/modules/m_httpd.cpp b/modules/m_httpd.cpp index a3f2b0110..ad2a28b99 100644 --- a/modules/m_httpd.cpp +++ b/modules/m_httpd.cpp @@ -41,19 +41,19 @@ class MyHTTPClient : public HTTPClient { HTTPProvider *provider; HTTPMessage message; - bool header_done, served; + bool header_done = false, served = false; Anope::string page_name; Reference<HTTPPage> page; Anope::string ip; - unsigned content_length; + unsigned content_length = 0; enum { ACTION_NONE, ACTION_GET, ACTION_POST - } action; + } action = ACTION_NONE; void Serve() { @@ -94,7 +94,7 @@ class MyHTTPClient : public HTTPClient public: time_t created; - MyHTTPClient(HTTPProvider *l, int f, const sockaddrs &a) : Socket(f, l->IsIPv6()), HTTPClient(l, f, a), provider(l), header_done(false), served(false), ip(a.addr()), content_length(0), action(ACTION_NONE), created(Anope::CurTime) + MyHTTPClient(HTTPProvider *l, int f, const sockaddrs &a) : Socket(f, l->IsIPv6()), HTTPClient(l, f, a), provider(l), ip(a.addr()), created(Anope::CurTime) { Log(LOG_DEBUG, "httpd") << "Accepted connection " << f << " from " << a.addr(); } @@ -105,17 +105,17 @@ class MyHTTPClient : public HTTPClient } /* Close connection once all data is written */ - bool ProcessWrite() anope_override + bool ProcessWrite() override { return !BinarySocket::ProcessWrite() || this->write_buffer.empty() ? false : true; } - const Anope::string GetIP() anope_override + const Anope::string GetIP() override { return this->ip; } - bool Read(const char *buffer, size_t l) anope_override + bool Read(const char *buffer, size_t l) override { message.content.append(buffer, l); @@ -233,7 +233,7 @@ class MyHTTPClient : public HTTPClient return true; } - void SendError(HTTPError err, const Anope::string &msg) anope_override + void SendError(HTTPError err, const Anope::string &msg) override { HTTPReply h; @@ -244,7 +244,7 @@ class MyHTTPClient : public HTTPClient this->SendReply(&h); } - void SendReply(HTTPReply *msg) anope_override + void SendReply(HTTPReply *msg) override { this->WriteClient("HTTP/1.1 " + GetStatusFromCode(msg->error)); this->WriteClient("Date: " + BuildDate()); @@ -296,7 +296,7 @@ class MyHTTPProvider : public HTTPProvider, public Timer public: MyHTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p, const int t, bool s) : Socket(-1, i.find(':') != Anope::string::npos), HTTPProvider(c, n, i, p, s), Timer(c, 10, Anope::CurTime, true), timeout(t) { } - void Tick(time_t) anope_override + void Tick(time_t) override { while (!this->clients.empty()) { @@ -309,24 +309,24 @@ class MyHTTPProvider : public HTTPProvider, public Timer } } - ClientSocket* OnAccept(int fd, const sockaddrs &addr) anope_override + ClientSocket* OnAccept(int fd, const sockaddrs &addr) override { MyHTTPClient *c = new MyHTTPClient(this, fd, addr); this->clients.push_back(c); return c; } - bool RegisterPage(HTTPPage *page) anope_override + bool RegisterPage(HTTPPage *page) override { return this->pages.insert(std::make_pair(page->GetURL(), page)).second; } - void UnregisterPage(HTTPPage *page) anope_override + void UnregisterPage(HTTPPage *page) override { this->pages.erase(page->GetURL()); } - HTTPPage* FindPage(const Anope::string &pname) anope_override + HTTPPage* FindPage(const Anope::string &pname) override { if (this->pages.count(pname) == 0) return NULL; @@ -358,7 +358,7 @@ class HTTPD : public Module this->providers.clear(); } - void OnReload(Configuration::Conf *config) anope_override + void OnReload(Configuration::Conf *config) override { Configuration::Block *conf = config->GetModule(this); std::set<Anope::string> existing; @@ -453,7 +453,7 @@ class HTTPD : public Module } } - void OnModuleLoad(User *u, Module *m) anope_override + void OnModuleLoad(User *u, Module *m) override { for (std::map<Anope::string, MyHTTPProvider *>::iterator it = this->providers.begin(), it_end = this->providers.end(); it != it_end; ++it) { |