Hi Peter,
I found a bug in the Uri class (URL encoding) when I was updating the TrackerRequestWriter to use Uri class for URL creation. If I create a URL and then calls Uri::encoded(), the query part (and possibly some other parts as well, I haven’t test it) can get wrongly encoded.
If a query value part (?param=value) contains binary data, the chars that are in the Uri::QueryEncodeExcludeChars are not encoded and this result in an invalid URL.
If I create the following URL:
http://example.com/page.php?param=&;=:@/?
I get this encoded URL:
http://example.com/page.php?param=&;=:@/?
instead of:
http://example.com/page.php?param=%26%3B%3D%3A%40%2F%3F
Problem is that a query gets encoded after it’s already in one piece (concatenated). As a solution I’d suggest to implement query storage and encoding differently (piecewise). Instead of keeping a whole query in one QByteArray, store it in a QList and when it has to be encoded, take a first parameter, encode it, append it (after appending a delimiter), take a value, encode it and if it’s not empty, append ‘=’ and the encoded value.
What do you think?
Btw you can find my last version (revision) of TrackerRequestWriter and tests here.
Petr
