Firefox/URL Bar Algorithm: Difference between revisions

Jump to navigation Jump to search
Line 36: Line 36:
==Network==
==Network==


...
# Since the <code>keyword.enabled</code> preference is true, if DNS lookup for the hostname failed and the URI scheme contains the string "http" and the hostname does not contain a '.' then plug the hostname (possibly after some decoding from punycode to UTF-8) into <tt>keyword.URL</tt>.
# If the above step did not produce a <code>nsIURI</code> and either DNS lookup failed or the network access failed with <code>NS_ERROR_NET_RESET</code> (typically means the server did not respond or dropped the connection immediately) and the protocol is "http" and the url does not contain a username or password then because the <code>browser.fixup.alternate.enabled</code> preference defaults to true we try to construct an alternate hostname.  The steps for this are in <code>nsDefaultURIFixup::MakeAlternateURI</code> and are as follows:
## Get the prefix to use from the <code>browser.fixup.alternate.prefix</code> preference; default is "www.".  Some locales set this preference.
## Get the suffix to use from the <code>browser.fixup.alternate.suffix</code> preference; default is ".com".  Some locales set this preference.
## If the hostname includes no '.' characters, prepend the prefix and append the suffix.  Else if it has a single '.' and the part ending on the '.' is equal to our prefix, append the suffix.  Else if it has a single '.' and tour suffix is nonempty prepend the prefix.  For the default pref values, this means the <tt>foo</tt> will become <tt>www.foo.com</tt>, as will <tt>foo.com</tt> and <tt>www.foo</tt>.  <tt>foo.org</tt> will become <tt>www.foo.org</tt>.  <tt>web.foo</tt> and <tt>x.y.foo</tt> won't be changed.
# If either of the two steps above produced a URI different from the URI whose load failed, load that new URI.
308

edits

Navigation menu