Fwd: Bugfixes in Uri - affects toString().

81 views
Skip to first unread message

Lasse R.H. Nielsen

unread,
Aug 20, 2014, 5:00:45 AM8/20/14
to anno...@dartlang.org
We have (semi-)recently (r37728) fixed some long-standing bugs in the
Uri class that caused "Uri.parse(string).toString()" to not equal
"string" unnecessarily.

We now properly distinguish between an empty authority, query or
fragment, and none.
For example,  Uri.parse("foo:///?#").toString()  will now be
"foo:///?#", and not just "foo:/".
That is: You get what you ask for.

For backwards compatibility, the getters for host, query and fragment
still return the empty string if the part is absent. To check whether
it's really there, we have added boolean getters named "hasAuthorty"
(true if any of userInfo, host or port are present), "hasQuery" and
"hasFragment".
The  Uri  constructor also distinguishes between passing the empty
string and passing null.

That means that code that expects the previous incorrect toString
behavior may get unexpected results.

This change happened as part of an improvement of the parser, which
now properly rejects invalid URIs, and improved case- and
escape-normalization, so more equivalent URIs now compare equal.

Cheers
/L
-- 
Lasse R.H. Nielsen - l...@google.com  
'Faith without judgement merely degrades the spirit divine'
Google Denmark ApS - Frederiksborggade 20B, 1 sal - 1360 København K - Denmark - CVR nr. 28 86 69 84
Reply all
Reply to author
Forward
0 new messages