OS/X WebDAV and Chunked Transfer Encoding

While OS/X's WebDAV implementation is quite slow, it is mostly pretty decent. The client uses the little used Chunked transfer encoding for PUT requests, which allows it to send big files without knowing exactly how big the file is going to be. A request like this looks like this:

PUT /image.png HTTP/1.1
Host: example.org
User-Agent: WebDAVFS/1.8 (01808000) Darwin/10.2.0 (i386)
Accept: */*
X-Expected-Entity-Length: 10316
If: (<opaquelocktoken:44445502-c253-02e6-7198-45b36c96e8c7>)
Connection: close
Transfer-Encoding: Chunked

While this is a perfectly legal HTTP request, webservers choke on it. Both Nginx and Lighttpd respond with HTTP 411 Length Required. This would have been valid for HTTP/1.0 servers, but if they claim to support HTTP/1.1 they must accept these requests.

Apache + mod_php does this fine, but just recently I got a report from someone using Apache + fastcgi + php. In this case the request body never arrived in PHP which can unfortunately result in silent data loss.

So I guess that's a bit of a warning, so far OS/X WebDAV only plays nicely with Apache + mod_php servers.