Prune out relative URLs that point back to the search server.
git-svn-id: svn://10.0.0.236/trunk@55291 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -2258,6 +2258,20 @@ InternetSearchDataSourceCallback::OnStopRequest(nsIChannel* channel, nsISupports
|
||||
}
|
||||
#endif
|
||||
|
||||
// pre-compute server path (we'll discard URLs that match this)
|
||||
nsAutoString serverPathStr;
|
||||
char *serverPath = nsnull;
|
||||
aURL->GetPath(&serverPath);
|
||||
if (serverPath)
|
||||
{
|
||||
serverPathStr = serverPath;
|
||||
nsCRT::free(serverPath);
|
||||
serverPath = nsnull;
|
||||
|
||||
PRInt32 serverOptionsOffset = serverPathStr.FindChar(PRUnichar('?'));
|
||||
if (serverOptionsOffset >= 0) serverPathStr.Truncate(serverOptionsOffset);
|
||||
}
|
||||
|
||||
// look for banner once in entire document
|
||||
nsCOMPtr<nsIRDFLiteral> bannerLiteral;
|
||||
if ((bannerStartStr.Length() > 0) && (bannerEndStr.Length() > 0))
|
||||
@@ -2423,6 +2437,17 @@ InternetSearchDataSourceCallback::OnStopRequest(nsIChannel* channel, nsISupports
|
||||
if (host) nsCRT::free(host);
|
||||
if (protocol) nsCRT::free(protocol);
|
||||
}
|
||||
else if (serverPathStr.Length() > 0)
|
||||
{
|
||||
// prune out any URLs that reference the search engine site
|
||||
nsAutoString tempHREF = hrefStr;
|
||||
tempHREF.Insert("/", 0);
|
||||
|
||||
PRInt32 optionsOffset = tempHREF.FindChar(PRUnichar('?'));
|
||||
if (optionsOffset >= 0) tempHREF.Truncate(optionsOffset);
|
||||
|
||||
if (tempHREF.EqualsIgnoreCase(serverPathStr)) continue;
|
||||
}
|
||||
|
||||
char *href = hrefStr.ToNewCString();
|
||||
if (!href) continue;
|
||||
|
||||
@@ -2258,6 +2258,20 @@ InternetSearchDataSourceCallback::OnStopRequest(nsIChannel* channel, nsISupports
|
||||
}
|
||||
#endif
|
||||
|
||||
// pre-compute server path (we'll discard URLs that match this)
|
||||
nsAutoString serverPathStr;
|
||||
char *serverPath = nsnull;
|
||||
aURL->GetPath(&serverPath);
|
||||
if (serverPath)
|
||||
{
|
||||
serverPathStr = serverPath;
|
||||
nsCRT::free(serverPath);
|
||||
serverPath = nsnull;
|
||||
|
||||
PRInt32 serverOptionsOffset = serverPathStr.FindChar(PRUnichar('?'));
|
||||
if (serverOptionsOffset >= 0) serverPathStr.Truncate(serverOptionsOffset);
|
||||
}
|
||||
|
||||
// look for banner once in entire document
|
||||
nsCOMPtr<nsIRDFLiteral> bannerLiteral;
|
||||
if ((bannerStartStr.Length() > 0) && (bannerEndStr.Length() > 0))
|
||||
@@ -2423,6 +2437,17 @@ InternetSearchDataSourceCallback::OnStopRequest(nsIChannel* channel, nsISupports
|
||||
if (host) nsCRT::free(host);
|
||||
if (protocol) nsCRT::free(protocol);
|
||||
}
|
||||
else if (serverPathStr.Length() > 0)
|
||||
{
|
||||
// prune out any URLs that reference the search engine site
|
||||
nsAutoString tempHREF = hrefStr;
|
||||
tempHREF.Insert("/", 0);
|
||||
|
||||
PRInt32 optionsOffset = tempHREF.FindChar(PRUnichar('?'));
|
||||
if (optionsOffset >= 0) tempHREF.Truncate(optionsOffset);
|
||||
|
||||
if (tempHREF.EqualsIgnoreCase(serverPathStr)) continue;
|
||||
}
|
||||
|
||||
char *href = hrefStr.ToNewCString();
|
||||
if (!href) continue;
|
||||
|
||||
Reference in New Issue
Block a user