Merge "Workaround for HttpURLConnection.getFollowRedirects() on M" am: 3b37453b1c
am: f0bc25d83d
* commit 'f0bc25d83ddceccd61c2c11a4fa71b9157290363':
Workaround for HttpURLConnection.getFollowRedirects() on M
diff --git a/src/main/java/com/android/volley/toolbox/HurlStack.java b/src/main/java/com/android/volley/toolbox/HurlStack.java
index 1be202e..c53d5e0 100644
--- a/src/main/java/com/android/volley/toolbox/HurlStack.java
+++ b/src/main/java/com/android/volley/toolbox/HurlStack.java
@@ -166,7 +166,14 @@
* Create an {@link HttpURLConnection} for the specified {@code url}.
*/
protected HttpURLConnection createConnection(URL url) throws IOException {
- return (HttpURLConnection) url.openConnection();
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+
+ // Workaround for the M release HttpURLConnection not observing the
+ // HttpURLConnection.setFollowRedirects() property.
+ // https://code.google.com/p/android/issues/detail?id=194495
+ connection.setInstanceFollowRedirects(HttpURLConnection.getFollowRedirects());
+
+ return connection;
}
/**