You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2015/12/27 22:12:05 UTC

svn commit: r1721846 - in /jmeter/trunk: test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java xdocs/changes.xml

Author: pmouawad
Date: Sun Dec 27 21:12:04 2015
New Revision: 1721846

URL: http://svn.apache.org/viewvc?rev=1721846&view=rev
Log:
Bug 56358 - Cookie manager supports cross port cookies and RFC6265
Bugzilla Id: 56358

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java?rev=1721846&r1=1721845&r2=1721846&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java Sun Dec 27 21:12:04 2015
@@ -182,6 +182,30 @@ public class TestCookieManager extends J
             }
         }
 
+        /**
+         * @throws Exception
+         */
+        public void testBug56358() throws Exception {
+            URL url = new URL("http://remote.com:10008/get/cookie");
+            String headerLine = "test=value;Max-age=120;path=/;Version=1";
+            man.setCookiePolicy(CookieSpecs.STANDARD);
+            man.addCookieFromHeader(headerLine, url);
+            
+            Assert.assertEquals(1, man.getCookieCount());
+            HC4CookieHandler cookieHandler = (HC4CookieHandler) man.getCookieHandler();
+            URL urlSameDomainDifferentPort = new URL("http://remote.com:10001/test/me");
+            
+            List<org.apache.http.cookie.Cookie> cookies = 
+                    cookieHandler.getCookiesForUrl(man.getCookies(), urlSameDomainDifferentPort, 
+                    CookieManager.ALLOW_VARIABLE_COOKIES);
+            Assert.assertEquals(1, cookies.size());
+            for (org.apache.http.cookie.Cookie cookie : cookies) {
+                // See http://tools.ietf.org/html/rfc6265#section-5.2.3
+                Assert.assertEquals("remote.com", cookie.getDomain());
+                Assert.assertEquals("test", cookie.getName());
+            }
+        }
+        
         public void testCrossDomainHandling() throws Exception {
             URL url = new URL("http://jakarta.apache.org/");
             assertEquals(0,man.getCookieCount()); // starts empty

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1721846&r1=1721845&r2=1721846&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sun Dec 27 21:12:04 2015
@@ -125,6 +125,7 @@ Summary
   <li><bug>58515</bug>New JSON related components : JSON-PATH Extractor and JSON-PATH Renderer in View Results Tree. Donated by Ubik Load Pack (support at ubikloadpack.com).</li>
   <li><bug>58698</bug>Correct parsing of auth-files in HTTP Authorization Manager.</li>
   <li><bug>58756</bug>CookieManager : Cookie Policy select box content must depend on Cookie implementation.</li>
+  <li><bug>56358</bug>Cookie manager supports cross port cookies and RFC6265.</li>
 </ul>
 
 <h3>Functions</h3>