Changeset 9807 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2016-02-15T23:39:36+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r9529 r9807 12 12 import java.net.HttpURLConnection; 13 13 import java.net.URL; 14 import java.util.Collections; 14 15 import java.util.List; 15 16 import java.util.Locale; 16 17 import java.util.Map; 18 import java.util.Map.Entry; 17 19 import java.util.Scanner; 18 20 import java.util.TreeMap; … … 385 387 /** 386 388 * Returns an unmodifiable Map mapping header keys to a List of header values. 389 * As per RFC 2616, section 4.2 header names are case insensitive, so returned map is also case insensitive 387 390 * @return unmodifiable Map mapping header keys to a List of header values 388 391 * @see HttpURLConnection#getHeaderFields() … … 390 393 */ 391 394 public Map<String, List<String>> getHeaderFields() { 392 return connection.getHeaderFields(); 395 // returned map from HttpUrlConnection is case sensitive, use case insensitive TreeMap to conform to RFC 2616 396 Map<String, List<String>> ret = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); 397 for(Entry<String, List<String>> e: connection.getHeaderFields().entrySet()) { 398 if (e.getKey() != null) { 399 ret.put(e.getKey(), e.getValue()); 400 } 401 } 402 return Collections.unmodifiableMap(ret); 393 403 } 394 404
Note:
See TracChangeset
for help on using the changeset viewer.