remm        01/02/19 23:02:18

  Modified:    src/webdav/client/src/org/apache/webdav/lib
                        WebdavClient.java
               src/webdav/client/src/org/apache/webdav/lib/methods
                        GetMethod.java WebdavMethod.java
                        WebdavMethodBase.java
  Log:
  - Fix for problems with Squid. Setting content-length is unnecessary (and may
    be an HTTP spec violation, although I coun't confirm that) when going a
    GET. Other methods should also be modified, like HEAD.
  
  Revision  Changes    Path
  1.21      +8 -6      
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavClient.java
  
  Index: WebdavClient.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavClient.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- WebdavClient.java 2001/02/09 07:48:19     1.20
  +++ WebdavClient.java 2001/02/20 07:02:17     1.21
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavClient.java,v
 1.20 2001/02/09 07:48:19 remm Exp $
  - * $Revision: 1.20 $
  - * $Date: 2001/02/09 07:48:19 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavClient.java,v
 1.21 2001/02/20 07:02:17 remm Exp $
  + * $Revision: 1.21 $
  + * $Date: 2001/02/20 07:02:17 $
    *
    * ====================================================================
    *
  @@ -541,8 +541,9 @@
               if (debug > 1)
                   System.out.print("Content-Length: " 
                                    + query.length() + "\r\n");
  -            output.write(("Content-Length: " 
  -                          + query.length() + "\r\n").getBytes());
  +            if (method.needContentLength())
  +                output.write(("Content-Length: " 
  +                              + query.length() + "\r\n").getBytes());
           } else {
               // Chunking
               if ((http11) && (method.getHeader("Content-Length") == null)) {
  @@ -760,7 +761,8 @@
               }
           }
           
  -        if ((contentLength == -1) && (!chunk)) {
  +        if ((method.needContentLength()) && (contentLength == -1) 
  +            && (!chunk)) {
               // Non compliant server ???
               return true;
           }
  
  
  
  1.6       +13 -3     
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/GetMethod.java
  
  Index: GetMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/GetMethod.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- GetMethod.java    2001/01/21 20:34:58     1.5
  +++ GetMethod.java    2001/02/20 07:02:17     1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/GetMethod.java,v
 1.5 2001/01/21 20:34:58 remm Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/01/21 20:34:58 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/GetMethod.java,v
 1.6 2001/02/20 07:02:17 remm Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/02/20 07:02:17 $
    *
    * ====================================================================
    *
  @@ -381,4 +381,14 @@
       }
       
       
  +    /**
  +     * Return true if the method needs a content-length header in the request.
  +     * 
  +     * @return true if a content-length header will be expected by the server
  +     */
  +    public boolean needContentLength() {
  +        return false;
  +    }
  +
  +
   }
  
  
  
  1.6       +9 -3      
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethod.java
  
  Index: WebdavMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethod.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WebdavMethod.java 2001/01/29 15:26:39     1.5
  +++ WebdavMethod.java 2001/02/20 07:02:17     1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethod.java,v
 1.5 2001/01/29 15:26:39 juergen Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/01/29 15:26:39 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethod.java,v
 1.6 2001/02/20 07:02:17 remm Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/02/20 07:02:17 $
    *
    * ====================================================================
    *
  @@ -298,6 +298,12 @@
       public String generateRequestLine();
   
   
  +    /**
  +     * Return true if the method needs a content-length header in the request.
  +     * 
  +     * @return true if a content-length header will be expected by the server
  +     */
  +    public boolean needContentLength();
   
   
   }
  
  
  
  1.12      +13 -3     
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethodBase.java
  
  Index: WebdavMethodBase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethodBase.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- WebdavMethodBase.java     2001/02/15 17:40:19     1.11
  +++ WebdavMethodBase.java     2001/02/20 07:02:17     1.12
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethodBase.java,v
 1.11 2001/02/15 17:40:19 remm Exp $
  - * $Revision: 1.11 $
  - * $Date: 2001/02/15 17:40:19 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/WebdavMethodBase.java,v
 1.12 2001/02/20 07:02:17 remm Exp $
  + * $Revision: 1.12 $
  + * $Date: 2001/02/20 07:02:17 $
    *
    * ====================================================================
    *
  @@ -484,6 +484,16 @@
           return (getName() + " " + URLUtil.URLEncode(path, "UTF8") + " " 
                   + PROTOCOL + "\r\n");
   
  +    }
  +
  +
  +    /**
  +     * Return true if the method needs a content-length header in the request.
  +     * 
  +     * @return true if a content-length header will be expected by the server
  +     */
  +    public boolean needContentLength() {
  +        return true;
       }
   
   
  
  
  

Reply via email to