From 9eda8aabb76258641e1f823f400a6771e0ac56e4 Mon Sep 17 00:00:00 2001 From: "ddrinan%netscape.com" Date: Wed, 1 Aug 2001 23:12:25 +0000 Subject: [PATCH] Bug 89995 - https referrer. r=bbaetz,sr=darin git-svn-id: svn://10.0.0.236/trunk@100129 18797224-902f-48f8-a5cc-f745e15eee43 --- .../protocol/http/src/nsHttpChannel.cpp | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp b/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp index 17b0d9f4e24..5be644eb04e 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp @@ -1860,7 +1860,7 @@ nsHttpChannel::GetReferrer(nsIURI **referrer) return NS_OK; } -#define numInvalidReferrerSchemes 9 +#define numInvalidReferrerSchemes 8 static char * invalidReferrerSchemes [numInvalidReferrerSchemes] = { @@ -1871,8 +1871,7 @@ static char * invalidReferrerSchemes [numInvalidReferrerSchemes] = "imap", "news", "snews", - "imaps", - "https" + "imaps" }; NS_IMETHODIMP @@ -1894,6 +1893,29 @@ nsHttpChannel::SetReferrer(nsIURI *referrer, PRUint32 referrerType) } + // Handle secure referrals. + // Support referrals from a secure server if this is a secure site + // and the host names are the same. + if (referrer) { + PRBool isHTTPS = PR_FALSE; + referrer->SchemeIs("https", &isHTTPS); + if (isHTTPS) { + nsXPIDLCString referrerHost; + nsXPIDLCString host; + referrer->GetHost(getter_Copies(referrerHost)); + mURI->GetHost(getter_Copies(host)); + mURI->SchemeIs("https",&isHTTPS); + + if (nsCRT::strcasecmp(referrerHost, host) != 0) { + return NS_OK; + } + + if (!isHTTPS) { + return NS_OK; + } + } + } + // save a copy of the referrer so we can return it if requested mReferrer = referrer;