我有一个Android客户端向服务器发出HTTPS请求。防火墙日志具有不需要的CONNECT请求方法的条目。如何防止来自HttpsURLConnection的CONNECT方法调用
CONNECT请求何时发送出去,我怎样才能防止它被发送?我希望只有一个GET请求。我的理解是,对openConnection()的调用实际上不会发出请求,并且GET请求会继续调用getResponseMessage()。
如何禁用http客户端尝试建立代理服务器隧道?
这里是我送我的连接和拨打电话:
URL url = new URL("https://some.server.com");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setConnectTimeout(CONNECT_TIMEOUT);
connection.setReadTimeout(REAT_TIMEOUT);
connection.setRequestProperty(ACCEPT_CHARSET, UTF8_CHARSET);
connection.setRequestProperty(CONTENT_TYPE_HEADER, contentType);
setCustomRequestProperties(connection);
connection.setRequestMethod("GET");
//create response
connection.getResponseMessage();
connection.getResponseCode();
connection.getContentType();
connection.getContent();
编辑:
这里是我试图阻止防火墙日志条目:
CONNECT someURL.domain.com:443 HTTP/1.1
Host: someURL.domain.com
User-Agent: CustomUserAgent;1.0.0(Android 4.3;Nexus 4;T-Mobile)
Proxy-Connection: Keep-Alive
X-SSL-Secure: true
X-CS-Source-IP: 10.3.3.3
X-Forwarded-For: 10.3.3.3
我认为这是代理相关的,因为“代理连接”标头