This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-vfs.git
The following commit(s) were added to refs/heads/master by this push: new 4bc7b44 VFS-785 - credentials conflicting when root and proxy hosts are same name but different ports (#120) 4bc7b44 is described below commit 4bc7b4431ade64f000b56867b9b4fcf4eaf6be4a Author: satish-csi <67928686+satish-...@users.noreply.github.com> AuthorDate: Mon Mar 1 21:00:50 2021 +0530 VFS-785 - credentials conflicting when root and proxy hosts are same name but different ports (#120) --- .../org/apache/commons/vfs2/provider/http4/Http4FileProvider.java | 4 ++-- .../org/apache/commons/vfs2/provider/http5/Http5FileProvider.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileProvider.java index 1a2c11d..3104187 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileProvider.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileProvider.java @@ -233,7 +233,7 @@ public class Http4FileProvider extends AbstractOriginatingFileProvider { UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(rootName.getPassword()))); if (username != null && !username.isEmpty()) { - credsProvider.setCredentials(new AuthScope(rootName.getHostName(), AuthScope.ANY_PORT), + credsProvider.setCredentials(new AuthScope(rootName.getHostName(), rootName.getPort()), new UsernamePasswordCredentials(username, password)); } @@ -254,7 +254,7 @@ public class Http4FileProvider extends AbstractOriginatingFileProvider { UserAuthenticatorUtils.toString( UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, null))); - credsProvider.setCredentials(new AuthScope(proxyHost.getHostName(), AuthScope.ANY_PORT), + credsProvider.setCredentials(new AuthScope(proxyHost.getHostName(), proxyHost.getPort()), proxyCreds); } diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java index b244f41..6d0937e 100644 --- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java @@ -239,8 +239,8 @@ public class Http5FileProvider extends AbstractOriginatingFileProvider { UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(rootName.getPassword())); if (username != null && !username.isEmpty()) { - // -1 for any port - credsProvider.setCredentials(new AuthScope(rootName.getHostName(), -1), + // set root port + credsProvider.setCredentials(new AuthScope(rootName.getHostName(), rootName.getPort()), new UsernamePasswordCredentials(username, password)); } @@ -260,8 +260,8 @@ public class Http5FileProvider extends AbstractOriginatingFileProvider { UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME, null)), UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, null)); - // -1 for any port - credsProvider.setCredentials(new AuthScope(proxyHost.getHostName(), -1), + // set proxy host port + credsProvider.setCredentials(new AuthScope(proxyHost.getHostName(), proxyHost.getPort()), proxyCreds); }