hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1778460 - in /httpcomponents/httpclient/trunk/httpclient5/src: main/java/org/apache/hc/client5/http/impl/cookie/BasicPathHandler.java test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieAttribHandlers.java
Date Thu, 12 Jan 2017 19:21:03 GMT
Author: olegk
Date: Thu Jan 12 19:21:03 2017
New Revision: 1778460

URL: http://svn.apache.org/viewvc?rev=1778460&view=rev
Log:
HTTPCLIENT-1788: RFC 6265 policy must not reject cookies with paths that are no prefix of
the uri path

Modified:
    httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/cookie/BasicPathHandler.java
    httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieAttribHandlers.java

Modified: httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/cookie/BasicPathHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/cookie/BasicPathHandler.java?rev=1778460&r1=1778459&r2=1778460&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/cookie/BasicPathHandler.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/main/java/org/apache/hc/client5/http/impl/cookie/BasicPathHandler.java
Thu Jan 12 19:21:03 2017
@@ -29,7 +29,6 @@ package org.apache.hc.client5.http.impl.
 import org.apache.hc.client5.http.cookie.CommonCookieAttributeHandler;
 import org.apache.hc.client5.http.cookie.Cookie;
 import org.apache.hc.client5.http.cookie.CookieOrigin;
-import org.apache.hc.client5.http.cookie.CookieRestrictionViolationException;
 import org.apache.hc.client5.http.cookie.MalformedCookieException;
 import org.apache.hc.client5.http.cookie.SetCookie;
 import org.apache.hc.core5.annotation.Contract;
@@ -58,11 +57,6 @@ public class BasicPathHandler implements
     @Override
     public void validate(final Cookie cookie, final CookieOrigin origin)
             throws MalformedCookieException {
-        if (!match(cookie, origin)) {
-            throw new CookieRestrictionViolationException(
-                "Illegal 'path' attribute \"" + cookie.getPath()
-                + "\". Path of origin: \"" + origin.getPath() + "\"");
-        }
     }
 
     static boolean pathMatch(final String uriPath, final String cookiePath) {

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieAttribHandlers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieAttribHandlers.java?rev=1778460&r1=1778459&r2=1778460&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieAttribHandlers.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieAttribHandlers.java
Thu Jan 12 19:21:03 2017
@@ -298,22 +298,6 @@ public class TestBasicCookieAttribHandle
     }
 
     @Test
-    public void testBasicPathValidate() throws Exception {
-        final BasicClientCookie cookie = new BasicClientCookie("name", "value");
-        final CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false);
-        final CookieAttributeHandler h = new BasicPathHandler();
-        cookie.setPath("/stuff");
-        h.validate(cookie, origin);
-        cookie.setPath("/stuffed");
-        try {
-            h.validate(cookie, origin);
-            Assert.fail("MalformedCookieException must have been thrown");
-        } catch (final MalformedCookieException ex) {
-            // expected
-        }
-    }
-
-    @Test
     public void testBasicPathInvalidInput() throws Exception {
         final CookieAttributeHandler h = new BasicPathHandler();
         try {



Mime
View raw message