Bug 24011 - KURL's setPort doesn't unset port if 0 is given
Summary: KURL's setPort doesn't unset port if 0 is given
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Trivial
Assignee: Nobody
URL:
Keywords:
Depends on: 41443
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-18 15:17 PST by Gustavo Noronha (kov)
Modified: 2010-06-30 22:20 PDT (History)
0 users

See Also:


Attachments
proposed fix (2.08 KB, patch)
2009-02-18 15:43 PST, Gustavo Noronha (kov)
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo Noronha (kov) 2009-02-18 15:17:57 PST
In KURL.h setPort has the following comment:

    // Setting the port to 0 will clear any port from the URL.
    void setPort(unsigned short);

But passing 0 sets port to :0 instead.
Comment 1 Gustavo Noronha (kov) 2009-02-18 15:43:02 PST
Created attachment 27765 [details]
proposed fix
Comment 2 Alexey Proskuryakov 2009-02-19 02:21:12 PST
Comment on attachment 27765 [details]
proposed fix

r=me

> +        Make setPort remove port if 0 is given to it, as promissed by the

Typo: should be "promised".

>      // FIXME: Non-ASCII characters must be encoded and escaped to match parse() expectations,
>      // and to avoid changing more than just the port.

Oops, this FIXME is totally bogus - this method takes a number, so there is no need to encode it! Please feel free to remove it if you wish.

> +    if (!i)

We'd normally put the normal code path first (if (i)).
Comment 3 Gustavo Noronha (kov) 2009-02-19 07:20:39 PST
Landed in r41076.