- Timestamp:
- 2016-01-04T23:55:48+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r9309 r9314 42 42 private byte[] requestBody; 43 43 private long ifModifiedSince; 44 private long contentLength;45 44 private final Map<String, String> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); 46 45 private int maxRedirects = Main.pref.getInteger("socket.maxredirects", 5); … … 86 85 connection.setIfModifiedSince(ifModifiedSince); 87 86 } 88 if (contentLength > 0) {89 connection.setFixedLengthStreamingMode(contentLength);90 }91 87 connection.setUseCaches(useCache); 92 88 if (!useCache) { … … 104 100 if ("PUT".equals(requestMethod) || "POST".equals(requestMethod) || "DELETE".equals(requestMethod)) { 105 101 Main.info("{0} {1} ({2}) ...", requestMethod, url, Utils.getSizeString(requestBody.length, Locale.getDefault())); 106 headers.put("Content-Length", String.valueOf(requestBody.length));102 connection.setFixedLengthStreamingMode(requestBody.length); 107 103 connection.setDoOutput(true); 108 104 try (OutputStream out = new BufferedOutputStream( … … 517 513 * @see HttpURLConnection#setFixedLengthStreamingMode(long) 518 514 * @since 9178 519 */ 515 * @deprecated Submitting data via POST, PUT, DELETE automatically sets this property on the connection 516 */ 517 @Deprecated 520 518 public HttpClient setFixedLengthStreamingMode(long contentLength) { 521 this.contentLength = contentLength;522 519 return this; 523 520 }
Note:
See TracChangeset
for help on using the changeset viewer.