我有一個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
我認爲這是代理相關的,因爲「代理連接」標頭