Subject: [PATCH] 4145
---
Index: src/org/openstreetmap/josm/io/OsmApi.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/org/openstreetmap/josm/io/OsmApi.java b/src/org/openstreetmap/josm/io/OsmApi.java
--- a/src/org/openstreetmap/josm/io/OsmApi.java	(revision 18814)
+++ b/src/org/openstreetmap/josm/io/OsmApi.java	(date 1692625168301)
@@ -761,13 +761,17 @@
     protected final String sendRequest(String requestMethod, String urlSuffix, String requestBody, ProgressMonitor monitor,
             String contentType, boolean doAuthenticate, boolean fastFail) throws OsmTransferException {
         int retries = fastFail ? 0 : getMaxRetries();
+        if (monitor == null) {
+            monitor = NullProgressMonitor.INSTANCE;
+        }
 
         while (true) { // the retry loop
             try {
                 url = new URL(new URL(getBaseUrl()), urlSuffix);
                 final HttpClient client = HttpClient.create(url, requestMethod)
                         .keepAlive(false)
-                        .setAccept("application/xml, */*;q=0.8");
+                        .setAccept("application/xml, */*;q=0.8")
+                        .setFinishOnCloseOutput(false);
                 activeConnection = client;
                 if (fastFail) {
                     client.setConnectTimeout(1000);
@@ -791,7 +795,7 @@
                     client.setRequestBody((requestBody != null ? requestBody : "").getBytes(StandardCharsets.UTF_8));
                 }
 
-                final HttpClient.Response response = client.connect();
+                final HttpClient.Response response = client.connect(monitor.createSubTaskMonitor(1, false));
                 Logging.info(response.getResponseMessage());
                 int retCode = response.getResponseCode();
 
