In school we host a WebDAV server with IIS where students can upload files as part of their homework. The students have not-so-common permissions: They can create a file in the directory, but can't modify it once it has been created. While this works quite well when they are in school and copy the file to the folder using a mounted network share, it doesn't work from home using WebDAV. WebDAV seems to create an empty file initially and then tries to put in the contents afterwards. The IIS log for uploading a file to the directory looks like this:
#Software: Microsoft Internet Information Services 8.5
#Version: 1.0
#Date: 2019-09-20 00:01:23
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
...
2019-09-20 13:32:20 192.168.168.13 PROPFIND / - 443 z_testschueler 80.110.119.167 Microsoft-WebDAV-MiniRedir/10.0.18362 - 207 0 0 31
2019-09-20 13:32:20 192.168.168.13 PROPFIND /AnAbgabe/EGGJ/Abgabe/test.txt - 443 z_testschueler 80.110.119.167 Microsoft-WebDAV-MiniRedir/10.0.18362 - 404 0 2 31
2019-09-20 13:32:20 192.168.168.13 PUT /AnAbgabe/EGGJ/Abgabe/test.txt - 443 z_testschueler 80.110.119.167 Microsoft-WebDAV-MiniRedir/10.0.18362 - 201 0 0 31
2019-09-20 13:32:20 192.168.168.13 LOCK /AnAbgabe/EGGJ/Abgabe/test.txt - 443 z_testschueler 80.110.119.167 Microsoft-WebDAV-MiniRedir/10.0.18362 - 200 0 0 31
2019-09-20 13:32:20 192.168.168.13 PROPPATCH /AnAbgabe/EGGJ/Abgabe/test.txt - 443 z_testschueler 80.110.119.167 Microsoft-WebDAV-MiniRedir/10.0.18362 - 207 0 0 31
2019-09-20 13:32:20 192.168.168.13 HEAD /AnAbgabe/EGGJ/Abgabe/test.txt - 443 - 80.110.119.167 Microsoft-WebDAV-MiniRedir/10.0.18362 - 401 2 5 15
2019-09-20 13:32:20 192.168.168.13 HEAD /AnAbgabe/EGGJ/Abgabe/test.txt - 443 z_testschueler 80.110.119.167 Microsoft-WebDAV-MiniRedir/10.0.18362 - 200 0 0 31
2019-09-20 13:32:20 192.168.168.13 PUT /AnAbgabe/EGGJ/Abgabe/test.txt - 443 z_testschueler 80.110.119.167 Microsoft-WebDAV-MiniRedir/10.0.18362 - 403 3 5 15
2019-09-20 13:32:20 192.168.168.13 PUT /AnAbgabe/EGGJ/Abgabe/test.txt - 443 z_testschueler 80.110.119.167 Microsoft-WebDAV-MiniRedir/10.0.18362 - 403 3 5 15
2019-09-20 13:32:20 192.168.168.13 PUT /AnAbgabe/EGGJ/Abgabe/test.txt - 443 z_testschueler 80.110.119.167 Microsoft-WebDAV-MiniRedir/10.0.18362 - 403 3 5 31
2019-09-20 13:32:20 192.168.168.13 PUT /AnAbgabe/EGGJ/Abgabe/test.txt - 443 z_testschueler 80.110.119.167 Microsoft-WebDAV-MiniRedir/10.0.18362 - 403 3 5 31
2019-09-20 13:32:20 192.168.168.13 DELETE /AnAbgabe/EGGJ/Abgabe/test.txt - 443 z_testschueler 80.110.119.167 Microsoft-WebDAV-MiniRedir/10.0.18362 - 403 3 5 31
2019-09-20 13:32:20 192.168.168.13 DELETE /AnAbgabe/EGGJ/Abgabe/test.txt - 443 z_testschueler 80.110.119.167 Microsoft-WebDAV-MiniRedir/10.0.18362 - 412 0 2377062848 31
As you can see the second command fails to retrieve props (404) because the file doesn't exist yet - no big deal IMO. The third command then creates the (probably) empty file (201). Then it gets locked (200) and a bit later there are some failing (403) PUT commands that probably try to set the content. After these operations a 0KB file named test.txt is inside the folder (because the DELETE commands at the end fail as well).
I tried to disable locking on the server because I thought the client might be able to do the write operation in one go, but according to the log file the only thing that changed was the LOCK command returning 501.
My question: Is there a way with WebDAV to write a file with a single PUT command instead of multiple so that you only create files instead of updating them?
Also if possible we would like to continue using the native Windows WebDAV support (explained for example here). If not possible we are interested in 3rd party applications that support this kind of scenarios.
0 Answers