svnkit-dav and an empty servlet context path

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

svnkit-dav and an empty servlet context path

This post has NOT been accepted by the mailing list yet.
I wrote my own little source forge using svnkit 1.7 and the DAVServlet.
But recently after upgrading to TortoiseSVN 1.8 checkouts gave me an error because of the Content-Length -1 change I think.

So I tried upgrading the svnkit.jar to 1.8.10 but then I got an error like this:

Unexpected HTTP status 400 'Bad Request' on 'repos/JPAGen/!svn/vcc/default'

I noticed the missing start slash so I wrote a tcp tunnel that injected the slash and that worked almost but gave me another error later where a repo path was still incorrect in some WebDAV XML.

I almost gave up at that point thinking about reverting to TortoiseSVN 1.7 simply.

But I did want to report the problem here so I tried a pure 1.8.10 DAVServlet test to be able to report the issue and that suddenly worked. I used TestSVNKIT as my project name and my context path.

Then I tried to change the context path to "" (an empty string) in the Eclipse module configuration dialog (to be able to access the web project without the need for a path in the URL) just as I do for my source forge project.

And boom, same error.

So I grepped the svnkit-dav code for getContextPath and there was only one important location:


I first tried this:

        String requestContext = request.getContextPath();
        requestContext = "/";

But still the slash was being swallowed by the SVNPathUtil.append function.

I looked at the append code and found that if there is only a slash given as the first parameter to  SVNPathUtil.append it will be swallowed. I wonder if that is a bug ?

But since I only had the svnkit-dav source code in my web project I quick fixed it using this code:

            requestContext = SVNPathUtil.append(pathToRepos, reposName);
            return SVNEncodingUtil.uriEncode(requestContext);


If the svnkit-dav DAVServlet is deployed in a web project using an empty context path TortoiseSVN 1.8 ( and 1.9 ) fails with the error message:

Unexpected HTTP status 400 'Bad Request' on 'repos/JPAGen/!svn/vcc/default'

The workaround I am testing now is to prepend a slash in DAVRepositoryManager.getResourceContext
That seems to work, at least for checkouts.