You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "arturobernalg (via GitHub)" <gi...@apache.org> on 2026/02/10 08:26:27 UTC

[PR] HTTPCLIENT-2415: Normalize CookieOrigin path for cookie matching [httpcomponents-client]

arturobernalg opened a new pull request, #803:
URL: https://github.com/apache/httpcomponents-client/pull/803

   Strip query / fragment from CookieOrigin path per RFC 6265. Add regression tests for request-targets containing '?', '#'.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] HTTPCLIENT-2415: Normalize CookieOrigin path for cookie matching [httpcomponents-client]

Posted by "arturobernalg (via GitHub)" <gi...@apache.org>.
arturobernalg merged PR #803:
URL: https://github.com/apache/httpcomponents-client/pull/803


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] HTTPCLIENT-2415: Normalize CookieOrigin path for cookie matching [httpcomponents-client]

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on code in PR #803:
URL: https://github.com/apache/httpcomponents-client/pull/803#discussion_r2786682321


##########
httpclient5/src/main/java/org/apache/hc/client5/http/cookie/CookieOrigin.java:
##########
@@ -54,14 +54,33 @@ public CookieOrigin(final String host, final int port, final String path, final
         Args.notNull(path, "Path");
         this.host = host.toLowerCase(Locale.ROOT);
         this.port = port;
-        if (!TextUtils.isBlank(path)) {
-            this.path = path;
-        } else {
-            this.path = "/";
-        }
+        this.path = normalizePath(path);
         this.secure = secure;
     }
 
+    private static String normalizePath(final String path) {

Review Comment:
   @arturobernalg I do not think this is the right place to do path parsing. This logic should belong to the protocol interceptor that instantiates `CookieOrigin`.  The `CookieOrigin` class itself should be just a bean with no / little protocol logic. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] HTTPCLIENT-2415: Normalize CookieOrigin path for cookie matching [httpcomponents-client]

Posted by "arturobernalg (via GitHub)" <gi...@apache.org>.
arturobernalg commented on code in PR #803:
URL: https://github.com/apache/httpcomponents-client/pull/803#discussion_r2787170785


##########
httpclient5/src/main/java/org/apache/hc/client5/http/cookie/CookieOrigin.java:
##########
@@ -54,14 +54,33 @@ public CookieOrigin(final String host, final int port, final String path, final
         Args.notNull(path, "Path");
         this.host = host.toLowerCase(Locale.ROOT);
         this.port = port;
-        if (!TextUtils.isBlank(path)) {
-            this.path = path;
-        } else {
-            this.path = "/";
-        }
+        this.path = normalizePath(path);
         this.secure = secure;
     }
 
+    private static String normalizePath(final String path) {

Review Comment:
   @ok2c  you're right. changed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] HTTPCLIENT-2415: Normalize CookieOrigin path for cookie matching [httpcomponents-client]

Posted by "arturobernalg (via GitHub)" <gi...@apache.org>.
arturobernalg commented on PR #803:
URL: https://github.com/apache/httpcomponents-client/pull/803#issuecomment-3885117873

   > @arturobernalg Please cherry-pick to 5.6.x
   
   done


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] HTTPCLIENT-2415: Normalize CookieOrigin path for cookie matching [httpcomponents-client]

Posted by "arturobernalg (via GitHub)" <gi...@apache.org>.
arturobernalg commented on PR #803:
URL: https://github.com/apache/httpcomponents-client/pull/803#issuecomment-3902315476

   @ok2c I'll cherry-pick to 5.6.x


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] HTTPCLIENT-2415: Normalize CookieOrigin path for cookie matching [httpcomponents-client]

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on code in PR #803:
URL: https://github.com/apache/httpcomponents-client/pull/803#discussion_r2790063212


##########
httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAddCookies.java:
##########
@@ -76,6 +76,28 @@ public class RequestAddCookies implements HttpRequestInterceptor {
 
     private static final Logger LOG = LoggerFactory.getLogger(RequestAddCookies.class);
 
+    private static String normalizeRequestPath(final String rawPath) {

Review Comment:
   @arturobernalg This may be useful 



##########
httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAddCookies.java:
##########
@@ -76,6 +76,28 @@ public class RequestAddCookies implements HttpRequestInterceptor {
 
     private static final Logger LOG = LoggerFactory.getLogger(RequestAddCookies.class);
 
+    private static String normalizeRequestPath(final String rawPath) {

Review Comment:
   @arturobernalg This may be useful 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [PR] HTTPCLIENT-2415: Normalize CookieOrigin path for cookie matching [httpcomponents-client]

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on PR #803:
URL: https://github.com/apache/httpcomponents-client/pull/803#issuecomment-3883706506

   @arturobernalg Please cherry-pick to 5.6.x


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org