Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/http
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20699/src/org/htmlparser/http
Modified Files:
ConnectionManager.java
Log Message:
Add cookie processing changes suggested by Marcus Mattern.
Index: ConnectionManager.java
===================================================================
RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/http/ConnectionManager.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ConnectionManager.java 20 Jun 2005 01:56:32 -0000 1.6
--- ConnectionManager.java 12 Nov 2005 14:19:50 -0000 1.7
***************
*** 425,428 ****
--- 425,429 ----
Vector cookies;
Cookie probe;
+ boolean found; // flag if a cookie with current name is already there
if (null != cookie.getDomain ())
***************
*** 434,437 ****
--- 435,439 ----
if (null != cookies)
{
+ found = false;
for (int j = 0; j < cookies.size (); j++)
{
***************
*** 443,446 ****
--- 445,449 ----
{
cookies.setElementAt (cookie, j); // replace
+ found = true; // cookie found, set flag
break;
}
***************
*** 448,455 ****
--- 451,463 ----
{
cookies.insertElementAt (cookie, j);
+ found = true; // cookie found, set flag
break;
}
}
}
+ if (!found)
+ // there's no cookie with the current name, therefore it's added
+ // at the end of the list (faster then inserting at the front)
+ cookies.addElement (cookie);
}
else
***************
*** 459,463 ****
mCookieJar.put (domain, cookies);
}
-
}
--- 467,470 ----
|