You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2004/02/24 14:08:33 UTC

DO NOT REPLY [Bug 27185] New: - Possible problem with the COPY request handling

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27185>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27185

Possible problem with the COPY request handling

           Summary: Possible problem with the COPY request handling
           Product: Tomcat 5
           Version: 5.0.18
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Servlets:WebDAV
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: ruediger.pluem@vodafone.com


Hi,

there may be a problem with the COPY request handling in the WebDAV servlet of
Tomcat.

Environment:

I created the webdav application with the following web.xml file in
webapps/webdav/WEB-INF:

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
 
<web-app>
 
  <servlet>
    <servlet-name>webdav</servlet-name>
    <servlet-class>org.apache.catalina.servlets.WebdavServlet</servlet-class>
    <init-param>
      <param-name>debug</param-name>
      <param-value>10</param-value>
    </init-param>
    <init-param>
      <param-name>listings</param-name>
      <param-value>true</param-value>
    </init-param>
    <!-- Uncomment this to enable read and write access -->
    <init-param>
      <param-name>readonly</param-name>
      <param-value>false</param-value>
    </init-param>
    <!--load-on-startup>1</load-on-startup-->
  </servlet>
  <servlet-mapping>
    <servlet-name>webdav</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>

</web-app>

The directory webapps/webdav/ is writable by the Tomcat jvm.

I created the collection col and uploaded the file file.txt with cadaver (which
worked fine).

So this is our starting point:

dav:/webdav/> ls
Listing collection `/webdav/': succeeded.
Coll:  col                                     0  Jan  1  1970
       file.txt                              625  Feb 24 12:21


1. If the source resource is a file and the destination resource is an existing
collection the collection
gets deleted and replaced by the file. For example the following request

COPY /webdav/file.txt HTTP/1.1
Host: 127.0.0.1:8080
Connection: TE
TE: trailers
Depth: infinity
Destination: http://127.0.0.1:8080/webdav/col/
Overwrite: T

deletes the collection col and replaces it with a file that is named col and has
the contents of file.txt.


2. If the source resource is collection and the destination resource is a
existing file the file
gets deleted and replaced by the collection. For example the following request


COPY /webdav/col/ HTTP/1.1
Host: 127.0.0.1:8080
Connection: TE
TE: trailers
Depth: infinity
Destination: http://127.0.0.1:8080/webdav/file.txt
Overwrite: T

deletes the file file.txt and replaces it with a collection that is named
file.txt and has the contents of col.

>From reading RFC 2518 I am not quite sure if this may be an intended behaviour,
but I noticed it as it is quite
different from the behaviour of a UNIX cp command and thus may lead to
unnecessary loss of data.

If it works as designed just let me know. Then I need to be more careful in the
future when handling with webdav :-).


Regards


Rüdiger Plüm

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