Fix regression in the HTTP request line
Adds a test that demonstrates a regression from M in
the HTTP request line when a proxied connection
is made. It only affects URLs with empty paths (i.e. ones
without even a '/' after the host / authority). For
example, on M the request line for a request to
new URL("http://myhost").openConnection() would be:
GET http://myhost HTTP/1.1
but on N, without this change, it would be:
GET http://myhost/ HTTP/1.1
This change reverts to the M behavior.
Test: As follows:
* All OkHttp tests. All pass.
* All libcore tests. 13 tests fail but these were already failing
per b/29744850 and b/29496407. URLConnectionTest passes.
* Manually went through non-test usages of HttpUrl's methods
toString(), encodedPath(), pathSegmentsToString(),
encodedPathSegments(), pathSize() and convinced myself
that all of these usages dealt correctly with empty paths.
For toString(), this includes usages of
- Request.urlString() (used by Cache),
- Appendable.append(HttpUrl) (used in RequestLine.get()),
- Occurences of "url +" (tests only) and "+ url"
(tests, exception messages, and places that call methods
not relating to paths on a HttpUrl instance).
(cherry-picked from commit af79cbf9)
Bug: 30107354
Bug: 29983827
Change-Id: If6ada6e6718fb2ffeef51ac27e4a69fa8c6e3a8e
Loading
Please sign in to comment