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; + } } }