CardDAV与osX / iPhone客户端

时间:2011-04-01 02:57:45

标签: iphone macos webdav

我正在实施一个crm包的CardDAV后端。

在与我的后端握手期间,处理以下请求/响应:

PROPFIND /directory/ HTTP/1.1
Host: 10.0.0.202:9292
User-Agent: Address%20Book/883 CFNetwork/454.11.12 Darwin/10.7.0 (i386) (MacBookPro4%2C1)
Content-Type: text/xml; charset=utf-8
Depth: 0
Accept: */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Content-Length: 147
Connection: keep-alive

<?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:" xmlns:C="DAV:">
<D:prop>
<C:current-user-privilege-set/>
</D:prop>
</D:propfind>
HTTP/1.1 207
Content-Type: text/xml; charset="utf-8"
Content-Length: 432
Connection: keep-alive
Server: thin 1.2.11 codename Bat-Shit Crazy

<?xml version="1.0" encoding="UTF-8"?>
<D:multistatus xmlns:D="DAV:">
  <D:response>
    <D:href>http://10.0.0.202:9292/directory/</D:href>
    <D:propstat>
      <D:prop>
        <D:current-user-privilege-set>
          <D:privilege>
            <D:read/>
          </D:privilege>
        </D:current-user-privilege-set>
      </D:prop>
      <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
  </D:response>
</D:multistatus>
PROPFIND /contacts/ HTTP/1.1
Host: 10.0.0.202:9292
User-Agent: Address%20Book/883 CFNetwork/454.11.12 Darwin/10.7.0 (i386) (MacBookPro4%2C1)
Content-Type: text/xml; charset=utf-8
Depth: 0
Accept: */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Content-Length: 167
Connection: keep-alive

<?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav">
<D:prop>
<C:addressbook-home-set/>
</D:prop>
</D:propfind>
HTTP/1.1 207
Content-Type: text/xml; charset="utf-8"
Content-Length: 408
Connection: keep-alive
Server: thin 1.2.11 codename Bat-Shit Crazy

<?xml version="1.0" encoding="UTF-8"?>
<D:multistatus xmlns:D="DAV:">
  <D:response>
    <D:href>http://10.0.0.202:9292/contacts/</D:href>
    <D:propstat>
      <D:prop>
        <D:addressbook-home-set>
          <D:href>http://10.0.0.202:9292/contacts/</D:href>
        </D:addressbook-home-set>
      </D:prop>
      <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
  </D:response>
</D:multistatus>

尽管我的CardDAV后端从未暗示/directory/是客户需要关注的任何事情。

客户端正在返回错误The CardDAV server returned an error (207) for the user "richo",但是当我修补服务器以返回不同的状态代码(200)时,我得到了相同的错误,但是有了新的状态代码。

我正在努力预测其他事情会让人对这种反应感到不安。我试过返回绝对值而不是相对URL(反之亦然)无济于事。

任何意见都表示赞赏。在mac论坛here上存在类似的问题,似乎以解决方案结束但链接已损坏。

1 个答案:

答案 0 :(得分:0)

事实证明,这是名称空间问题。

在适当的地方使用urn:ietf:params:xml:ns:carddav命名空间将其清除。