From c7b2aea7dac329f0b00d2508e234a8a708e146c3 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Thu, 9 Apr 2015 21:25:42 +0100 Subject: [PATCH 1/3] Make help non-table more compact. --- src/ClientCommand.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ClientCommand.cpp b/src/ClientCommand.cpp index 40f7b6f5..b74b0ac6 100644 --- a/src/ClientCommand.cpp +++ b/src/ClientCommand.cpp @@ -1602,8 +1602,7 @@ static void AddCommandHelp(CTable& Table, const CString& sCmd, const CString& sA const CString::size_type iFilterLength = sFilter.size(); if (sFilter.empty() || sCmd.Equals(sFilter, false, iFilterLength) || sCmd.AsLower().WildCmp(sFilter.AsLower())) { Table.AddRow(); - Table.SetCell("Command", sCmd); - Table.SetCell("Arguments", sArgs); + Table.SetCell("Command", sCmd + " " + sArgs); Table.SetCell("Description", sDesc); } } @@ -1611,7 +1610,6 @@ static void AddCommandHelp(CTable& Table, const CString& sCmd, const CString& sA void CClient::HelpUser(const CString& sFilter) { CTable Table; Table.AddColumn("Command"); - Table.AddColumn("Arguments"); Table.AddColumn("Description"); if (sFilter.empty()) { From eedcd4c4de5d0028cd6a8b9de0f6497ce6897b50 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Thu, 16 Apr 2015 01:21:57 +0100 Subject: [PATCH 2/3] Fix rare conflict of HTTP-Basic auth and cookies. Fix #946 --- src/HTTPSock.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/HTTPSock.cpp b/src/HTTPSock.cpp index be1ef2b0..43c01958 100644 --- a/src/HTTPSock.cpp +++ b/src/HTTPSock.cpp @@ -122,7 +122,7 @@ void CHTTPSock::ReadLine(const CString& sData) { sLine.Token(2).Base64Decode(sUnhashed); m_sUser = sUnhashed.Token(0, false, ":"); m_sPass = sUnhashed.Token(1, true, ":"); - m_bLoggedIn = OnLogin(m_sUser, m_sPass, true); + // Postpone authorization attempt until end of headers, because cookies should be read before that, otherwise session id will be overwritten in GetSession() } else if (sName.Equals("Content-Length:")) { m_uPostLen = sLine.Token(1).ToULong(); if (m_uPostLen > MAX_POST_SIZE) @@ -170,6 +170,14 @@ void CHTTPSock::ReadLine(const CString& sData) { } else if (sLine.empty()) { m_bGotHeader = true; + if (!m_sUser.empty()) { + m_bLoggedIn = OnLogin(m_sUser, m_sPass, true); + if (!m_bLoggedIn) { + // Error message already was sent + return; + } + } + if (m_bPost) { m_sPostData = GetInternalReadBuffer(); CheckPost(); From 0167a827a73bc37e741707caf02680c125f44d27 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Thu, 16 Apr 2015 01:23:57 +0100 Subject: [PATCH 3/3] Fix compilation warning --- src/WebModules.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/WebModules.cpp b/src/WebModules.cpp index f4bd46ba..6928d1d8 100644 --- a/src/WebModules.cpp +++ b/src/WebModules.cpp @@ -482,7 +482,6 @@ CWebSock::EPageReqResult CWebSock::PrintTemplate(const CString& sPageName, CStri m_Template["PageName"] = sPageName; if (pModule) { - CUser* pUser = pModule->GetUser(); m_Template["ModName"] = pModule->GetModName(); if (m_Template.find("Title") == m_Template.end()) {