WebdavServlet overrides both getRelativePath() and getPathPrefix() to remount th entire application. If you derive a new servlet from that and reinstantiate the behavior of the DefautServlet this line https://github.com/apache/tomcat/blob/142c45a4271e1fd8d400196a883fb560ebded110/java/org/apache/catalina/servlets/WebdavServlet.java#L1851 will break it and return invalid paths in multi-status responses. I bet this is an oversight. The fix is trivial: > - String href = req.getContextPath() + req.getServletPath(); > + String href = getPathPrefix(req); which I can apply if no one objects.
Then https://github.com/apache/tomcat/blob/142c45a4271e1fd8d400196a883fb560ebded110/java/org/apache/catalina/servlets/WebdavServlet.java#L1468 should use getPathPrefix(req).length().
And https://github.com/apache/tomcat/blob/142c45a4271e1fd8d400196a883fb560ebded110/java/org/apache/catalina/servlets/WebdavServlet.java#L1809 should also probably use getPathPrefix(req) instead of simply req.getContextPath() because the servlet path is clearly not in the errorPath already.
Last, https://github.com/apache/tomcat/blob/142c45a4271e1fd8d400196a883fb560ebded110/java/org/apache/catalina/servlets/WebdavServlet.java#L1461 should simply use getPathPrefix(req). Only checking the context path is not enough (if there is a servlet path and it doesn't match, it's not going to work later).
Hmm. With these changes implemented I am seeing a failure in the basic Litmus WebDAV tests. I'm investigating...
Not an issue. There was a bug in the test suite and I just needed to pull the latest code. I'll get these changes committed shortly.
Fixed in: - 11.0.x for 11.0.0 onwards - 10.1.x for 10.1.31 onwards - 9.0.x for 9.0.96 onwards
(In reply to Mark Thomas from comment #5) > Not an issue. There was a bug in the test suite and I just needed to pull > the latest code. I'll get these changes committed shortly. Good advice on the update, I was trying to compile 0.13 from http://www.webdav.org/neon/litmus/ which failed. Then 0.15 from the up to date location was having that put test fail (clearly not related to the change). Works after updating.