[Development] New QUrl reviewing

Thiago Macieira thiago.macieira at intel.com
Fri Mar 30 04:54:45 CEST 2012


On quinta-feira, 29 de março de 2012 23.31.38, Thiago Macieira wrote:
> Staged, re-staged, re-re-staged and once again for good measure, and it's
> in :-)

Oh, did I mention I had a QEXPECT_FAIL sneak in due to a feature that David 
added to QUrl after I had already completed my work, and to fix that particular 
QEXPECT_FAIL, I need to refactor quite a bit of the encoding rules?

Currently, the encoding options are:
 - FullyEncoded - as the RFC asks
 - DecodeSpace - decode %20 to a space character
 - DecodeUnicode - decode unicode sequences to the actual characters
 - DecodeUnambiguousDelimiters
 - DecodeAllDelimiters

 - PrettyDecoded = DecodeUnambiguousDelimiters | DecodeSpace | DecodeUnicode
 - MostDecoded = DecodeAllDelimiters | DecodeSpace | DecodeUnicode

The choice of the default has the unfortunate consequence that:
	url.setPath("/hash#in#path?");
	url.path() == "/hash%23in%23path%3F";

It seems to me that the "pretty decoded" form for the components is actually 
the MostDecoded form.

But the MostDecoded form might not be the most interesting form for the full 
URL, especially when we consider reserved characters like "\", "^" or "<" and 
">".

There's also a side-effect of FullyDecoded being the value 0. If you had:
	url.toString(); 
	// equivalent to toString(QUrl::PrettyDecoded)

and you modify it to be now:
	url.toString(QUrl::RemovePassword);

oops, that's equivalent to:
	url.toString(QUrl::RemovePassword | QUrl::FullyEncoded);

For that reason, I need to rearrange the constants such the default parameter 
is a zero. I can't make PrettyDecoded == 0 because otherwise we have the 
reverse of the above problem with toEncoded().

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120329/bac6a059/attachment.sig>


More information about the Development mailing list