Changes associated with upstream OkHttp pull

Contains changes related to how bad characters,
particularly in hostnames, are handled. These
are all related to OkHttp's changes to use HttpUrl
internally. URL and URI were previously used and
were less fussy.

The following tests changed:

URLConnectionTest.testHostWithNul():

Hosts with nul (\0) characters in them
throw UnknownHostException instead of
IllegalArgumentException. This is consistent
with the behavior with other bad host names
(like those with spaces which have historically
been treated as UnknownHostException).
A checked exception generally seems better than
an unchecked one.

URLConnectionTest.testUrlWithSpaceInHostViaHttpProxy():

Hosts with spaces in them returned by proxies will
now throw an UnknownHostException, not nothing.
This reverts the behavior to as it was in older
versions of Android (see commit
ac03ce489cbe22905ee525e005d67df0a74ff8de).

URLConnectionTest.testUrlCharacterMapping():

Hosts are now canonicalized to lower-case.
Hosts can now be rejected if the characters are
invalid and outside of supported IDN input codes.

Some characters in paths and queries are no longer
supported, will not be encoded or may be encoded
differently. e.g. '@' is no longer encoded in paths,
'[' is no longer supported.

Bug: 23553256
Bug: 22943975
Change-Id: Icfbcd520fd4e861dc6a0261aba982ee44d9f80cc
1 file changed