From efb7d4fd3e9d20facf6a5b3d41bee8ca3d894bbc Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 13 Oct 2013 20:29:57 +0200 Subject: Fixed WebAdmin's request parameters. Also added doxycomments on what they really contain. --- source/WebAdmin.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'source/WebAdmin.cpp') diff --git a/source/WebAdmin.cpp b/source/WebAdmin.cpp index 08817139a..daec2f925 100644 --- a/source/WebAdmin.cpp +++ b/source/WebAdmin.cpp @@ -185,8 +185,19 @@ void cWebAdmin::HandleWebadminRequest(cHTTPConnection & a_Connection, cHTTPReque HTTPfd.Name = itr->first; TemplateRequest.Request.FormData[itr->first] = HTTPfd; TemplateRequest.Request.PostParams[itr->first] = itr->second; - TemplateRequest.Request.Params[itr->first] = itr->second; } // for itr - Data->m_Form[] + + // Parse the URL into individual params: + size_t idxQM = a_Request.GetURL().find('?'); + if (idxQM != AString::npos) + { + cHTTPFormParser URLParams(cHTTPFormParser::fpkURL, a_Request.GetURL().c_str() + idxQM + 1, a_Request.GetURL().length() - idxQM - 1, *Data); + URLParams.Finish(); + for (cHTTPFormParser::const_iterator itr = URLParams.begin(), end = URLParams.end(); itr != end; ++itr) + { + TemplateRequest.Request.Params[itr->first] = itr->second; + } // for itr - URLParams[] + } } // Try to get the template from the Lua template script -- cgit v1.2.3 From 18bbe82f30af5f0ebb0b4789f386f5179ec56f2b Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 13 Oct 2013 22:19:13 +0200 Subject: WebAdmin honors the [WebAdmin].Enable setting. This fixes #234. --- source/WebAdmin.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source/WebAdmin.cpp') diff --git a/source/WebAdmin.cpp b/source/WebAdmin.cpp index daec2f925..316513f11 100644 --- a/source/WebAdmin.cpp +++ b/source/WebAdmin.cpp @@ -79,8 +79,14 @@ bool cWebAdmin::Init(void) return false; } - AString PortsIPv4 = m_IniFile.GetValue("WebAdmin", "Port", "8080"); - AString PortsIPv6 = m_IniFile.GetValue("WebAdmin", "PortsIPv6", ""); + if (!m_IniFile.GetValueSetB("WebAdmin", "Enabled", true)) + { + // WebAdmin is disabled, bail out faking a success + return true; + } + + AString PortsIPv4 = m_IniFile.GetValueSet("WebAdmin", "Port", "8080"); + AString PortsIPv6 = m_IniFile.GetValueSet("WebAdmin", "PortsIPv6", ""); if (!m_HTTPServer.Initialize(PortsIPv4, PortsIPv6)) { -- cgit v1.2.3