Ignore:
Timestamp:
2015-12-27T22:01:58+01:00 (8 years ago)
Author:
simon04
Message:

see #12231 - No read timeout for OsmApi connections

Fixes regression from r9172

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r9172 r9182  
    619619                final HttpClient client = HttpClient.create(url, requestMethod).keepAlive(false);
    620620                if (fastFail) {
     621                    client.setConnectTimeout(1000);
    621622                    client.setReadTimeout(1000);
     623                } else {
     624                    // use default connect timeout from org.openstreetmap.josm.tools.HttpClient.connectTimeout
     625                    client.setReadTimeout(0);
    622626                }
    623627                if (doAuthenticate) {
     
    626630
    627631                if ("PUT".equals(requestMethod) || "POST".equals(requestMethod) || "DELETE".equals(requestMethod)) {
     632                    client.setHeader("Content-Type", "text/xml");
    628633                    // It seems that certain bits of the Ruby API are very unhappy upon
    629634                    // receipt of a PUT/POST message without a Content-length header,
     
    632637                    // we use the output stream, we create an output stream for PUT/POST
    633638                    // even if there is no payload.
    634                     client.setRequestBody(requestBody.getBytes(StandardCharsets.UTF_8));
     639                    client.setRequestBody((requestBody != null ? requestBody : "").getBytes(StandardCharsets.UTF_8));
    635640                }
    636641
Note: See TracChangeset for help on using the changeset viewer.