CardDAV 与 osX/iPhone 客户端

发布于 2024-10-30 02:44:39 字数 2788 浏览 4 评论 0原文

我正在为 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/ 是客户端需要关注的任何内容。

客户端返回错误CardDAV 服务器为用户“richo”返回了错误 (207),但是当我修补服务器以返回不同的状态代码 (200) 时,我得到了相同的错误,但有一个新的状态代码。

我正在根据预感,认为该响应还有其他因素令其感到不安。我尝试返回绝对 URL 而不是相对 URL(反之亦然),但无济于事。

任何意见表示赞赏。 Mac 论坛此处上也有类似的问题,似乎已得到解决,但链接已损坏。

I am implementing a CardDAV backend to a crm package.

During the handshake with my backend the following request/response is handled:

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>

This is despite my CardDAV backend never hinting that /directory/ is anything that the client need concern itself with.

The client is returning the error The CardDAV server returned an error (207) for the user "richo", however when I patched the server to return a different status code (200) I got the same error, but with a new status code.

I am working on the hunch that something else is upsetting it about the response. I have tried returning absolute instead of relative URL's (and vice versa) to no avail.

Any input appreciated. There is a similar issue on the mac forums here that seems to end with resolution but the links are broken.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

身边 2024-11-06 02:44:39

事实证明,这是一个命名空间问题。

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

As it turned out, it was a namespace issue.

using the urn:ietf:params:xml:ns:carddav namespace where appropriate cleared it up.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文