From 2e0a034ed8f93f744999110c7b43dc610501b0c5 Mon Sep 17 00:00:00 2001 From: Johan Torin Date: Thu, 24 Oct 2024 11:10:58 +0200 Subject: [PATCH] Disable protocol upgrades for the HTTP client by default. This avoids problems where a connection could be blocked by an intermediate proxy that disallows upgrades. If wanted, it could be enabled on an individual case with a configuration API on the OTP HTTP client --- .../java/org/opentripplanner/framework/io/OtpHttpClient.java | 1 + .../org/opentripplanner/framework/io/OtpHttpClientFactory.java | 1 + 2 files changed, 2 insertions(+) diff --git a/application/src/main/java/org/opentripplanner/framework/io/OtpHttpClient.java b/application/src/main/java/org/opentripplanner/framework/io/OtpHttpClient.java index ebfeb3ff496..ccb88c3c74b 100644 --- a/application/src/main/java/org/opentripplanner/framework/io/OtpHttpClient.java +++ b/application/src/main/java/org/opentripplanner/framework/io/OtpHttpClient.java @@ -378,6 +378,7 @@ private static RequestConfig requestConfig(Duration timeout) { .custom() .setResponseTimeout(Timeout.of(timeout)) .setConnectionRequestTimeout(Timeout.of(timeout)) + .setProtocolUpgradeEnabled(false) .build(); } diff --git a/application/src/main/java/org/opentripplanner/framework/io/OtpHttpClientFactory.java b/application/src/main/java/org/opentripplanner/framework/io/OtpHttpClientFactory.java index a6436168541..8f7256f642f 100644 --- a/application/src/main/java/org/opentripplanner/framework/io/OtpHttpClientFactory.java +++ b/application/src/main/java/org/opentripplanner/framework/io/OtpHttpClientFactory.java @@ -132,6 +132,7 @@ private static RequestConfig requestConfig(Duration timeout) { .custom() .setResponseTimeout(Timeout.of(timeout)) .setConnectionRequestTimeout(Timeout.of(timeout)) + .setProtocolUpgradeEnabled(false) .build(); } }