diff options
author | Koushik Dutta <koushd@gmail.com> | 2015-05-12 20:53:41 -0700 |
---|---|---|
committer | Koushik Dutta <koushd@gmail.com> | 2015-05-12 20:53:41 -0700 |
commit | 13d7784c7c4101de9404f22d856d16798dee87d9 (patch) | |
tree | e8ad87300ac2051404c73eaaef02c1013ea21c9c | |
parent | 7160cd9f8299d614e703541792d75871685bd6a8 (diff) | |
download | AndroidAsync-13d7784c7c4101de9404f22d856d16798dee87d9.tar.gz AndroidAsync-13d7784c7c4101de9404f22d856d16798dee87d9.tar.bz2 AndroidAsync-13d7784c7c4101de9404f22d856d16798dee87d9.zip |
Fix spdy negotiation.
https://github.com/koush/ion/issues/559#issuecomment-101411986
-rw-r--r-- | AndroidAsync/AndroidManifest.xml | 4 | ||||
-rw-r--r-- | AndroidAsync/src/com/koushikdutta/async/http/Protocol.java | 18 | ||||
-rw-r--r-- | AndroidAsync/src/com/koushikdutta/async/http/spdy/SpdyMiddleware.java | 3 |
3 files changed, 19 insertions, 6 deletions
diff --git a/AndroidAsync/AndroidManifest.xml b/AndroidAsync/AndroidManifest.xml index 6110b2b..a142fb5 100644 --- a/AndroidAsync/AndroidManifest.xml +++ b/AndroidAsync/AndroidManifest.xml @@ -1,7 +1,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.koushikdutta.async" - android:versionCode="213" - android:versionName="2.1.3"> + android:versionCode="214" + android:versionName="2.1.4"> <uses-permission android:name="android.permission.INTERNET"/> diff --git a/AndroidAsync/src/com/koushikdutta/async/http/Protocol.java b/AndroidAsync/src/com/koushikdutta/async/http/Protocol.java index 4613428..6f714f2 100644 --- a/AndroidAsync/src/com/koushikdutta/async/http/Protocol.java +++ b/AndroidAsync/src/com/koushikdutta/async/http/Protocol.java @@ -40,7 +40,12 @@ public enum Protocol { * 3.1</a>. Future releases of OkHttp may use this identifier for a newer draft * of the SPDY spec. */ - SPDY_3("spdy/3.1"), + SPDY_3("spdy/3.1") { + @Override + public boolean needsSpdyConnection() { + return true; + } + }, /** * The IETF's binary-framed protocol that includes header compression, @@ -54,7 +59,12 @@ public enum Protocol { * 6</a>. Future releases of OkHttp may use this identifier for a newer draft * of these specs. */ - HTTP_2("h2-13"); + HTTP_2("h2-13") { + @Override + public boolean needsSpdyConnection() { + return true; + } + }; private final String protocol; private static final Hashtable<String, Protocol> protocols = new Hashtable<String, Protocol>(); @@ -88,4 +98,8 @@ public enum Protocol { public String toString() { return protocol; } + + public boolean needsSpdyConnection() { + return false; + } } diff --git a/AndroidAsync/src/com/koushikdutta/async/http/spdy/SpdyMiddleware.java b/AndroidAsync/src/com/koushikdutta/async/http/spdy/SpdyMiddleware.java index cd7f630..0aa6e1f 100644 --- a/AndroidAsync/src/com/koushikdutta/async/http/spdy/SpdyMiddleware.java +++ b/AndroidAsync/src/com/koushikdutta/async/http/spdy/SpdyMiddleware.java @@ -94,7 +94,6 @@ public class SpdyMiddleware extends AsyncSSLSocketMiddleware { if (sslParameters != null) { try { byte[] protocols = concatLengthPrefixed( - Protocol.HTTP_1_1, Protocol.SPDY_3 ); @@ -207,7 +206,7 @@ public class SpdyMiddleware extends AsyncSSLSocketMiddleware { } protoString = new String(proto); Protocol p = Protocol.get(protoString); - if (p == null) { + if (p == null || !p.needsSpdyConnection()) { invokeConnect(key, callback, null, socket); noSpdy(key); return; |