Closed Bug 270568 Opened 20 years ago Closed 20 years ago

IIOService::nsURI Parser does not parse the .foobar.com

Categories

(Core :: Networking, defect)

x86
Windows Server 2003
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: goodwill.mozilla.bugzilla, Assigned: darin.moz)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.7.3) Gecko/20040920 Firefox/0.10.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.7.3) Gecko/20040920 Firefox/0.10.1

such url as: .foobar.com is not a valid url, yet the IIOService::nsURI function
returns that it is.


Reproducible: Always
Steps to Reproduce:
try this:
function test()
{
  try {
    var ioService =
Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
    var newuri = ioService.newURI("http://.hello.com/", null, null);
    alert('newuri: ' + newuri.spec);
  } catch(e) {
    alert('e: \n\n' + e);
}

}

Actual Results:  
The newuri variable is a valid nsURI object as witnessed by the popup.

Expected Results:  
Returned an error because http://.hello.com is not a valid url
Summary: IIOService::nsURI Parser does nto parse the .foobar.com → IIOService::nsURI Parser does not parse the .foobar.com
Assignee: general → darin
Component: Browser-General → Networking
QA Contact: general → benc
Does RFC 2396 say that this is an invalid URL?  Or, are you saying that it is
invalid because the name ".foobar.com" fails to resolve via DNS?
The is what I gleamed from the RFC 2396:

URI Syntactic Components: (taken from RFC 2396)
<scheme>:<scheme-specific-part>
scheme        = alpha *( alpha | digit | "+" | "-" | "." )
<scheme-specific-part>
An absolute URI contains the name of the scheme being used (<scheme>)
followed by a colon (":") and then a string (the <scheme-specific-
part>) whose interpretation depends on the scheme.
The URI syntax does not require that the scheme-specific-part have
any general structure or set of semantics which is common among all
URI.  However, a subset of URI do share a common syntax for
representing hierarchical relationships within the namespace.  This
"generic URI" syntax consists of a sequence of four main components:

<scheme>://<authority><path>?<query>

authority     = server | reg_name

The authority component is preceded by a double slash "//" and is
terminated by the next slash "/", question-mark "?", or by the end of
the URI.  Within the authority component, the characters ";", ":",
"@", "?", and "/" are reserved.

reg_name      = 1*( unreserved | escaped | "$" | "," |
                  ";" | ":" | "@" | "&" | "=" | "+" )

unreserved  = alphanum | mark
alphanum = alpha | digit
alpha    = lowalpha | upalpha
lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" |
           "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" |
           "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z"
upalpha  = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" |
           "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" |
           "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z"
digit    = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" |
                 "8" | "9"
mark        = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"

So it appears . is allowed as part of .foobar.com
the leading "." in foobar.com
grrr, need to checmy spelling better:

the leading "." in. foobar.com
reg_name is Registry-based Naming Authority
so, there is no way to know that the URL is "invalid" without first trying to
resolve the hostname.  we don't want to require DNS lookups when parsing URLs as
that would negatively impact page load performance in a huge way.

marking this bug INVALID
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.