juergen     02/01/28 05:09:05

  Modified:    src/webdav/client/src/org/apache/webdav/lib/methods
                        MoveMethod.java CopyMethod.java
               src/webdav/client/src/org/apache/commons/httpclient
                        HttpMethodBase.java HttpMethod.java HttpClient.java
  Log:
  the host header should not contain the protocol, IMO, but the target header must.
  following changes:
  1) added new method generateHeaders(boolean httpsRequired, String host, State 
state), all other are deprecated now.
  2) copy- and move-method use the flag to create the target header, all other webdav 
methods still use the old implementation.
  please see recent e-mail too [Slide and mod-dav]
  
  Revision  Changes    Path
  1.15      +10 -6     
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/MoveMethod.java
  
  Index: MoveMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/MoveMethod.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- MoveMethod.java   18 Nov 2001 18:29:52 -0000      1.14
  +++ MoveMethod.java   28 Jan 2002 13:09:04 -0000      1.15
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/MoveMethod.java,v
 1.14 2001/11/18 18:29:52 dirkv Exp $
  - * $Revision: 1.14 $
  - * $Date: 2001/11/18 18:29:52 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/MoveMethod.java,v
 1.15 2002/01/28 13:09:04 juergen Exp $
  + * $Revision: 1.15 $
  + * $Date: 2002/01/28 13:09:04 $
    *
    * ====================================================================
    *
  @@ -212,15 +212,19 @@
       /**
        * Generate additional headers needed by the request.
        *
  +     * @param httpsRequired true, if the protocol is https, else http
        * @param host the host
        * @param state State token
        */
  -    public void generateHeaders(String host, State state) {
  +    public void generateHeaders(boolean httpsRequired, String host, State state) {
   
           super.generateHeaders(host, state);
   
  -        String absoluteDestination = host
  -            + state.URLEncode(destination);
  +        String protocol;
  +        if (httpsRequired) protocol = "https://";;
  +        else               protocol = "http://";;
  +        String absoluteDestination =
  +            protocol + host + state.URLEncode(destination);
   
           super.setHeader("Destination", absoluteDestination);
           if (!isOverwrite())
  
  
  
  1.15      +12 -7     
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/CopyMethod.java
  
  Index: CopyMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/CopyMethod.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- CopyMethod.java   18 Nov 2001 18:29:52 -0000      1.14
  +++ CopyMethod.java   28 Jan 2002 13:09:04 -0000      1.15
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/CopyMethod.java,v
 1.14 2001/11/18 18:29:52 dirkv Exp $
  - * $Revision: 1.14 $
  - * $Date: 2001/11/18 18:29:52 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/methods/CopyMethod.java,v
 1.15 2002/01/28 13:09:04 juergen Exp $
  + * $Revision: 1.15 $
  + * $Date: 2002/01/28 13:09:04 $
    *
    * ====================================================================
    *
  @@ -213,15 +213,20 @@
       /**
        * Generate additional headers needed by the request.
        *
  +     * @param httpsRequired true, if the protocol is https, else http
        * @param host the host
        * @param state State token
        */
  -    public void generateHeaders(String host, State state) {
  +    public void generateHeaders(boolean httpsRequired, String host, State state) {
   
           super.generateHeaders(host, state);
  -             
  -        String absoluteDestination = host
  -            + state.URLEncode(destination);
  +        
  +        String protocol;
  +        if (httpsRequired) protocol = "https://";;
  +        else               protocol = "http://";;
  +        String absoluteDestination =
  +            protocol + host + state.URLEncode(destination);
  +        
   
           super.setHeader("Destination", absoluteDestination);
           if (!isOverwrite())
  
  
  
  1.3       +18 -5     
jakarta-slide/src/webdav/client/src/org/apache/commons/httpclient/HttpMethodBase.java
  
  Index: HttpMethodBase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/commons/httpclient/HttpMethodBase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpMethodBase.java       14 Sep 2001 17:06:43 -0000      1.2
  +++ HttpMethodBase.java       28 Jan 2002 13:09:05 -0000      1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/commons/httpclient/HttpMethodBase.java,v
 1.2 2001/09/14 17:06:43 juergen Exp $
  - * $Revision: 1.2 $
  - * $Date: 2001/09/14 17:06:43 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/commons/httpclient/HttpMethodBase.java,v
 1.3 2002/01/28 13:09:05 juergen Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/01/28 13:09:05 $
    *
    * ====================================================================
    *
  @@ -409,9 +409,21 @@
       /**
        * Generate additional headers needed by the request.
        *
  +     * @param httpsRequired true, if the protocol is https, else http
  +     * @param host the host
  +     * @param state State token
  +     */
  +    public void generateHeaders(boolean httpsRequired, String host, State state) {
  +        generateHeaders(host, state);  // the default implementation
  +    }
  +
  +
  +    /**
  +     * Generate additional headers needed by the request.
  +     *
        * @param state State token
        * @deprecated this method is deprecated in favour of the
  -     * <CODE>generateHeaders(String, State)</CODE> method.
  +     * <CODE>generateHeaders(boolean, String, State)</CODE> method.
        */
       public void generateHeaders(State state) {
   
  @@ -419,12 +431,13 @@
   
       }
   
  -
       /**
        * Generate additional headers needed by the request.
        *
        * @param host the host
        * @param state State token
  +     * @deprecated this method is deprecated in favour of the
  +     * <CODE>generateHeaders(boolean, String, State)</CODE> method.
        */
       public void generateHeaders(String host, State state) {
   
  
  
  
  1.2       +15 -5     
jakarta-slide/src/webdav/client/src/org/apache/commons/httpclient/HttpMethod.java
  
  Index: HttpMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/commons/httpclient/HttpMethod.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpMethod.java   10 Aug 2001 20:39:50 -0000      1.1
  +++ HttpMethod.java   28 Jan 2002 13:09:05 -0000      1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/commons/httpclient/HttpMethod.java,v
 1.1 2001/08/10 20:39:50 remm Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/08/10 20:39:50 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/commons/httpclient/HttpMethod.java,v
 1.2 2002/01/28 13:09:05 juergen Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/28 13:09:05 $
    *
    * ====================================================================
    *
  @@ -261,7 +261,17 @@
       /**
        * Generate additional headers needed by the request.
        *
  -     * @param state State token
  +     * @param httpsRequired true, if the protocol is https, else http
  +     * @param host name of the host
  +     * @param state the state object
  +     */
  +    public void generateHeaders(boolean httpsRequired, String host, State state);
  +
  +    /**
  +     * Generate additional headers needed by the request.
  +     *
  +     * @param host name of the host
  +     * @param state the state object
        */
       public void generateHeaders(String host, State state);
   
  @@ -345,7 +355,7 @@
   
       /**
        * Return true if the method's response is expected to have a body.
  -     * 
  +     *
        * @return true if a response body should be expected by the client
        */
       public boolean hasResponseBody();
  
  
  
  1.7       +7 -12     
jakarta-slide/src/webdav/client/src/org/apache/commons/httpclient/HttpClient.java
  
  Index: HttpClient.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/commons/httpclient/HttpClient.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- HttpClient.java   18 Nov 2001 18:28:33 -0000      1.6
  +++ HttpClient.java   28 Jan 2002 13:09:05 -0000      1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/commons/httpclient/HttpClient.java,v
 1.6 2001/11/18 18:28:33 dirkv Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/11/18 18:28:33 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/commons/httpclient/HttpClient.java,v
 1.7 2002/01/28 13:09:05 juergen Exp $
  + * $Revision: 1.7 $
  + * $Date: 2002/01/28 13:09:05 $
    *
    * ====================================================================
    *
  @@ -423,7 +423,7 @@
               try {
                   openConnection();
                   methodProcessed = true;
  -            } 
  +            }
               catch (java.net.ConnectException e) {
   //              System.out.println("##################11111 =" + retries);
   //              e.printStackTrace();
  @@ -683,7 +683,7 @@
        *             to make usage more clear.
        */
       public void startSession() {
  -             startSession("localhost",80,null,false);
  +        startSession("localhost",80,null,false);
       }
   
   
  @@ -931,13 +931,8 @@
           String hostName = sessionHost;
           if (sessionPort != 80)
               hostName = hostName + ":" + sessionPort;
  -                     
  -             if (this.https)
  -                     hostName = "https://"; + hostName;
  -             else    
  -                     hostName = "http://"; + hostName;
  -
  -        method.generateHeaders(hostName, state);
  +            
  +        method.generateHeaders(this.https, hostName, state);
   
           Enumeration headersList = method.getHeaders();
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to