[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit/cookies CookieJar.java,1.2,1.3
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2003-05-23 21:53:01
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/cookies
In directory sc8-pr-cvs1:/tmp/cvs-serv19595/src/com/meterware/httpunit/cookies
Modified Files:
CookieJar.java
Log Message:
bug #741965: be more lenient in accepting cookie domains
Index: CookieJar.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/cookies/CookieJar.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CookieJar.java 4 Nov 2002 21:01:37 -0000 1.2
+++ CookieJar.java 23 May 2003 21:52:57 -0000 1.3
@@ -356,7 +356,14 @@
if (!domainAttribute.startsWith(".")) return false;
if (domainAttribute.lastIndexOf('.') == 0) return false;
if (!sourceHost.endsWith( domainAttribute )) return false;
- if (sourceHost.lastIndexOf( domainAttribute ) > sourceHost.indexOf( '.' )) return false;
+ if (!isLenientMatching() && sourceHost.lastIndexOf( domainAttribute ) > sourceHost.indexOf( '.' )) return false;
+ return true;
+ }
+
+
+ // set this to false to reject cookies when the host is of the form HD where D is the explicit domain attribute
+ // and H contains a dot. Apparently, most browsers are lenient.
+ private boolean isLenientMatching() {
return true;
}
|