You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2024/01/16 09:08:10 UTC

(httpcomponents-core) branch 5.2.x updated: HTTPCORE-763: remove checks that assert a path does not start with "//"

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch 5.2.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git


The following commit(s) were added to refs/heads/5.2.x by this push:
     new 266223192 HTTPCORE-763: remove checks that assert a path does not start with "//"
266223192 is described below

commit 266223192451e5d77a75329f6701701fc66fb709
Author: Marco Bungart <ma...@googlemail.com>
AuthorDate: Mon Jan 15 17:14:06 2024 +0100

    HTTPCORE-763: remove checks that assert a path does not start with "//"
---
 .../java/org/apache/hc/core5/http/message/BasicHttpRequest.java     | 4 ----
 .../java/org/apache/hc/core5/http/message/TestBasicMessages.java    | 6 ------
 2 files changed, 10 deletions(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHttpRequest.java b/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHttpRequest.java
index 0d4279e11..2e35377ac 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHttpRequest.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/message/BasicHttpRequest.java
@@ -208,9 +208,6 @@ public class BasicHttpRequest extends HeaderGroup implements HttpRequest {
 
     @Override
     public void setPath(final String path) {
-        if (path != null) {
-            Args.check(!path.startsWith("//"), "URI path begins with multiple slashes");
-        }
         this.path = path;
         this.requestUri = null;
     }
@@ -278,7 +275,6 @@ public class BasicHttpRequest extends HeaderGroup implements HttpRequest {
         final StringBuilder buf = new StringBuilder();
         final String rawPath = requestUri.getRawPath();
         if (!TextUtils.isBlank(rawPath)) {
-            Args.check(!rawPath.startsWith("//"), "URI path begins with multiple slashes");
             buf.append(rawPath);
         } else {
             buf.append("/");
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java
index 54a009584..e93b84037 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java
@@ -198,12 +198,6 @@ public class TestBasicMessages {
         Assertions.assertEquals(new URI("http://%21example%21.com/stuff"), request.getUri());
     }
 
-    @Test
-    public void testRequestPathWithMultipleLeadingSlashes() throws Exception {
-        Assertions.assertThrows(IllegalArgumentException.class, () ->
-                new BasicHttpRequest(Method.GET, URI.create("http://host//stuff")));
-    }
-
     @Test
     public void testRequestAbsoluteRequestUri() throws Exception {
         final BasicHttpRequest request = new BasicHttpRequest(Method.GET, new HttpHost("http", "somehost", -1), "stuff");