Changeset 9182 in josm for trunk/src/org
- Timestamp:
- 2015-12-27T22:01:58+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r9172 r9182 619 619 final HttpClient client = HttpClient.create(url, requestMethod).keepAlive(false); 620 620 if (fastFail) { 621 client.setConnectTimeout(1000); 621 622 client.setReadTimeout(1000); 623 } else { 624 // use default connect timeout from org.openstreetmap.josm.tools.HttpClient.connectTimeout 625 client.setReadTimeout(0); 622 626 } 623 627 if (doAuthenticate) { … … 626 630 627 631 if ("PUT".equals(requestMethod) || "POST".equals(requestMethod) || "DELETE".equals(requestMethod)) { 632 client.setHeader("Content-Type", "text/xml"); 628 633 // It seems that certain bits of the Ruby API are very unhappy upon 629 634 // receipt of a PUT/POST message without a Content-length header, … … 632 637 // we use the output stream, we create an output stream for PUT/POST 633 638 // even if there is no payload. 634 client.setRequestBody( requestBody.getBytes(StandardCharsets.UTF_8));639 client.setRequestBody((requestBody != null ? requestBody : "").getBytes(StandardCharsets.UTF_8)); 635 640 } 636 641 -
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r9179 r9182 92 92 93 93 if ("PUT".equals(requestMethod) || "POST".equals(requestMethod) || "DELETE".equals(requestMethod)) { 94 Main.info("{0} {1} ({2} kB) ...", requestMethod, url, requestBody.length / 1024); 94 95 headers.put("Content-Length", String.valueOf(requestBody.length)); 95 96 connection.setDoOutput(true); … … 112 113 } 113 114 } catch (IOException e) { 115 Main.warn(e); 114 116 //noinspection ThrowableResultOfMethodCallIgnored 115 117 Main.addNetworkError(url, Utils.getRootCause(e));
Note:
See TracChangeset
for help on using the changeset viewer.