From b8344b98ec9c514e40d0e48f95957253f645be07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= <91831478+lemeurherve@users.noreply.github.com> Date: Tue, 5 Dec 2023 07:28:30 +0100 Subject: [PATCH] [JENKINS-72343] Accept all 2xx and 3xx status codes to validate proxy in HTTP Proxy Configuration (#8700) * Accept all 2xx and 3xx status codes validate proxy in HTTP Proxy Configuration * add status code in the response to the user --- core/src/main/java/hudson/ProxyConfiguration.java | 4 ++-- core/src/main/resources/hudson/Messages.properties | 2 +- core/src/main/resources/hudson/Messages_bg.properties | 2 +- core/src/main/resources/hudson/Messages_de.properties | 2 +- core/src/main/resources/hudson/Messages_es.properties | 2 +- core/src/main/resources/hudson/Messages_fr.properties | 2 +- core/src/main/resources/hudson/Messages_it.properties | 2 +- core/src/main/resources/hudson/Messages_ja.properties | 2 +- core/src/main/resources/hudson/Messages_pt_BR.properties | 2 +- core/src/main/resources/hudson/Messages_ru.properties | 2 +- core/src/main/resources/hudson/Messages_sr.properties | 2 +- core/src/main/resources/hudson/Messages_zh_TW.properties | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/hudson/ProxyConfiguration.java b/core/src/main/java/hudson/ProxyConfiguration.java index 08f7131289b2..6e54fbb0e3e1 100644 --- a/core/src/main/java/hudson/ProxyConfiguration.java +++ b/core/src/main/java/hudson/ProxyConfiguration.java @@ -576,8 +576,8 @@ public FormValidation doValidateProxy( } try { HttpResponse httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.discarding()); - if (httpResponse.statusCode() == HttpURLConnection.HTTP_OK) { - return FormValidation.ok(Messages.ProxyConfiguration_Success()); + if (httpResponse.statusCode() < HttpURLConnection.HTTP_BAD_REQUEST) { + return FormValidation.ok(Messages.ProxyConfiguration_Success(httpResponse.statusCode())); } return FormValidation.error(Messages.ProxyConfiguration_FailedToConnect(testUrl, httpResponse.statusCode())); } catch (IOException e) { diff --git a/core/src/main/resources/hudson/Messages.properties b/core/src/main/resources/hudson/Messages.properties index f819794b72ed..634790b49440 100644 --- a/core/src/main/resources/hudson/Messages.properties +++ b/core/src/main/resources/hudson/Messages.properties @@ -109,7 +109,7 @@ ProxyConfiguration.TestUrlRequired=Test URL is required. ProxyConfiguration.MalformedTestUrl=Malformed Test URL {0}. ProxyConfiguration.FailedToConnectViaProxy=Failed to connect to {0}. ProxyConfiguration.FailedToConnect=Failed to connect to {0} (code {1}). -ProxyConfiguration.Success=Success +ProxyConfiguration.Success=Success (code {0}) Functions.NoExceptionDetails=No Exception details diff --git a/core/src/main/resources/hudson/Messages_bg.properties b/core/src/main/resources/hudson/Messages_bg.properties index 8e107f48482e..98b816053e44 100644 --- a/core/src/main/resources/hudson/Messages_bg.properties +++ b/core/src/main/resources/hudson/Messages_bg.properties @@ -88,7 +88,7 @@ ProxyConfiguration.FailedToConnectViaProxy=\ ProxyConfiguration.FailedToConnect=\ Неуспешна връзка към „{0}“ (код: {1}). ProxyConfiguration.Success=\ - Успех + Успех (код: {0}) Functions.NoExceptionDetails=\ Няма допълнителна информация за изключението. diff --git a/core/src/main/resources/hudson/Messages_de.properties b/core/src/main/resources/hudson/Messages_de.properties index deff47390ca7..e4068a20b58a 100644 --- a/core/src/main/resources/hudson/Messages_de.properties +++ b/core/src/main/resources/hudson/Messages_de.properties @@ -68,7 +68,7 @@ PluginWrapper.PluginWrapperAdministrativeMonitor.DisplayName=Plugin-Ladefehler ProxyConfiguration.FailedToConnectViaProxy=Konnte nicht mit {0} verbinden. ProxyConfiguration.FailedToConnect=Konnte nicht mit {0} verbinden (code {1}). ProxyConfiguration.MalformedTestUrl=Format der Test-URL ungültig -ProxyConfiguration.Success=Erfolg +ProxyConfiguration.Success=Erfolg (code {0}) ProxyConfiguration.TestUrlRequired=Test-URL muss angegeben werden. AboutJenkins.DisplayName=Über Jenkins diff --git a/core/src/main/resources/hudson/Messages_es.properties b/core/src/main/resources/hudson/Messages_es.properties index ce9b89404822..d1ae229de9bc 100644 --- a/core/src/main/resources/hudson/Messages_es.properties +++ b/core/src/main/resources/hudson/Messages_es.properties @@ -99,7 +99,7 @@ ProxyConfiguration.TestUrlRequired=Se requiere un URL de prueba. ProxyConfiguration.MalformedTestUrl=La URL de prueba está mal formada. ProxyConfiguration.FailedToConnectViaProxy=No se puede conectar a {0}. ProxyConfiguration.FailedToConnect=No se puede conectar a {0} (código {1}). -ProxyConfiguration.Success=Configurado +ProxyConfiguration.Success=Configurado (código {0}) Functions.NoExceptionDetails=No hay detalles de la excepción diff --git a/core/src/main/resources/hudson/Messages_fr.properties b/core/src/main/resources/hudson/Messages_fr.properties index a6d5e0340989..db45e76ab397 100644 --- a/core/src/main/resources/hudson/Messages_fr.properties +++ b/core/src/main/resources/hudson/Messages_fr.properties @@ -109,7 +109,7 @@ ProxyConfiguration.TestUrlRequired=Une URL de test est requise. ProxyConfiguration.MalformedTestUrl=L''URL de test {0} n''est pas correctement formée. ProxyConfiguration.FailedToConnectViaProxy=Impossible de se connecter à {0}. ProxyConfiguration.FailedToConnect=Impossible de se connecter à {0} (code {1}). -ProxyConfiguration.Success=Succès +ProxyConfiguration.Success=Succès (code {0}) Functions.NoExceptionDetails=Aucun détail concernant l''exception diff --git a/core/src/main/resources/hudson/Messages_it.properties b/core/src/main/resources/hudson/Messages_it.properties index 55611824ba4d..b929e6447cf8 100644 --- a/core/src/main/resources/hudson/Messages_it.properties +++ b/core/src/main/resources/hudson/Messages_it.properties @@ -106,7 +106,7 @@ PluginWrapper.PluginWrapperAdministrativeMonitor.DisplayName=Errore \ ProxyConfiguration.FailedToConnect=Impossibile connettersi a {0} (codice {1}). ProxyConfiguration.FailedToConnectViaProxy=Impossibile connettersi a {0}. ProxyConfiguration.MalformedTestUrl=URL di prova {0} malformato. -ProxyConfiguration.Success=Connessione riuscita +ProxyConfiguration.Success=Connessione riuscita (codice {0}) ProxyConfiguration.TestUrlRequired=È richiesto un URL di prova. TcpSlaveAgentListener.PingAgentProtocol.displayName=Protocollo ping Util.day={0} g diff --git a/core/src/main/resources/hudson/Messages_ja.properties b/core/src/main/resources/hudson/Messages_ja.properties index 640f508df11e..9844a4bca568 100644 --- a/core/src/main/resources/hudson/Messages_ja.properties +++ b/core/src/main/resources/hudson/Messages_ja.properties @@ -61,4 +61,4 @@ AboutJenkins.Description=バージョンとライセンス情報を表示しま ProxyConfiguration.TestUrlRequired=テストURLは必須です。 ProxyConfiguration.FailedToConnectViaProxy={0} に接続できませんでした。 ProxyConfiguration.FailedToConnect={0} に接続できませんでした。(コード {1}). -ProxyConfiguration.Success=成功 +ProxyConfiguration.Success=成功 (コード {0}) diff --git a/core/src/main/resources/hudson/Messages_pt_BR.properties b/core/src/main/resources/hudson/Messages_pt_BR.properties index 4ff20bbc9708..0a809578524e 100644 --- a/core/src/main/resources/hudson/Messages_pt_BR.properties +++ b/core/src/main/resources/hudson/Messages_pt_BR.properties @@ -51,7 +51,7 @@ AboutJenkins.Description=Veja a informação de versão e licença. ProxyConfiguration.TestUrlRequired=É necessário informar a URL de teste. ProxyConfiguration.FailedToConnectViaProxy=Falha ao conectar em {0}. ProxyConfiguration.FailedToConnect=Falha ao conectar em {0} (código {1}). -ProxyConfiguration.Success=Sucesso +ProxyConfiguration.Success=Sucesso (código {0}) FilePath.did_not_manage_to_validate_may_be_too_sl=Não conseguiu validar {0} (pode ser muito lento) PluginWrapper.missing=Não foi possível encontrar {0} v{1}. Para corrigir, instale v{1} ou superior. Functions.NoExceptionDetails=Sem detalhes da exception diff --git a/core/src/main/resources/hudson/Messages_ru.properties b/core/src/main/resources/hudson/Messages_ru.properties index cb66befc0413..e2f17eb05183 100644 --- a/core/src/main/resources/hudson/Messages_ru.properties +++ b/core/src/main/resources/hudson/Messages_ru.properties @@ -41,7 +41,7 @@ ProxyConfiguration.TestUrlRequired=Требуется тестовый URL ProxyConfiguration.MalformedTestUrl=Некорректный тестовый URL: {0}. ProxyConfiguration.FailedToConnectViaProxy=Не удалось подключиться к {0}. ProxyConfiguration.FailedToConnect=Не удалось подключиться к {0} (код: {1}). -ProxyConfiguration.Success=Успешно +ProxyConfiguration.Success=Успешно (код: {0}) Functions.NoExceptionDetails=Нет дополнительной информации об Исключении PluginWrapper.missing={0}, версия {1} отсутствует. Установите версию {1} или новее. PluginWrapper.failed_to_load_plugin={0}, версия {1} не удалось загрузить. diff --git a/core/src/main/resources/hudson/Messages_sr.properties b/core/src/main/resources/hudson/Messages_sr.properties index fa7cc8048839..3c266c5d67a3 100644 --- a/core/src/main/resources/hudson/Messages_sr.properties +++ b/core/src/main/resources/hudson/Messages_sr.properties @@ -31,7 +31,7 @@ ProxyConfiguration.TestUrlRequired=URL адреса за тестирање мо ProxyConfiguration.MalformedTestUrl=Неправилна тест URL адреса: {0}. ProxyConfiguration.FailedToConnectViaProxy=Успостављање везе са {0} није успело. ProxyConfiguration.FailedToConnect=Успостављање везе са {0} није успело (код: {1}). -ProxyConfiguration.Success=Успешно +ProxyConfiguration.Success=Успешно (код: {0}) Functions.NoExceptionDetails=Нема детаља о грешци PluginWrapper.missing={0}, верзија {1} не постоји. Инсталирајте верзију {1} или новије. PluginWrapper.failed_to_load_plugin=Није могло учитаи {0}, верзија {1}. diff --git a/core/src/main/resources/hudson/Messages_zh_TW.properties b/core/src/main/resources/hudson/Messages_zh_TW.properties index 872ee9ee5f66..708613e7e603 100644 --- a/core/src/main/resources/hudson/Messages_zh_TW.properties +++ b/core/src/main/resources/hudson/Messages_zh_TW.properties @@ -80,7 +80,7 @@ ProxyConfiguration.TestUrlRequired=測試 URL 為必填欄位。 ProxyConfiguration.MalformedTestUrl=測試 URL {0} 不正確。 ProxyConfiguration.FailedToConnectViaProxy=無法連線到 {0}。 ProxyConfiguration.FailedToConnect=無法連線到 {0} (代碼 {1})。 -ProxyConfiguration.Success=成功 +ProxyConfiguration.Success=成功 (代碼 {0}) Functions.NoExceptionDetails=沒有例外狀況的詳細資訊