Commit 92c2db2b authored by Waldo Bastian's avatar Waldo Bastian
Browse files

Sanitize referrer

svn path=/branches/KDE_2_2_BRANCH/kdelibs/; revision=235422
parent 1352f313
......@@ -864,12 +864,24 @@ bool HTTPProtocol::http_open()
bool sendReferrer = config()->readBoolEntry("SendReferrer", true);
if ( sendReferrer )
{
QString referrer = config()->readEntry("referrer");
if (!referrer.isEmpty())
KURL referrerURL = config()->readEntry("referrer");
if (referrerURL.isValid())
{
header += "Referer: ";
header += referrer;
header += "\r\n"; //Don't try to correct spelling!
// Sanitize
QString protocol = referrerURL.protocol();
if ((protocol == "http") ||
((protocol == "https") && (m_protocol == "https"))
)
{
referrerURL.setRef(QString::null);
referrerURL.setUser(QString::null);
referrerURL.setPass(QString::null);
header += "Referer: ";
header += referrerURL.url();
header += "\r\n"; //Don't try to correct spelling!
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment