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 2007/11/18 09:04:06 UTC

DO NOT REPLY [Bug 43893] New: - WebDAV servlet returns incorrect values for the "href" property

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=43893

           Summary: WebDAV servlet returns incorrect values for the "href"
                    property
           Product: Tomcat 6
           Version: 6.0.14
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: grnch@gmx.net


Deploy the attached WAR file under a vanilla installation of Tomcat 6.0.14, 
then send the following WebDAV request (I simply pasted it in netcat, maybe 
telnet will work too if you don't have netcat):

PROPFIND /webdav/file.txt HTTP/1.1
Content-Type: text/xml; charset=utf-8
User-Agent: Jakarta Commons-HttpClient/3.0
Host: localhost:8080
Depth: 0

Don't forget to press enter twice at the end. Observe the result:

<?xml version="1.0" encoding="utf-8" ?>
<multistatus xmlns="DAV:"><response><href>/webdav/file.txt/file.txt</href>
<propstat><prop><creationdate>2007-11-18T07:42:14Z</creationdate>
<displayname><![CDATA[file.txt]]></displayname>
<getlastmodified>Sun, 18 Nov 2007 07:42:14 GMT</getlastmodified>
<getcontentlength>0</getcontentlength>
<getcontenttype>text/plain</getcontenttype>
<getetag>W/"0-1195371734000"</getetag>
<resourcetype/><source></source>
<supportedlock><lockentry><lockscope><exclusive/></lockscope><locktype><write/
></locktype></lockentry><lockentry><lockscope><shared/></
lockscope><locktype><write/></locktype></lockentry></supportedlock>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>

Note in particular the incorrect value in <href>/webdav/file.txt/file.txt</
href>, paths are being duplicated.

This wouldn't usually be a big problem as many WebDAV clients don't rely so 
much on this "href" value, but the Apache slide-webdavlib client library relies 
on it and breaks if it's incorrect, so any WebDAV enabled applications using 
this library will not work with Tomcat 6. That's the only reason I marked this 
bug as major, apologies if it's a wrong classification.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43893] - WebdavServlet returns incorrect values for the "href" property when it is mapped with / url prefix, instead of /*

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=43893





------- Additional Comments From grnch@gmx.net  2007-11-21 23:34 -------
Oh, not a big issue at all, don't bother with it if it's not trivial to fix, it 
now works great for my purposes. The real issue I guess is that I didn't even 
know it was supposed to be mapped to /*, I simply mapped it to / as usual for 
other servlets, so as you said it just needs to be documented better. Feel free 
to WONTFIX this bug.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43893] - WebDAV servlet returns incorrect values for the "href" property

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=43893


grnch@gmx.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #21144|0                           |1
        is obsolete|                            |




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43893] - WebDAV servlet returns incorrect values for the "href" property

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=43893





------- Additional Comments From grnch@gmx.net  2007-11-18 00:05 -------
Created an attachment (id=21143)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=21143&action=view)
minimal webapp demonstrating the bug


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43893] - WebdavServlet returns incorrect values for the "href" property when it is mapped with / url prefix, instead of /*

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=43893


grnch@gmx.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|WebDAV servlet returns      |WebdavServlet returns
                   |incorrect values for the    |incorrect values for the
                   |"href" property             |"href" property when it is
                   |                            |mapped with / url prefix,
                   |                            |instead of /*




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43893] - WebDAV servlet returns incorrect values for the "href" property

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=43893





------- Additional Comments From grnch@gmx.net  2007-11-20 06:45 -------
(In reply to comment #3)
> The patch you suggests breaks the ability to have different urls for editing 
and
> viewing by mapping to /edit/* or similar.

For what its worth, I've since discovered that the patch also broke even basic 
functionality, like deleting files with the Microsoft Web Folders client, so it 
was definitely wrong.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43893] - WebDAV servlet returns incorrect values for the "href" property

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=43893


grnch@gmx.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal




------- Additional Comments From grnch@gmx.net  2007-11-20 00:09 -------
Hello Mark, thanks for looking into this.

You are absolutely right, it does work fine when the servlet is mapped with /*, 
it only fails with / mapping. The reason I used / is because I do want the 
redirects to be generated, but I can use /* as a workaround for now, thanks!

I'm surprised though that you can't reproduce it with the / mapping. I can 
reliably reproduce it here every time, I just tried again to make sure, here is 
a transcript of the steps:

<unpack freshly downloaded apache-tomcat-6.0.14.tar.gz into c:\apache-
tomcat-6.0.14, and download webdav.war from this bug report to C:\webdav.war>

C:\>set CATALINA_HOME=c:\apache-tomcat-6.0.14

C:\>copy webdav.war %CATALINA_HOME%\webapps
        1 file(s) copied.

C:\>%CATALINA_HOME%\bin\catalina.bat start
Using CATALINA_BASE:   c:\apache-tomcat-6.0.14
Using CATALINA_HOME:   c:\apache-tomcat-6.0.14
Using CATALINA_TMPDIR: c:\apache-tomcat-6.0.14\temp
Using JRE_HOME:        c:\Java\jdk-1.6.0

C:\>nc localhost 8080
PROPFIND /webdav/file.txt HTTP/1.1
Content-Type: text/xml; charset=utf-8
User-Agent: Jakarta Commons-HttpClient/3.0
Host: localhost:8080
Depth: 0

HTTP/1.1 207 Multi-Status
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=UTF-8
Content-Length: 732
Date: Tue, 20 Nov 2007 07:45:33 GMT

<?xml version="1.0" encoding="utf-8" ?>
<multistatus xmlns="DAV:"><response><href>/webdav/file.txt/file.txt</href>
<propstat><prop><creationdate>2007-11-18T07:42:14Z</creationdate>
<displayname><![CDATA[file.txt]]></displayname>
<getlastmodified>Sun, 18 Nov 2007 07:42:14 GMT</getlastmodified>
<getcontentlength>0</getcontentlength>
<getcontenttype>text/plain</getcontenttype>
<getetag>W/"0-1195371734000"</getetag>
<resourcetype/><source></source>
<supportedlock><lockentry><lockscope><exclusive/></lockscope><locktype><write/
></locktype></lockentry><lockentry><lockscope><share
d/></lockscope><locktype><write/></locktype></lockentry></supportedlock>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>


That "nc" command above is netcat from Cygwin, which I have in the PATH.

Even though the attached patch turned out to be too naive, it does show the 
exact line in the code where I observed the path duplication with a debugger, 
when WebdavServlet is mapped to / url prefix.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43893] - WebdavServlet returns incorrect values for the "href" property when it is mapped with / url prefix, instead of /*

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=43893





------- Additional Comments From markt@apache.org  2007-11-21 15:54 -------
How much of an issue is it if you have to map to '/*' rather than '/' ?

The way WebDAV is coded at the minute I can't see an easy to get it to work
correctly with a mapping of '/'. I am tempted to just amend the docs accordingly. 

To get the correct behaviour the servlet needs to know how it is mapped and
there is no easy way to get this. It is available in the Tomcat internals but I
really don't want to go down that road.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43893] - WebDAV servlet returns incorrect values for the "href" property

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=43893





------- Additional Comments From grnch@gmx.net  2007-11-18 00:08 -------
Created an attachment (id=21144)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=21144&action=view)
simple patch that fixes the problem

It seems the call to request.getServletPath() is superfluous in this context,
as the "path" variable already contains the path of the resource relative to
the servlet context path (i.e. it includes getServletPath() already), so simply
omitting getServletPath() solves the issue.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43893] - WebdavServlet returns incorrect values for the "href" property when it is mapped with / url prefix, instead of /*

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=43893


markt@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX




------- Additional Comments From markt@apache.org  2007-11-23 11:07 -------
As per #6 and #7, I am marking this as WONTFIX.

The JavaDoc for trunk has been updated and I have proposed the updated docs for
backport to 6.0.x.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43893] - WebDAV servlet returns incorrect values for the "href" property

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=43893





------- Additional Comments From markt@apache.org  2007-11-19 15:29 -------
There are a few subtle differences if you map to '/' rather than '/*'. There
might other slight difference is you map to /edit/*. I'll work on getting these
fixed.

The patch you suggests breaks the ability to have different urls for editing and
viewing by mapping to /edit/* or similar.

I am unable to reproduce the duplicate file name you show in your report. I'm
not sure why. I also don't get the <getcontentlength>, <getcontenttype> and
<getetag> tags. Could you confirm this result with your provided test case?

Thanks,

Mark

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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