Commit 8e96772d authored by Tobias Thierer's avatar Tobias Thierer
Browse files

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
parent c6496f4a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment