Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PUT to directory with guest read permission results in zero length file #7739

Closed
cyberduck opened this issue Jan 16, 2014 · 1 comment
Closed
Assignees
Labels
bug fixed webdav WebDAV Protocol Implementation
Milestone

Comments

@cyberduck
Copy link
Collaborator

6ee46a5 created the issue

Here's the scenario. guest has read access to a directory, but not write permission. The user (matthew) has write permission. Here is what I see on upload say a 100 byte file.

HEAD /myfile.txt (guest)
200 OK

PUT /myfile.txt (guest, filesize=100)
401 Unauthorized

PUT /myfile.txt (matthew, filesize=0)
200 OK

The HEAD is coming from DAVSession.login(). This succeeds and PUT tries to use the same credentials. When this fails, another PUT happens, but with 0 bytes (maybe the file pointer wasn't restored?).

My fix was to make my server return 401 on the HEAD command, but this requires user-agent snooping as HEAD can't return 401 to the browser. To fix authentication related weirdness in other client agent's I've made my server always require login for OPTIONS and PROPFIND. That has the advantage of only affecting WebDav clients, not normal HTTP usage.

I think there are two issues

a) the second PUT sends a zero-length file
b) recommend maybe calling OPTIONS or PROPFIND in DavSession.login() since those are webdav specific methods rather than HEAD which the browser also calls.

@cyberduck
Copy link
Collaborator Author

@dkocher commented

This should be fixed with the revert of a previous workaround in 4c99513.

@iterate-ch iterate-ch locked as resolved and limited conversation to collaborators Nov 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed webdav WebDAV Protocol Implementation
Projects
None yet
Development

No branches or pull requests

2 participants