[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit/cookies CookieJar.java,1.7,1.8 CookieList
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2004-02-12 13:08:18
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/cookies In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20516/src/com/meterware/httpunit/cookies Modified Files: CookieJar.java CookieListener.java CookieProperties.java Log Message: Accept specified cookie domains lacking a leading dot Index: CookieJar.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/cookies/CookieJar.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- CookieJar.java 12 Feb 2004 06:57:52 -0000 1.7 +++ CookieJar.java 12 Feb 2004 13:03:24 -0000 1.8 @@ -365,9 +365,9 @@ private int getDomainAttributeStatus( String domainAttribute, String sourceHost ) { - if (CookieProperties.isDomainMatchingStrict() && !domainAttribute.startsWith(".")) { - return CookieListener.DOMAIN_NO_STARTING_DOT; - } else if (domainAttribute.lastIndexOf('.') == 0) { + if (!domainAttribute.startsWith(".")) domainAttribute = '.' + domainAttribute; + + if (domainAttribute.lastIndexOf('.') == 0) { return CookieListener.DOMAIN_ONE_DOT; } else if (!sourceHost.endsWith( domainAttribute )) { return CookieListener.DOMAIN_NOT_SOURCE_SUFFIX; Index: CookieListener.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/cookies/CookieListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CookieListener.java 17 Jun 2003 11:08:25 -0000 1.1 +++ CookieListener.java 12 Feb 2004 13:03:24 -0000 1.2 @@ -3,7 +3,7 @@ /******************************************************************************************************************** * $Id$ * - * Copyright (c) 2003, Russell Gold + * Copyright (c) 2003-2004, Russell Gold * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation @@ -26,9 +26,6 @@ /** Indicates that the cookie was accepted. **/ public final static int ACCEPTED = 0; - /** Indicates that the domain attribute does not begin with a dot. **/ - public final static int DOMAIN_NO_STARTING_DOT = 1; - /** Indicates that the domain attribute has only one dot. **/ public final static int DOMAIN_ONE_DOT = 2; Index: CookieProperties.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/cookies/CookieProperties.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CookieProperties.java 17 Jun 2003 11:08:25 -0000 1.1 +++ CookieProperties.java 12 Feb 2004 13:03:24 -0000 1.2 @@ -6,7 +6,7 @@ /******************************************************************************************************************** * $Id$ * - * Copyright (c) 2003, Russell Gold + * Copyright (c) 2003-2004, Russell Gold * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation @@ -46,21 +46,36 @@ } + /** + * Returns true (the default) if cookies should be rejected if they specify a domain which is not a suffix + * of the host domain or does not contain all of the dots in that host domain name + * (see <a href="http://www.faqs.org/rfcs/rfc2965.html">RFC2965</a>). + */ public static boolean isDomainMatchingStrict() { return _domainMatchingStrict; } + /** + * Specifies whether strict domain name matching must be followed. + */ public static void setDomainMatchingStrict( boolean domainMatchingStrict ) { _domainMatchingStrict = domainMatchingStrict; } + /** + * Returns true (the default) if cookies should be rejected if they specify a path which is not a prefix + * of the request path (see <a href="http://www.faqs.org/rfcs/rfc2965.html">RFC2965</a>). + */ public static boolean isPathMatchingStrict() { return _pathMatchingStrict; } + /** + * Specifies whether strict path name matching must be followed. + */ public static void setPathMatchingStrict( boolean pathMatchingStrict ) { _pathMatchingStrict = pathMatchingStrict; } |