From e841c41576e5a2ab5a3c2772f50ca5a199b1fa56 Mon Sep 17 00:00:00 2001 From: "valeski%netscape.com" Date: Mon, 31 Jan 2000 22:47:40 +0000 Subject: [PATCH] r=jevering. 25928. We were applying the local www.*.com trick to all protocols when it's currently only an http thang. git-svn-id: svn://10.0.0.236/trunk@59291 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsWebShell.cpp | 24 +++++++++++++++++------- mozilla/webshell/src/nsWebShell.cpp | 24 +++++++++++++++++------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index 200eeefef2a..df2d4fd82cd 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -3242,15 +3242,25 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader, // Try our www.*.com trick. nsCAutoString retryHost; - if (-1 == dotLoc) { - retryHost = "www."; - retryHost += hostStr; - retryHost += ".com"; - } else { - PRInt32 hostLen = hostStr.Length(); - if ( ((hostLen - dotLoc) == 3) || ((hostLen - dotLoc) == 4) ) { + nsXPIDLCString scheme; + rv = aURL->GetScheme(getter_Copies(scheme)); + if (NS_FAILED(rv)) return rv; + + PRUint32 schemeLen = PL_strlen((const char*)scheme); + CBufDescriptor schemeBuf((const char*)scheme, PR_TRUE, schemeLen+1, schemeLen); + nsCAutoString schemeStr(schemeBuf); + + if (schemeStr.Find("http") == 0) { + if (-1 == dotLoc) { retryHost = "www."; retryHost += hostStr; + retryHost += ".com"; + } else { + PRInt32 hostLen = hostStr.Length(); + if ( ((hostLen - dotLoc) == 3) || ((hostLen - dotLoc) == 4) ) { + retryHost = "www."; + retryHost += hostStr; + } } } diff --git a/mozilla/webshell/src/nsWebShell.cpp b/mozilla/webshell/src/nsWebShell.cpp index 200eeefef2a..df2d4fd82cd 100644 --- a/mozilla/webshell/src/nsWebShell.cpp +++ b/mozilla/webshell/src/nsWebShell.cpp @@ -3242,15 +3242,25 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader, // Try our www.*.com trick. nsCAutoString retryHost; - if (-1 == dotLoc) { - retryHost = "www."; - retryHost += hostStr; - retryHost += ".com"; - } else { - PRInt32 hostLen = hostStr.Length(); - if ( ((hostLen - dotLoc) == 3) || ((hostLen - dotLoc) == 4) ) { + nsXPIDLCString scheme; + rv = aURL->GetScheme(getter_Copies(scheme)); + if (NS_FAILED(rv)) return rv; + + PRUint32 schemeLen = PL_strlen((const char*)scheme); + CBufDescriptor schemeBuf((const char*)scheme, PR_TRUE, schemeLen+1, schemeLen); + nsCAutoString schemeStr(schemeBuf); + + if (schemeStr.Find("http") == 0) { + if (-1 == dotLoc) { retryHost = "www."; retryHost += hostStr; + retryHost += ".com"; + } else { + PRInt32 hostLen = hostStr.Length(); + if ( ((hostLen - dotLoc) == 3) || ((hostLen - dotLoc) == 4) ) { + retryHost = "www."; + retryHost += hostStr; + } } }