Whitelisted X-Forwarded-For header support

This commit is contained in:
Siyo
2013-05-10 14:19:58 +02:00
parent a3c0b74ffc
commit 3d5ba6af3e
6 changed files with 67 additions and 0 deletions

View File

@@ -838,6 +838,21 @@ bool CWebSock::OnLogin(const CString& sUser, const CString& sPass) {
return IsLoggedIn();
}
CString CWebSock::GetRemoteIP()
{
const VCString& vsProxies = CZNC::Get().GetAllowProxies();
CString sIP = CHTTPSock::GetRemoteIP();
VCString::const_iterator it;
for (it = vsProxies.begin(); it != vsProxies.end(); ++it) {
if (sIP.WildCmp(*it)) {
return m_sForwardedIP;
}
}
return sIP;
}
Csock* CWebSock::GetSockObj(const CString& sHost, unsigned short uPort) {
// All listening is done by CListener, thus CWebSock should never have
// to listen, but since GetSockObj() is pure virtual...