列出caldav目录时访问禁止错误

Posted

技术标签:

【中文标题】列出caldav目录时访问禁止错误【英文标题】:access forbidden error when listing caldav directory 【发布时间】:2013-06-03 06:51:20 【问题描述】:

我正在尝试在我的本地主机上列出苹果日历服务器的用户目录。我收到访问禁止错误,对于组也是如此。我的操作系统是 ubuntu 12.04 LTS。并且包来自存储库。

这里是runshell.py命令的日志

/calendars/users > ls

        <-------- BEGIN HTTP CONNECTION -------->
Server: localhost

        <-------- BEGIN HTTP REQUEST -------->
PROPFIND /calendars/users/ HTTP/1.1
Host: localhost:8008
Authorization: Digest username="test", realm="Test Realm", nonce="17913381079262023151194175611", uri="/calendars/users/", response="df3db481efdc68df9c39733a957f072a", algorithm="md5"
Content-Length: 145
Content-Type: text/xml; charset=utf-8
Depth: 1
Brief: t

<?xml version='1.0' encoding='utf-8'?>
<ns0:propfind xmlns:ns0="DAV:">
  <ns0:prop>
    <ns0:resourcetype />
  </ns0:prop>
</ns0:propfind>

        <-------- BEGIN HTTP RESPONSE -------->
HTTP/1.1 403 Forbidden
Date: Mon, 03 Jun 2013 06:48:12 GMT
DAV: 1, access-control
Content-Type: text/html;charset=utf-8
Content-Length: 139
Server: Twisted/8.2.0 TwistedWeb/8.2.0

<html><head><title>403 Forbidden</title></head><body><h1>Forbidden</h1>You don't have permission to access /calendars/users/.</body></html> 
        <-------- END HTTP RESPONSE -------->

        <-------- END HTTP CONNECTION -------->
Ignoring error: 403

【问题讨论】:

【参考方案1】:

首先,您是否验证了您使用的请求 uri 对应于 DAV:principal-collection-set 属性?见https://www.rfc-editor.org/rfc/rfc3744#section-5.8

然后,principal 命名空间通常不通过 PROPFIND 查询,而是通过 DAV:principal-property-search REPORT 查询。见https://www.rfc-editor.org/rfc/rfc3744#section-9.4

现在,如果您想检索日历服务器上的所有用户,我不确定服务器是否真的允许您这样做,尤其是在您拥有大量用户的情况下。

【讨论】:

以上是关于列出caldav目录时访问禁止错误的主要内容,如果未能解决你的问题,请参考以下文章

列出 CalDAV 上可供用户使用的日历 (Bedework)

使用 CalDav API 集成 Yahoo 日历

无法从苹果 caldav 服务器获取用户的“当前用户主体”

如何从 Caldav 客户端为 iCloud 日历删除重复的事件条目

CALDAV 在 ICLOUD 中编辑/删除多个事件

Thunderbird Lightning caldav 同步不显示任何数据/事件