Merge tag 'android-6.0.1_r3' into 601r3
Android 6.0.1 release 3
* tag 'android-6.0.1_r3':
Revert "DO NOT MERGE Revert "okio: increase segment size to 8 KiB""
DO NOT MERGE Revert "okio: increase segment size to 8 KiB"
Fix Http(s)URLConnectionImpl.getInstanceFollowsRedirects()
Change-Id: I8fdef69a7284be365f4f5fc74aac567fa4fdec0e
diff --git a/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java b/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java
index f541c31..431461b 100644
--- a/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java
+++ b/okhttp-tests/src/test/java/com/squareup/okhttp/internal/http/URLConnectionTest.java
@@ -3119,6 +3119,20 @@
assertContent("abc", client.open(server.getUrl("/")));
}
+ @Test void instanceFollowsRedirects() throws Exception {
+ testInstanceFollowsRedirects("http://www.google.com/");
+ testInstanceFollowsRedirects("https://www.google.com/");
+ }
+
+ private void testInstanceFollowsRedirects(String spec) throws Exception {
+ URL url = new URL(spec);
+ HttpURLConnection urlConnection = client.open(url);
+ urlConnection.setInstanceFollowRedirects(true);
+ assertTrue(urlConnection.getInstanceFollowRedirects());
+ urlConnection.setInstanceFollowRedirects(false);
+ assertFalse(urlConnection.getInstanceFollowRedirects());
+ }
+
/** Returns a gzipped copy of {@code bytes}. */
public Buffer gzip(String data) throws IOException {
Buffer result = new Buffer();
diff --git a/okhttp-urlconnection/src/main/java/com/squareup/okhttp/internal/huc/HttpURLConnectionImpl.java b/okhttp-urlconnection/src/main/java/com/squareup/okhttp/internal/huc/HttpURLConnectionImpl.java
index d09e971..0a014ac 100644
--- a/okhttp-urlconnection/src/main/java/com/squareup/okhttp/internal/huc/HttpURLConnectionImpl.java
+++ b/okhttp-urlconnection/src/main/java/com/squareup/okhttp/internal/huc/HttpURLConnectionImpl.java
@@ -279,6 +279,10 @@
client.setFollowRedirects(followRedirects);
}
+ @Override public boolean getInstanceFollowRedirects() {
+ return client.getFollowRedirects();
+ }
+
@Override public int getConnectTimeout() {
return client.getConnectTimeout();
}