summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-11-30 20:44:21 -0500
committerAdam <Adam@anope.org>2012-11-30 20:44:21 -0500
commitc0f60d56a1a5fdc5632ba2d2c81304d02beef1e3 (patch)
tree71dcf1eabe01df60c40471a63d0b6f084a5c7025
parenta4468dd56e96ea915d40627f3cb067084238e34a (diff)
Change /os reload to not unnecessarially rebuild httpd servers. Change m_httpds Log methods to the module version.
-rw-r--r--modules/extra/httpd.h2
-rw-r--r--modules/extra/m_httpd.cpp15
2 files changed, 10 insertions, 7 deletions
diff --git a/modules/extra/httpd.h b/modules/extra/httpd.h
index 015dacc28..6127a51e0 100644
--- a/modules/extra/httpd.h
+++ b/modules/extra/httpd.h
@@ -135,7 +135,7 @@ class HTTPProvider : public ListenSocket, public Service
Anope::string ext_ip;
std::vector<Anope::string> ext_headers;
- HTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p) : ListenSocket(i, p, i.find(':') != Anope::string::npos), Service(c, "HTTPProvider", n) { }
+ HTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p) : ListenSocket(i, p, i.find(':') != Anope::string::npos), Service(c, "HTTPProvider", n), ip(i), port(p) { }
const Anope::string &GetIP() const
{
diff --git a/modules/extra/m_httpd.cpp b/modules/extra/m_httpd.cpp
index a44c6a28e..89ebd3a92 100644
--- a/modules/extra/m_httpd.cpp
+++ b/modules/extra/m_httpd.cpp
@@ -136,6 +136,7 @@ class MyHTTPClient : public HTTPClient
if (sz == Anope::string::npos || !sz || sz + 1 >= token.length())
continue;
this->header.post_data[token.substr(0, sz)] = HTTPUtils::URLDecode(token.substr(sz + 1));
+ Log(LOG_DEBUG_2) << "HTTP POST from " << this->clientaddr.addr() << ": " << token.substr(0, sz) << ": " << this->header.post_data[token.substr(0, sz)];
}
this->Serve();
@@ -373,12 +374,12 @@ class HTTPD : public Module
if (ip.empty())
{
- Log(LOG_NORMAL, "httpd") << "You must configure a bind IP for HTTP server " << hname;
+ Log(this) << "You must configure a bind IP for HTTP server " << hname;
continue;
}
else if (port <= 0 || port > 65535)
{
- Log(LOG_NORMAL, "httpd") << "You must configure a (valid) listen port for HTTP server " << hname;
+ Log(this) << "You must configure a (valid) listen port for HTTP server " << hname;
continue;
}
@@ -399,12 +400,12 @@ class HTTPD : public Module
}
catch (const SocketException &ex)
{
- Log(LOG_NORMAL, "httpd") << "Unable to create HTTP server " << hname << ": " << ex.GetReason();
+ Log(this) << "Unable to create HTTP server " << hname << ": " << ex.GetReason();
continue;
}
this->providers[hname] = p;
- Log(LOG_NORMAL, "httpd") << "Created HTTP server " << hname;
+ Log(this) << "Created HTTP server " << hname;
}
else
{
@@ -415,6 +416,8 @@ class HTTPD : public Module
delete p;
this->providers.erase(hname);
+ Log(this) << "Changing HTTP server " << hname << " to " << ip << ":" << port;
+
try
{
p = new MyHTTPProvider(this, hname, ip, port, timeout);
@@ -423,7 +426,7 @@ class HTTPD : public Module
}
catch (const SocketException &ex)
{
- Log(LOG_NORMAL, "httpd") << "Unable to create HTTP server " << hname << ": " << ex.GetReason();
+ Log(this) << "Unable to create HTTP server " << hname << ": " << ex.GetReason();
continue;
}
@@ -443,7 +446,7 @@ class HTTPD : public Module
if (existing.count(p->name) == 0)
{
- Log(LOG_NORMAL, "httpd") << "Removing HTTP server " << p->name;
+ Log(this) << "Removing HTTP server " << p->name;
this->providers.erase(p->name);
delete p;
}