GNOME Bugzilla – Bug 674139
Fail to copy some files from a IIS webdav server
Last modified: 2018-09-21 17:14:38 UTC
I'm using a webdav server based on IIS 7.5. Some files cannot be copied/read from the server, instead the server reports 404 not found. After some investigation, it appears that this is because some IIS servers (depending on the configuration) will report 404 if the file name has an unknown extension and the GET request does not have a "Translate: f" header. For more information about this special header proposed by Microsoft, you can refer to: http://msdn.microsoft.com/en-us/library/cc250216%28v=prot.10%29.aspx http://msdn.microsoft.com/en-us/library/cc250234%28v=prot.10%29.aspx http://blogs.msdn.com/b/david.wang/archive/2008/09/29/webdav-source-and-read-permissions-on-iis.aspx The man page of davfs also mentions it (at the "add_header" option): http://linux.die.net/man/5/davfs2.conf Basically, it's supposed to be a feature to allow either downloading the output of a script of the script source. However, it seems that in some default configurations the webdav server considers any file with an unknown extension (content type of application/octet-stream) as following this rule too. As they can be executed, 404 is returned. As in the case of a webdav filesystem it's unlikely that the user would like the output of a script, a rather straightforward fix is to always add "Translate: f" as header of a request. It seems to be what the webdav mount in Windows does. According to the HTTP specification, unknown headers should be ignored by the server, so it shouldn't cause problems with other servers, however for safety, you might want to only add this header to servers which report being Microsoft-IIS. Here are two traces using wget to demonstrate the behaviour of the server I have to use. Example of failing request (with wget): GET /blabla.SPE HTTP/1.0 User-Agent: Wget/1.12 (linux-gnu) Accept: */* Host: webdata.tudelft.nl Connection: Keep-Alive Authorization: Basic c3ZkZW5ob2VkdDpIaWtnMXZEZQ== ---response begin--- HTTP/1.1 404 Not Found Content-Type: text/html Server: Microsoft-IIS/7.5 X-Powered-By: ASP.NET Date: Fri, 13 Apr 2012 08:16:59 GMT Connection: keep-alive Content-Length: 1245 Example of working request (with wget --header "Translate: f"): GET /blabla.SPE HTTP/1.0 User-Agent: Wget/1.12 (linux-gnu) Accept: */* Host: webdata.tudelft.nl Connection: Keep-Alive Translate: f Authorization: Basic c3ZkZW5ob2VkdDpIaWtnMXZEZQ== ---response begin--- HTTP/1.1 200 OK Content-Type: application/octet-stream Last-Modified: Thu, 02 Feb 2012 13:58:07 GMT Accept-Ranges: bytes ETag: "20e1db1b2e1cc1:0" Server: Microsoft-IIS/7.5 X-Powered-By: ASP.NET Date: Fri, 13 Apr 2012 08:15:01 GMT Connection: keep-alive Content-Length: 135172
*** Bug 688045 has been marked as a duplicate of this bug. ***
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gvfs/issues/182.