jakarta-jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mstov...@apache.org
Subject cvs commit: jakarta-jmeter/src/org/apache/jmeter/protocol/http/control CookieManager.java
Date Fri, 08 Jun 2001 18:03:11 GMT
mstover1    01/06/08 11:03:10

  Modified:    src/org/apache/jmeter/protocol/http/control
                        CookieManager.java
  Log:
  Fix to cookies whose values contain "="
  
  Revision  Changes    Path
  1.7       +14 -10    jakarta-jmeter/src/org/apache/jmeter/protocol/http/control/CookieManager.java
  
  Index: CookieManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/protocol/http/control/CookieManager.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CookieManager.java	2001/03/17 22:25:49	1.6
  +++ CookieManager.java	2001/06/08 18:03:06	1.7
  @@ -78,7 +78,7 @@
    * pass cookies along with a request.
    *
    * @author  <a href="mailto:sdowd@arcmail.com">Sean Dowd</a>
  - * @version $Revision: 1.6 $ $Date: 2001/03/17 22:25:49 $
  + * @version $Revision: 1.7 $ $Date: 2001/06/08 18:03:06 $
    */
   public class CookieManager extends AbstractTableModel implements ConfigElement,JMeterComponentModel,Saveable
{
   
  @@ -305,9 +305,9 @@
   
   		  // first n=v is name=value
   		  nvp = st.nextToken();
  -		  StringTokenizer nvpTokenizer = new StringTokenizer(nvp, "=");
  -		  String name = nvpTokenizer.nextToken();
  -		  String value = nvpTokenizer.nextToken();
  +		  int index = nvp.indexOf("=");
  +		  String name = nvp.substring(0,index);
  +		  String value = nvp.substring(index+1);
   		  String domain = url.getHost();
   		  String path = url.getFile();
   
  @@ -317,18 +317,22 @@
   		  while (st.hasMoreTokens()) {
   				nvp = st.nextToken();
   				nvp = nvp.trim();
  -				nvpTokenizer = new StringTokenizer(nvp, "=");
  -				String key = nvpTokenizer.nextToken();
  +				index = nvp.indexOf("=");
  +				if(index == -1)
  +				{
  +					index = nvp.length();
  +				}
  +				String key = nvp.substring(0,index);
   				if (key.equalsIgnoreCase("expires")) {
   					 try {
  -						  String expires = nvpTokenizer.nextToken();
  +						  String expires = nvp.substring(index+1);
   						  Date date = dateFormat.parse(expires);
   						  newCookie.setExpires(date.getTime());
   					 } catch (ParseException pe) {}
   				} else if (key.equalsIgnoreCase("domain")) {
  -					 newCookie.setDomain(nvpTokenizer.nextToken());
  +					 newCookie.setDomain(nvp.substring(index+1));
   				} else if (key.equalsIgnoreCase("path")) {
  -					 newCookie.setPath(nvpTokenizer.nextToken());
  +					 newCookie.setPath(nvp.substring(index+1));
   				} else if (key.equalsIgnoreCase("secure")) {
   					 newCookie.setSecure(true);
   				}
  @@ -347,7 +351,7 @@
   		  }
   
   		  for (Enumeration e = removeIndices.elements(); e.hasMoreElements();) {
  -				int index = ((Integer) e.nextElement()).intValue();
  +				index = ((Integer) e.nextElement()).intValue();
   				cookies.remove(index);
   		  }
   
  
  
  

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


Mime
View raw message