commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r345737 - in /jakarta/commons/proper/httpclient/trunk/src: java/org/apache/commons/httpclient/util/ test/org/apache/commons/httpclient/ test/org/apache/commons/httpclient/cookie/
Date Sun, 20 Nov 2005 12:30:58 GMT
Author: olegk
Date: Sun Nov 20 04:30:47 2005
New Revision: 345737

URL: http://svn.apache.org/viewcvs?rev=345737&view=rev
Log:
PR #37526 (warn on invalid set-cookie header)

Contributed by Oleg Kalnichevski
Reviewed by Ortwin Gl├╝ck and Michael Becke

Modified:
    jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/util/ParameterParser.java
    jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/TestParameterParser.java
    jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/cookie/TestCookieCompatibilitySpec.java

Modified: jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/util/ParameterParser.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/util/ParameterParser.java?rev=345737&r1=345736&r2=345737&view=diff
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/util/ParameterParser.java
(original)
+++ jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/util/ParameterParser.java
Sun Nov 20 04:30:47 2005
@@ -225,7 +225,7 @@
             if (hasChar() && (chars[pos] == separator)) {
                 pos++; // skip separator
             }
-            if ((paramName != null) && (paramName.length() > 0)) {
+            if (paramName != null && !(paramName.equals("") && paramValue
== null)) {
                 params.add(new NameValuePair(paramName, paramValue));
             }
         }        

Modified: jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/TestParameterParser.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/TestParameterParser.java?rev=345737&r1=345736&r2=345737&view=diff
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/TestParameterParser.java
(original)
+++ jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/TestParameterParser.java
Sun Nov 20 04:30:47 2005
@@ -96,7 +96,9 @@
 
         s = " = stuff ";
         params = parser.parse(s, ';');
-        assertEquals(0, params.size());
+        assertEquals(1, params.size());
+        assertEquals("", ((NameValuePair)params.get(0)).getName());
+        assertEquals("stuff", ((NameValuePair)params.get(0)).getValue());
     }
     
     public void testParsingEscapedChars() {

Modified: jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/cookie/TestCookieCompatibilitySpec.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/cookie/TestCookieCompatibilitySpec.java?rev=345737&r1=345736&r2=345737&view=diff
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/cookie/TestCookieCompatibilitySpec.java
(original)
+++ jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/cookie/TestCookieCompatibilitySpec.java
Sun Nov 20 04:30:47 2005
@@ -381,6 +381,17 @@
         assertEquals("Version", 0, parsed[0].getVersion());
     }
  
+    public void testParseNoName() throws Exception {
+        Header header = new Header("Set-Cookie","=stuff; path=/");
+
+        CookieSpec cookiespec = new CookieSpecBase();
+        try {
+            Cookie[] parsed = cookieParse(cookiespec, "127.0.0.1", 80, "/", false, header);
+            fail("MalformedCookieException should have been thrown");
+        } catch (MalformedCookieException ex) {
+            // expected
+        }
+    }
  
     public void testParseNoValue() throws Exception {
         Header header = new Header("Set-Cookie","cookie-name=");



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


Mime
View raw message