[prev in list] [next in list] [prev in thread] [next in thread]
List: httpcomponents-commits
Subject: [httpcomponents-client] branch 5.0.x updated: Incorrect handling of malformed authority component by
From: olegk () apache ! org
Date: 2020-09-29 7:56:07
Message-ID: 160136616749.28492.18072524149297779747 () gitbox ! apache ! org
[Download RAW message or body]
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch 5.0.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
The following commit(s) were added to refs/heads/5.0.x by this push:
new 7cc22af Incorrect handling of malformed authority component by \
URIUtils#extractHost 7cc22af is described below
commit 7cc22af931372c1a9c4bc226985801b13d659223
Author: Oleg Kalnichevski <olegk@apache.org>
AuthorDate: Tue Sep 29 09:37:38 2020 +0200
Incorrect handling of malformed authority component by URIUtils#extractHost
---
.../src/main/java/org/apache/hc/client5/http/utils/URIUtils.java | 2 +-
.../src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/utils/URIUtils.java \
b/httpclient5/src/main/java/org/apache/hc/client5/http/utils/URIUtils.java index \
bf53275..15c7115 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/utils/URIUtils.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/utils/URIUtils.java
@@ -259,7 +259,7 @@ public class URIUtils {
host = uri.getAuthority();
if (host != null) {
// Strip off any leading user credentials
- final int at = host.indexOf('@');
+ final int at = host.lastIndexOf('@');
if (at >= 0) {
if (host.length() > at+1 ) {
host = host.substring(at+1);
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java \
b/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java index \
e2d0340..8429db4 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java
@@ -238,6 +238,8 @@ public class TestURIUtils {
URIUtils.extractHost(new URI("http://:80/robots.txt")));
Assert.assertEquals(null,
URIUtils.extractHost(new \
URI("http://some%20domain:80/robots.txt"))); + Assert.assertEquals(new \
HttpHost("google.com", -1), + URIUtils.extractHost(new \
URI("http://blah@goggle.com:80@google.com/"))); }
@Test
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic