summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Baard <henrik.baard@sonyericsson.com>2010-02-24 08:41:48 +0100
committerSteve Kondik <shade@chemlab.org>2010-08-21 08:45:04 -0400
commite716ae55d730cfecfb3612fded68057cc1fcdc7e (patch)
treea20236b548d643bf16958928b911f667a625677e
parentc2e62d24d0f57c9315e40e9957e918e68b41bc4b (diff)
downloadframeworks_base-e716ae55d730cfecfb3612fded68057cc1fcdc7e.zip
frameworks_base-e716ae55d730cfecfb3612fded68057cc1fcdc7e.tar.gz
frameworks_base-e716ae55d730cfecfb3612fded68057cc1fcdc7e.tar.bz2
Fixed problem with proxy server sometimes responds with 400 Bad Request when trying
to connect to a site using https. The CONNECT to the server lacks the 'host' header which is mandatory according to the specification. Some proxy servers are strictly following the specification and sends back the 400 Bad Requst error code.
-rw-r--r--core/java/android/net/http/HttpsConnection.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/java/android/net/http/HttpsConnection.java b/core/java/android/net/http/HttpsConnection.java
index e512a1df..9b842ae 100644
--- a/core/java/android/net/http/HttpsConnection.java
+++ b/core/java/android/net/http/HttpsConnection.java
@@ -204,10 +204,13 @@ public class HttpsConnection extends Connection {
BasicHttpRequest proxyReq = new BasicHttpRequest
("CONNECT", mHost.toHostString());
- // add all 'proxy' headers from the original request
+ // add all 'proxy' headers from the original request, we also need
+ // to add 'host' header unless we want proxy to answer us with a
+ // 400 Bad Request
for (Header h : req.mHttpRequest.getAllHeaders()) {
String headerName = h.getName().toLowerCase();
- if (headerName.startsWith("proxy") || headerName.equals("keep-alive")) {
+ if (headerName.startsWith("proxy") || headerName.equals("keep-alive")
+ || headerName.equals("host")) {
proxyReq.addHeader(h);
}
}