aboutsummaryrefslogtreecommitdiffstats
path: root/AndroidAsync
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2015-04-18 15:50:49 -0700
committerKoushik Dutta <koushd@gmail.com>2015-04-18 15:50:49 -0700
commit7160cd9f8299d614e703541792d75871685bd6a8 (patch)
treec14a9e9b9f5fac9eff2f4e457069216fd66965dc /AndroidAsync
parentdbf0be16e7004c3b175174d3f6a6e01fd02f7a06 (diff)
downloadAndroidAsync-7160cd9f8299d614e703541792d75871685bd6a8.tar.gz
AndroidAsync-7160cd9f8299d614e703541792d75871685bd6a8.tar.bz2
AndroidAsync-7160cd9f8299d614e703541792d75871685bd6a8.zip
Fix proxying to not require transparent proxying. This was a regression.
At some point getProxyRequestLine call was removed.
Diffstat (limited to 'AndroidAsync')
-rw-r--r--AndroidAsync/src/com/koushikdutta/async/AsyncSSLSocketWrapper.java2
-rw-r--r--AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpRequest.java26
-rw-r--r--AndroidAsync/src/com/koushikdutta/async/http/AsyncSocketMiddleware.java7
3 files changed, 5 insertions, 30 deletions
diff --git a/AndroidAsync/src/com/koushikdutta/async/AsyncSSLSocketWrapper.java b/AndroidAsync/src/com/koushikdutta/async/AsyncSSLSocketWrapper.java
index 9060808..3dd7415 100644
--- a/AndroidAsync/src/com/koushikdutta/async/AsyncSSLSocketWrapper.java
+++ b/AndroidAsync/src/com/koushikdutta/async/AsyncSSLSocketWrapper.java
@@ -58,7 +58,7 @@ public class AsyncSSLSocketWrapper implements AsyncSocketWrapper, AsyncSSLSocket
// https://groups.google.com/forum/?fromgroups=#!topic/netty/UCfqPPk5O4s
// certs that use this extension will throw in Cipher.java.
// fallback is to use a custom SSLContext, and hack around the x509 extension.
- if (Build.VERSION.SDK_INT <= 15)
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
throw new Exception();
defaultSSLContext = SSLContext.getInstance("Default");
}
diff --git a/AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpRequest.java b/AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpRequest.java
index 95dd21d..35fb193 100644
--- a/AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpRequest.java
+++ b/AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpRequest.java
@@ -37,6 +37,8 @@ public class AsyncHttpRequest {
@Override
public String toString() {
+ if (proxyHost != null)
+ return String.format("%s %s HTTP/1.1", mMethod, AsyncHttpRequest.this.getUri());
String path = AsyncHttpRequest.this.getUri().getEncodedPath();
if (path == null || path.length() == 0)
path = "/";
@@ -49,30 +51,6 @@ public class AsyncHttpRequest {
};
}
- public RequestLine getProxyRequestLine() {
- return new RequestLine() {
- @Override
- public String getUri() {
- return AsyncHttpRequest.this.getUri().toString();
- }
-
- @Override
- public ProtocolVersion getProtocolVersion() {
- return new ProtocolVersion("HTTP", 1, 1);
- }
-
- @Override
- public String getMethod() {
- return mMethod;
- }
-
- @Override
- public String toString() {
- return String.format("%s %s HTTP/1.1", mMethod, AsyncHttpRequest.this.getUri());
- }
- };
- }
-
protected static String getDefaultUserAgent() {
String agent = System.getProperty("http.agent");
return agent != null ? agent : ("Java" + System.getProperty("java.version"));
diff --git a/AndroidAsync/src/com/koushikdutta/async/http/AsyncSocketMiddleware.java b/AndroidAsync/src/com/koushikdutta/async/http/AsyncSocketMiddleware.java
index 4fc23b0..e8676c5 100644
--- a/AndroidAsync/src/com/koushikdutta/async/http/AsyncSocketMiddleware.java
+++ b/AndroidAsync/src/com/koushikdutta/async/http/AsyncSocketMiddleware.java
@@ -168,16 +168,13 @@ public class AsyncSocketMiddleware extends SimpleMiddleware {
String unresolvedHost;
int unresolvedPort;
boolean proxied = false;
+ if (data.request.getProxyHost() == null && proxyHost != null)
+ data.request.enableProxy(proxyHost, proxyPort);
if (data.request.getProxyHost() != null) {
unresolvedHost = data.request.getProxyHost();
unresolvedPort = data.request.getProxyPort();
proxied = true;
}
- else if (proxyHost != null) {
- unresolvedHost = proxyHost;
- unresolvedPort = proxyPort;
- proxied = true;
- }
else {
unresolvedHost = uri.getHost();
unresolvedPort = port;