Commit eaf55917 authored by jwilson's avatar jwilson Committed by Tobias Thierer
Browse files

Apply: Make IPv6 request lines consistent with Firefox and Chrome.

Backport upstream OkHttp commit 7ceaa2387f0be853222f5a1496f1f743fa6f8c6d
(from OkHttp 3.2) to Android. Because Android's OkHttp is based on
2.7.5, this involved tweaks in CallTest and elsewhere to
 - in CallTest to call setters on OkHttpClient instead of using a
   OkHttpClient.Builder to construct a new instance.
 - use request.httpUrl() instead of OkHttp 3's request.url().
   - dropped a "." at the end of a line comment in Http2xStream.java
     to keep the line length at 100 characters to avoid breaking
     style checks when running OkHttp's tests using "mvn clean verify"

This commit fixes two separate bugs (upstream may only have been aware
of (1.)):

 (1.) when attempting to tunnel a https connection over http, the host
      header didn't include the :443, like it should.
      This bug was not tracked on Android as far as I'm aware;
      URLConnectionTest was previously asserting the incorrect behavior.
 (2.) attempting to connect to a literal IPv6 address such as
      http://[::1]/ would crash because HttpUrl's host accessor
      returned the "::1" without [] but HttpUrl.Builder required the
      []; this broke the round-trip in HttpEngine.createAddress().
      It's likely that this is the root cause of bug 31917371 but
      it hasn't been empirically verified that this CL fixes that bug.

To fix (2.), it would probably have been sufficient to only apply the
change to HttpUrl.java, but fixing both bugs and backporting the entire
upstream CL appeared preferable.

Bug: 31917371
Test: cts-tradefed run cts -m CtsLibcoreOkHttpTestCases -a arm64-v8a

Upstream commit message follows:

Previously we omitted the square braces and explicit port on CONNECT requests
and the square braces in the Host header.

Closes https://github.com/square/okhttp/issues/2344

Change-Id: I844bfc06bf3a4f56a61a825a71165367ad762a15
parent 35adfe38
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment