问题
I know that there are a number of libraries available, but I am trying to learn more about the WebDav protocol itself for a project I’m developing.
For stage 1, I would like to implement a virtual read-only file system in PHP, presenting as a WebDav server.
As far as I can tell, it would need to be able to:
- list virtual files & directories
- change directories
- print the contents of a single file
I’ve found a number of sources, but they either try to do too much or gloss over the implementation of the protocol itself.
Can someone explain or point me to a source that might answer the following:
- What are the steps in the communication between the client & server?
- How does PHP receive a request, and how should the response be formatted?
Thanks
回答1:
When I originally started sabre/dav I still made sure to read the entire rfc first. You really need to have a good idea of all the features, the data model and how they work together.
After that, you probably only really need to look at the PROPFIND
, OPTIONS
and GET
methods. One option is to just look at what a client sends your way... figure out based on the rfcs what the response should be, and then write the code that sends the correct response.
Another good way to start learning is to hook up an existing webdav client to a webdav server and inspect what kind of messages they send back and forward.
来源:https://stackoverflow.com/questions/31236991/php-diy-webdav-server