cvs commit: jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/control CookieManager.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

cvs commit: jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/control CookieManager.java

sebb-3
sebb        2005/05/25 13:01:46

  Modified:    src/protocol/http/org/apache/jmeter/protocol/http/control
                        CookieManager.java
  Log:
  Add some debug for cookie handling
 
  Revision  Changes    Path
  1.35      +15 -3     jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
 
  Index: CookieManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- CookieManager.java 2 Apr 2005 23:21:49 -0000 1.34
  +++ CookieManager.java 25 May 2005 20:01:46 -0000 1.35
  @@ -216,6 +216,7 @@
        */
       public void add(Cookie c)
       {
  +     if (log.isDebugEnabled()) log.debug("Add cookie "+c.toString());
    String cv = c.getValue();
    if (DELETE_NULL_COOKIES && (null == cv || "".equals(cv))){
    removeCookieNamed(c.getName());
  @@ -287,18 +288,27 @@
        */
       public String getCookieHeaderForURL(URL url)
       {
  +     boolean debugEnabled = log.isDebugEnabled();
  + if (debugEnabled) log.debug("Get cookie for URL= "+url);
           if (!url.getProtocol().toUpperCase().trim().equals("HTTP")
               && !url.getProtocol().toUpperCase().trim().equals("HTTPS"))
               return null;
   
           StringBuffer header = new StringBuffer();
  +        String host= "."+url.getHost();
  +        if (debugEnabled) log.debug("URL Host="+host);
           for (PropertyIterator iter = getCookies().iterator(); iter.hasNext();)
           {
               Cookie cookie = (Cookie) iter.next().getObjectValue();
               // Add a leading dot to the host name so that host X matches
               // domain .X. This is a breach of the standard, but it's how
               // browsers behave:
  -            String host= "."+url.getHost();
  +            if (debugEnabled) {
  +             log.debug("Cookie domain="+cookie.getDomain()
  +             +" path="+cookie.getPath()
  +             +" expires="+cookie.getExpires()
  +             );
  +            }
               if (host.endsWith(cookie.getDomain())
                   && url.getFile().startsWith(cookie.getPath())
                   && ((cookie.getExpires()==0) // treat as never expiring (bug 27713)
  @@ -309,6 +319,7 @@
                   {
                       header.append("; ");
                   }
  +                if (debugEnabled) log.debug("Cookie value = "+cookie.getValue());
                   header.append(cookie.getName()).append("=").append(
                       cookie.getValue());
               }
  @@ -316,6 +327,7 @@
   
           if (header.length() != 0)
           {
  +         if (debugEnabled) log.debug(header.toString());
               return header.toString();
           }
           else
 
 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]