显然,这是安全的“功能”。URLConnection实际上是sun.net.www.protocol.http.HttpURLConnection的实例。它定义
getRequestProperty为:
public String getRequestProperty (String key) { // don't return headers containing security sensitive information if (key != null) { for (int i=0; i < EXCLUDE_HEADERS.length; i++) { if (key.equalsIgnoreCase(EXCLUDE_HEADERS[i])) { return null; } } } return requests.findValue(key); }该
EXCLUDE_HEADERS数组定义为:
// the following http request headers should NOT have their values // returned for security reasons. private static final String[] EXCLUDE_HEADERS = {"Proxy-Authorization","Authorization" };


