我正在实施一个WebDAV服务器但是遇到了建议的客户端(Windows 7资源管理器)的问题。在Windows中我浏览到\ server \ public \ container,我的服务器想要将其作为包含两个文件的文件夹呈现,因此我收到了以下请求:
PROPFIND /public/container HTTP/1.1
Connection: Keep-Alive
User-Agent: Microsoft-WebDAV-MiniRedir/6.1.7601
Depth: 1
translate: f
Content-Length: 0
Host: devsys:4511
我的回答是:
HTTP/1.1 207 Multi-Status
Server: MyServer 2.12
Date: Mon, 08 Sep 14 17:57:50 -0000
Host: server.somewhere.com
Content-Type: text/xml; charset="utf-8"
Content-Length: 2901
<d:multistatus xmlns:d="DAV:">
<d:response>
<d:href>/public/container</d:href>
<d:propstat>
<d:prop>
<d:creationdate>2014-09-05T19:00:00Z</d:creationdate>
<d:displayname>container</d:displayname>
<d:resourcetype>
<d:collection/>
</d:resourcetype>
<d:supportedlock>
<d:lockentry>
<d:lockscope>
<d:exclusive/>
</d:lockscope>
<d:locktype>
<d:write/>
</d:locktype>
</d:lockentry>
<d:lockentry>
<d:lockscope>
<d:shared/>
</d:lockscope>
<d:locktype>
<d:write/>
</d:locktype>
</d:lockentry>
</d:supportedlock>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
<d:response>
<d:href>/public/container/myFile1</d:href>
<d:propstat>
<d:prop>
<d:getcontenttype>text/plain</d:getcontenttype>
<d:getcontentlength>375</d:getcontentlength>
<d:getetag>"1410198520"</d:getetag>
<d:creationdate>2014-09-05T19:00:00Z</d:creationdate>
<d:displayname>myFile1</d:displayname>
<d:getlastmodified>05 Sep 2014 19:00:00 GMT</d:getlastmodified>
<d:resourcetype/>
<d:supportedlock>
<d:lockentry>
<d:lockscope>
<d:exclusive/>
</d:lockscope>
<d:locktype>
<d:write/>
</d:locktype>
</d:lockentry>
<d:lockentry>
<d:lockscope>
<d:shared/>
</d:lockscope>
<d:locktype>
<d:write/>
</d:locktype>
</d:lockentry>
</d:supportedlock>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
<d:response>
<d:href>/public/container/myFile2</d:href>
<d:propstat>
<d:prop>
<d:getcontenttype>text/plain</d:getcontenttype>
<d:getcontentlength>375</d:getcontentlength>
<d:getetag>"1410198523"</d:getetag>
<d:creationdate>2014-09-05T19:00:00Z</d:creationdate>
<d:displayname>myFile2</d:displayname>
<d:getlastmodified>05 Sep 2014 19:00:00 GMT</d:getlastmodified>
<d:resourcetype/>
<d:supportedlock>
<d:lockentry>
<d:lockscope>
<d:exclusive/>
</d:lockscope>
<d:locktype>
<d:write/>
</d:locktype>
</d:lockentry>
<d:lockentry>
<d:lockscope>
<d:shared/>
</d:lockscope>
<d:locktype>
<d:write/>
</d:locktype>
</d:lockentry>
</d:supportedlock>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
</d:multistatus>
Windows提供错误\ myserver \ public \ container不是 无障碍。您可能没有权限使用此网络 资源。联系服务器管理员以了解您是否 拥有访问权限。 参数不正确。
它似乎无法弄清楚它可能是什么参数,也不知道它为什么不正确。谁能发现明显的错误?我错过了Windows需要的属性,还是我做错了什么?
服务器在C中,所以我对响应有字节级控制。
谢谢 - 罗格
答案 0 :(得分:2)
建议:使用多个客户端(例如Cyberduck)进行测试。
上面的PROPFIND响应不正确;它有&#34; multistatus&#34;在没有命名空间,但它应该在&#34; DAV:&#34;命名空间。
答案 1 :(得分:2)
首先删除了大多数属性,理由是其中一个属性提供了“错误参数”然后慢慢添加它们,似乎Windows不喜欢'getlastmodified'日期,我有: / p>
05 Sep 2014 19:00:00 GMT
将其更改为:
Fri,05 Sep 2014 19:00:00 GMT
很可爱。
感谢您的帮助 - 它有助于清理代码!