From: <ps...@us...> - 2010-03-15 16:07:03
|
Revision: 1834 http://znc.svn.sourceforge.net/znc/?rev=1834&view=rev Author: psychon Date: 2010-03-15 16:06:56 +0000 (Mon, 15 Mar 2010) Log Message: ----------- Fix WebModules with auth modules When e.g. imapauth started handling a login from WebMods it opened a new TCP connection etc. This took time, but WebMods didn't actually wait for the login to finish which caused the login to fail later on since the HTTP socket was already destroyed. This fixes it by letting the HTTP sock just hang. Once the login finishes, CHTTPSock::Redirect() is called to let it come back to life again. Thanks to DarthGandalf for finding this issue. Modified Paths: -------------- trunk/WebModules.cpp trunk/WebModules.h Modified: trunk/WebModules.cpp =================================================================== --- trunk/WebModules.cpp 2010-03-15 15:58:15 UTC (rev 1833) +++ trunk/WebModules.cpp 2010-03-15 16:06:56 UTC (rev 1834) @@ -87,6 +87,7 @@ m_pWebSock->SetLoggedIn(true); m_pWebSock->UnPauseRead(); + m_pWebSock->Redirect("/"); DEBUG("Successful login attempt ==> USER [" + User.GetUserName() + "] ==> SESSION [" + spSession->GetId() + "]"); } @@ -102,6 +103,7 @@ m_pWebSock->SetLoggedIn(false); m_pWebSock->UnPauseRead(); + m_pWebSock->Redirect("/"); DEBUG("UNSUCCESSFUL login attempt ==> REASON [" + sReason + "] ==> SESSION [" + spSession->GetId() + "]"); } @@ -508,6 +510,9 @@ case PAGE_PRINT: PrintPage(sPageRet); break; + case PAGE_DEFERRED: + // Something else will later do these calls + break; default: PrintNotFound(); break; @@ -541,8 +546,8 @@ m_sPass = GetParam("pass"); m_bLoggedIn = OnLogin(m_sUser, m_sPass); - Redirect("/"); - return PAGE_PRINT; + // AcceptedLogin()/RefusedLogin() will call Redirect() + return PAGE_DEFERRED; } return PrintTemplate("login", sPageRet); Modified: trunk/WebModules.h =================================================================== --- trunk/WebModules.h 2010-03-15 15:58:15 UTC (rev 1833) +++ trunk/WebModules.h 2010-03-15 16:06:56 UTC (rev 1834) @@ -114,7 +114,8 @@ public: enum EPageReqResult { PAGE_NOTFOUND, - PAGE_PRINT + PAGE_PRINT, + PAGE_DEFERRED }; CWebSock(CModule* pModule); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |