summaryrefslogtreecommitdiff
path: root/modules/extra/m_httpd.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-11-01 13:32:38 -0400
committerAdam <Adam@anope.org>2012-11-01 14:47:23 -0400
commit90930619bc124e94bac5048c0b13c3f4748b559d (patch)
treecbe2325f6295aa188a6dd0f0d56d336eab060bbe /modules/extra/m_httpd.cpp
parent5b1c8230191fa626ef9210c5035f14a8df4c0ed6 (diff)
Fixed quite a bit of dumbness with m_ssl. Had to
modify socketengines to allow polling for write & no read, but is it cleaner now. Made m_httpd able to listen using SSL.
Diffstat (limited to 'modules/extra/m_httpd.cpp')
-rw-r--r--modules/extra/m_httpd.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/extra/m_httpd.cpp b/modules/extra/m_httpd.cpp
index 357e9fba9..4453cf826 100644
--- a/modules/extra/m_httpd.cpp
+++ b/modules/extra/m_httpd.cpp
@@ -7,6 +7,7 @@
#include "module.h"
#include "httpd.h"
+#include "ssl.h"
static Anope::string BuildDate()
{
@@ -299,9 +300,10 @@ class MyHTTPProvider : public HTTPProvider, public CallBack
class HTTPD : public Module
{
+ service_reference<SSLService> sslref;
std::map<Anope::string, HTTPProvider *> providers;
public:
- HTTPD(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED)
+ HTTPD(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, SUPPORTED), sslref("SSLService", "ssl")
{
this->SetAuthor("Anope");
@@ -338,6 +340,7 @@ class HTTPD : public Module
Anope::string ip = config.ReadValue("httpd", "ip", "", i);
int port = config.ReadInteger("httpd", "port", "8080", i, true);
int timeout = config.ReadInteger("httpd", "timeout", "30", i, true);
+ bool ssl = config.ReadFlag("httpd", "ssl", "no", i);
Anope::string ext_ip = config.ReadValue("httpd", "extforward_ip", "", i);
Anope::string ext_header = config.ReadValue("httpd", "extforward_header", "", i);
@@ -352,12 +355,20 @@ class HTTPD : public Module
continue;
}
+ if (ssl && !sslref)
+ {
+ Log(this) << "Could not enable SSL, is m_ssl loaded?";
+ ssl = false;
+ }
+
HTTPProvider *p;
if (this->providers.count(hname) == 0)
{
try
{
p = new MyHTTPProvider(this, hname, ip, port, timeout);
+ if (ssl)
+ sslref->Init(p);
}
catch (const SocketException &ex)
{
@@ -380,6 +391,8 @@ class HTTPD : public Module
try
{
p = new MyHTTPProvider(this, hname, ip, port, timeout);
+ if (ssl)
+ sslref->Init(p);
}
catch (const SocketException &ex)
{