Author: markt Date: Sat Mar 16 20:04:46 2013 New Revision: 1457301 URL: http://svn.apache.org/r1457301 Log: Additional test cases
Modified: tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestAuthorizationDigest.java Modified: tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestAuthorizationDigest.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestAuthorizationDigest.java?rev=1457301&r1=1457300&r2=1457301&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestAuthorizationDigest.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestAuthorizationDigest.java Sat Mar 16 20:04:46 2013 @@ -126,6 +126,28 @@ public class TestAuthorizationDigest { } @Test + public void testQuotedLhex() throws Exception { + String header = "Digest nc=\"00000001\""; + + StringReader input = new StringReader(header); + + Map<String,String> result = HttpParser.parseAuthorizationDigest(input); + + Assert.assertEquals("00000001", result.get("nc")); + } + + @Test + public void testUnclosedQuotedLhex() throws Exception { + String header = "Digest nc=\"00000001"; + + StringReader input = new StringReader(header); + + Map<String,String> result = HttpParser.parseAuthorizationDigest(input); + + Assert.assertNull(result); + } + + @Test public void testUnclosedQuotedString1() throws Exception { String header = "Digest username=\"test"; @@ -226,6 +248,16 @@ public class TestAuthorizationDigest { } @Test + public void testWrongCharacterInToken2() throws Exception { + String header = "Digest qop=\u044f"; + + StringReader input = new StringReader(header); + + Map<String,String> result = HttpParser.parseAuthorizationDigest(input); + Assert.assertNull(result); + } + + @Test public void testWrongCharacterInQuotedToken() throws Exception { String header = "Digest qop=\"\u044f\""; @@ -244,4 +276,14 @@ public class TestAuthorizationDigest { Map<String,String> result = HttpParser.parseAuthorizationDigest(input); Assert.assertNull(result); } + + @Test + public void testWrongCharacterInQuotedHex() throws Exception { + String header = "Digest nc=\"\u044f\""; + + StringReader input = new StringReader(header); + + Map<String,String> result = HttpParser.parseAuthorizationDigest(input); + Assert.assertNull(result); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org