Closed Bug 1935 Opened 26 years ago Closed 26 years ago

ftp hostnames converted to http:// URL

Categories

(Core Graveyard :: Viewer App, defect, P2)

x86
Windows NT
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: michael.j.lowe, Assigned: buster)

Details

Typing a hostname such as ftp.netscape.com into the viewer app will result in it inserting http:// to the beginning of the address, and an incorrect attempt to load it as http instead of ftp. The following patch corrects this: Index: nsWebShell.cpp =================================================================== RCS file: /cvsroot/mozilla/webshell/src/nsWebShell.cpp,v retrieving revision 1.83 diff -u -r1.83 nsWebShell.cpp --- nsWebShell.cpp 1998/12/15 05:45:05 1.83 +++ nsWebShell.cpp 1998/12/16 11:38:09 @@ -1177,8 +1177,28 @@ && ((port=urlSpec.CharAt(colon+1)) < '9') && (port > '0') ) ) { - nsString httpDef("http://"); - urlSpec.Insert(httpDef, 0, 7); + + // find host name + int hostPos = urlSpec.FindCharInSet("./:"); + if (hostPos == -1) { + hostPos = urlSpec.Length(); + } + + // extract host name + nsAutoString hostSpec; + urlSpec.Left(hostSpec, hostPos); + + // insert url spec corresponding to host name + if (hostSpec.EqualsIgnoreCase("www")) { + nsString ftpDef("http://"); + urlSpec.Insert(ftpDef, 0, 7); + } else if (hostSpec.EqualsIgnoreCase("ftp")) { + nsString ftpDef("ftp://"); + urlSpec.Insert(ftpDef, 0, 6); + } else { + nsString httpDef("http://"); + urlSpec.Insert(httpDef, 0, 7); + } } // Give web-shell-container right of refusal
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Thanks for the code. I just checked it in.
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.