logoalt Hacker News

nedtlast Thursday at 4:02 PM0 repliesview on HN

I once implemented a WebDAV server in PHP. The standard isn't that bad and clients are more or less following the standard. It's still horrible how they are doing that. I saw behaviors when opening a single file like:

  - does / exists?
  - does /path/to exists?
  - does /path/to/file exists?
  - create a new file /path/to/file.lock
  - does /path/to/file.lock exist? 
  - does / exist?
  - does /path/to/file exists?
  - lock /path/to/file
  - get content of /path/to/file
  - unlock /path/to/file
  - does /path/to/file.lock exist? 
  - remove /path/to/file.lock
(if not exactly like that it was at least very close, that was either Finder on OS X or Explorer on Windows). Without some good caching mechanism it's hard to handle all of the load when you get multiple users.

Also the overwrite option was never used. You'd expect a client to copy a file, get and error if the target exists, ask user if it's ok, send same copy with overwrite flag set to true. In reality clients are doing all steps manually and delete the target before copying.

It was satisfying seeing it work at the end, but you really need to test all the clients in addition to just implementing the standard.