PHP: DIY WebDav Server

风流意气都作罢 提交于 2019-12-12 04:06:53

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!