Skip to content

Commit

Permalink
[JENKINS-72343] Accept all 2xx and 3xx status codes to validate proxy…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
lemeurherve authored Dec 5, 2023
1 parent 0f0d81b commit b8344b9
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/ProxyConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ public FormValidation doValidateProxy(
}
try {
HttpResponse<Void> 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) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_bg.properties
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ ProxyConfiguration.FailedToConnectViaProxy=\
ProxyConfiguration.FailedToConnect=\
Неуспешна връзка към „{0}“ (код: {1}).
ProxyConfiguration.Success=\
Успех
Успех (код: {0})

Functions.NoExceptionDetails=\
Няма допълнителна информация за изключението.
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ AboutJenkins.Description=バージョンとライセンス情報を表示しま
ProxyConfiguration.TestUrlRequired=テストURLは必須です。
ProxyConfiguration.FailedToConnectViaProxy={0} に接続できませんでした。
ProxyConfiguration.FailedToConnect={0} に接続できませんでした。(コード {1}).
ProxyConfiguration.Success=成功
ProxyConfiguration.Success=成功 (コード {0})
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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} не удалось загрузить.
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_sr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/Messages_zh_TW.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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=沒有例外狀況的詳細資訊

Expand Down

0 comments on commit b8344b9

Please sign in to comment.