Second FAIL for today: Microsoft Windows WebDAV implementation!

Why does MS ship a WebDAV connector with their operating system if is is so fu**ed up beyond repair that it makes you want to rm -rf the virtual machine the whole system is running in.

I set up several WebDAV folders on Apache2 to provide easy(!!!) file uploads for our CMS maintainers which they can access on their Windows desktops. My tests on GNU/Linux with cadaver worked fine and everything went smoothly as I intended it.

So I went on and tried to incorporate the shares in Windows:

Setting up the URL

This immediately resulted in an error popup (translated message: "The folder entered is not valid. Please choose another folder."). I took turns, trying to find out what happened, searched a lot of blog posts about Windows and WebDAV and how much it sucks but I found no hint that could solve my problem.

So i settled with Wireshark as a last resort and I captured the network traffic when I tried to access the URL with Windows WebDAV.

That was when it hit me like a truck, something was missing from the URL in the packet dump:

See the missing slash at the end?

Yeah right, some funny folk over at Redmond implemented a strip-the-trailing-slash-from-the-URL function for the Windows WebDAV implementation.

The string "/pathto/webdav/bmed/" silently became "/pathto/webdav/bmed"!

This will have no impact if you configured you Apache2 to enable WebDAV on a location without the trailing slash. Mine was configured like this:

Alias /pathto/webdav/bmed/ /some/webdav/folder/ <Location /pathto/webdav/bmed/> Dav on </Location>

So Windows never queried for the right URL to get WebDAV support. I had to remove the trailing slash from my configuration to get make it work.

I'm very courious now what the responsible engineer at Microsoft had on his mind when he implemented this crap ... but I guess we will never know.

UPDATE: For the sake of completeness, this behaviour is still not fixed in Microsoft Windows 7 Build 7201. It's even using the same old dialogs but it seems that they have changed the User-Agent string to "Microsoft-WebDAV-MiniRedir/6.1.7201". So Windows 7 folks have a new but still broken WebDAV implementation. Congrats!