Internet Engineering Task Force (IETF)                          C. Daboo
Request for Comments: 6578                                    Apple Inc.
Category: Standards Track                                    A. Quillaud
ISSN: 2070-1721                                                   Oracle
                                                              March 2012
        
Internet Engineering Task Force (IETF)                          C. Daboo
Request for Comments: 6578                                    Apple Inc.
Category: Standards Track                                    A. Quillaud
ISSN: 2070-1721                                                   Oracle
                                                              March 2012
        

Collection Synchronization for Web Distributed Authoring and Versioning (WebDAV)

Web分布式创作和版本控制(WebDAV)的集合同步

Abstract

摘要

This specification defines an extension to Web Distributed Authoring and Versioning (WebDAV) that allows efficient synchronization of the contents of a WebDAV collection.

本规范定义了Web分布式创作和版本控制(WebDAV)的扩展,该扩展允许高效同步WebDAV集合的内容。

Status of This Memo

关于下段备忘

This is an Internet Standards Track document.

这是一份互联网标准跟踪文件。

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.

本文件是互联网工程任务组(IETF)的产品。它代表了IETF社区的共识。它已经接受了公众审查,并已被互联网工程指导小组(IESG)批准出版。有关互联网标准的更多信息,请参见RFC 5741第2节。

Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc6578.

有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问http://www.rfc-editor.org/info/rfc6578.

Copyright Notice

版权公告

Copyright (c) 2012 IETF Trust and the persons identified as the document authors. All rights reserved.

版权所有(c)2012 IETF信托基金和确定为文件作者的人员。版权所有。

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

本文件受BCP 78和IETF信托有关IETF文件的法律规定的约束(http://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。从本文件中提取的代码组件必须包括信托法律条款第4.e节中所述的简化BSD许可证文本,并提供简化BSD许可证中所述的无担保。

This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English.

本文件可能包含2008年11月10日之前发布或公开的IETF文件或IETF贡献中的材料。控制某些材料版权的人员可能未授予IETF信托允许在IETF标准流程之外修改此类材料的权利。在未从控制此类材料版权的人员处获得充分许可的情况下,不得在IETF标准流程之外修改本文件,也不得在IETF标准流程之外创建其衍生作品,除了将其格式化以RFC形式发布或将其翻译成英语以外的其他语言。

Table of Contents

目录

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  4
   2.  Conventions Used in This Document  . . . . . . . . . . . . . .  4
   3.  WebDAV Synchronization . . . . . . . . . . . . . . . . . . . .  5
     3.1.  Overview . . . . . . . . . . . . . . . . . . . . . . . . .  5
     3.2.  DAV:sync-collection Report . . . . . . . . . . . . . . . .  6
     3.3.  Depth Behavior . . . . . . . . . . . . . . . . . . . . . .  8
     3.4.  Types of Changes Reported on Initial Synchronization . . .  9
     3.5.  Types of Changes Reported on Subsequent
           Synchronizations . . . . . . . . . . . . . . . . . . . . . 10
       3.5.1.  Changed Member . . . . . . . . . . . . . . . . . . . . 10
       3.5.2.  Removed Member . . . . . . . . . . . . . . . . . . . . 10
     3.6.  Truncation of Results  . . . . . . . . . . . . . . . . . . 11
     3.7.  Limiting Results . . . . . . . . . . . . . . . . . . . . . 12
     3.8.  Example: Initial DAV:sync-collection Report  . . . . . . . 12
     3.9.  Example: DAV:sync-collection Report with Token . . . . . . 14
     3.10. Example: Initial DAV:sync-collection Report with
           Truncation . . . . . . . . . . . . . . . . . . . . . . . . 16
     3.11. Example: Initial DAV:sync-collection Report with Limit . . 17
     3.12. Example: DAV:sync-collection Report with Unsupported
           Limit  . . . . . . . . . . . . . . . . . . . . . . . . . . 18
     3.13. Example: DAV:sync-level Set to Infinite, Initial
           DAV:sync-collection Report . . . . . . . . . . . . . . . . 19
   4.  DAV:sync-token Property  . . . . . . . . . . . . . . . . . . . 22
   5.  DAV:sync-token Use with If Header  . . . . . . . . . . . . . . 22
     5.1.  Example: If Precondition with PUT  . . . . . . . . . . . . 22
     5.2.  Example: If Precondition with MKCOL  . . . . . . . . . . . 23
   6.  XML Element Definitions  . . . . . . . . . . . . . . . . . . . 24
     6.1.  DAV:sync-collection XML Element  . . . . . . . . . . . . . 24
     6.2.  DAV:sync-token XML Element . . . . . . . . . . . . . . . . 24
     6.3.  DAV:sync-level XML Element . . . . . . . . . . . . . . . . 24
     6.4.  DAV:multistatus XML Element  . . . . . . . . . . . . . . . 25
   7.  Security Considerations  . . . . . . . . . . . . . . . . . . . 25
   8.  Acknowledgments  . . . . . . . . . . . . . . . . . . . . . . . 25
   9.  References . . . . . . . . . . . . . . . . . . . . . . . . . . 25
     9.1.  Normative References . . . . . . . . . . . . . . . . . . . 25
     9.2.  Informative References . . . . . . . . . . . . . . . . . . 26
   Appendix A.  Backwards-Compatible Handling of Depth  . . . . . . . 27
   Appendix B.  Example of a Client Synchronization Approach  . . . . 27
        
   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  4
   2.  Conventions Used in This Document  . . . . . . . . . . . . . .  4
   3.  WebDAV Synchronization . . . . . . . . . . . . . . . . . . . .  5
     3.1.  Overview . . . . . . . . . . . . . . . . . . . . . . . . .  5
     3.2.  DAV:sync-collection Report . . . . . . . . . . . . . . . .  6
     3.3.  Depth Behavior . . . . . . . . . . . . . . . . . . . . . .  8
     3.4.  Types of Changes Reported on Initial Synchronization . . .  9
     3.5.  Types of Changes Reported on Subsequent
           Synchronizations . . . . . . . . . . . . . . . . . . . . . 10
       3.5.1.  Changed Member . . . . . . . . . . . . . . . . . . . . 10
       3.5.2.  Removed Member . . . . . . . . . . . . . . . . . . . . 10
     3.6.  Truncation of Results  . . . . . . . . . . . . . . . . . . 11
     3.7.  Limiting Results . . . . . . . . . . . . . . . . . . . . . 12
     3.8.  Example: Initial DAV:sync-collection Report  . . . . . . . 12
     3.9.  Example: DAV:sync-collection Report with Token . . . . . . 14
     3.10. Example: Initial DAV:sync-collection Report with
           Truncation . . . . . . . . . . . . . . . . . . . . . . . . 16
     3.11. Example: Initial DAV:sync-collection Report with Limit . . 17
     3.12. Example: DAV:sync-collection Report with Unsupported
           Limit  . . . . . . . . . . . . . . . . . . . . . . . . . . 18
     3.13. Example: DAV:sync-level Set to Infinite, Initial
           DAV:sync-collection Report . . . . . . . . . . . . . . . . 19
   4.  DAV:sync-token Property  . . . . . . . . . . . . . . . . . . . 22
   5.  DAV:sync-token Use with If Header  . . . . . . . . . . . . . . 22
     5.1.  Example: If Precondition with PUT  . . . . . . . . . . . . 22
     5.2.  Example: If Precondition with MKCOL  . . . . . . . . . . . 23
   6.  XML Element Definitions  . . . . . . . . . . . . . . . . . . . 24
     6.1.  DAV:sync-collection XML Element  . . . . . . . . . . . . . 24
     6.2.  DAV:sync-token XML Element . . . . . . . . . . . . . . . . 24
     6.3.  DAV:sync-level XML Element . . . . . . . . . . . . . . . . 24
     6.4.  DAV:multistatus XML Element  . . . . . . . . . . . . . . . 25
   7.  Security Considerations  . . . . . . . . . . . . . . . . . . . 25
   8.  Acknowledgments  . . . . . . . . . . . . . . . . . . . . . . . 25
   9.  References . . . . . . . . . . . . . . . . . . . . . . . . . . 25
     9.1.  Normative References . . . . . . . . . . . . . . . . . . . 25
     9.2.  Informative References . . . . . . . . . . . . . . . . . . 26
   Appendix A.  Backwards-Compatible Handling of Depth  . . . . . . . 27
   Appendix B.  Example of a Client Synchronization Approach  . . . . 27
        
1. Introduction
1. 介绍

WebDAV [RFC4918] defines the concept of 'collections', which are hierarchical groupings of WebDAV resources on an HTTP [RFC2616] server. Collections can be of arbitrary size and depth (i.e., collections within collections). WebDAV clients that cache resource content need a way to synchronize that data with the server (i.e., detect what has changed and update their cache). Currently, this can be done using a WebDAV PROPFIND request on a collection to list all members of a collection along with their DAV:getetag property values, which allows the client to determine which were changed, added, or deleted. However, this does not scale well to large collections, as the XML response to the PROPFIND request will grow with the collection size.

WebDAV[RFC4918]定义了“集合”的概念,集合是HTTP[RFC2616]服务器上WebDAV资源的分层分组。集合可以具有任意大小和深度(即集合中的集合)。缓存资源内容的WebDAV客户端需要一种与服务器同步数据的方法(即,检测已更改的内容并更新其缓存)。目前,可以使用集合上的WebDAV PROPFIND请求列出集合的所有成员及其DAV:getetag属性值来完成此操作,这允许客户端确定哪些成员已更改、添加或删除。但是,这不能很好地扩展到大型集合,因为对PROPFIND请求的XML响应将随着集合的大小而增长。

This specification defines a new WebDAV report that results in the server returning to the client only information about those member URLs that were added or deleted, or whose mapped resources were changed, since a previous execution of the report on the collection.

此规范定义了一个新的WebDAV报告,该报告将导致服务器仅向客户端返回自上次对集合执行报告以来添加或删除的成员URL的信息,或其映射资源已更改的信息。

Additionally, a new property is added to collection resources that is used to convey a "synchronization token" that is guaranteed to change when the collection's member URLs or their mapped resources have changed.

此外,将向集合资源添加一个新属性,该属性用于传递“同步令牌”,该令牌保证在集合的成员URL或其映射的资源发生更改时更改。

2. Conventions Used in This Document
2. 本文件中使用的公约

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

本文件中的关键词“必须”、“不得”、“必需”、“应”、“不应”、“应”、“不应”、“建议”、“可”和“可选”应按照[RFC2119]中所述进行解释。

This document uses XML DTD fragments ([W3C.REC-xml-20081126], Section 3.2) as a purely notational convention. WebDAV request and response bodies cannot be validated by a DTD due to the specific extensibility rules defined in Section 17 of [RFC4918] and due to the fact that all XML elements defined by this specification use the XML namespace name "DAV:". In particular:

本文档使用XML DTD片段([W3C.REC-XML-20081126],第3.2节)作为纯粹的符号约定。由于[RFC4918]第17节中定义的特定扩展性规则以及本规范定义的所有XML元素都使用XML命名空间名称“DAV:”,DTD无法验证WebDAV请求和响应主体。特别地:

1. Element names use the "DAV:" namespace.

1. 元素名称使用“DAV:”名称空间。

2. Element ordering is irrelevant unless explicitly stated otherwise.

2. 除非另有明确说明,否则元素顺序无关。

3. Extension elements (elements not already defined as valid child elements) may be added anywhere, except when explicitly stated otherwise.

3. 扩展元素(尚未定义为有效子元素的元素)可以添加到任何位置,除非另有明确说明。

4. Extension attributes (attributes not already defined as valid for this element) may be added anywhere, except when explicitly stated otherwise.

4. 扩展属性(尚未定义为此元素有效的属性)可以添加到任何位置,除非另有明确说明。

When an XML element type in the "DAV:" namespace is referenced in this document outside of the context of an XML fragment, the string "DAV:" will be prefixed to the element type.

当“DAV:”命名空间中的XML元素类型在XML片段上下文之外的文档中被引用时,字符串“DAV:”将作为元素类型的前缀。

This document inherits, and sometimes extends, DTD productions from Section 14 of [RFC4918].

本文档继承并有时扩展[RFC4918]第14节中的DTD产品。

3. WebDAV Synchronization
3. WebDAV同步
3.1. Overview
3.1. 概述

One way to synchronize data between two entities is to use some form of synchronization token. The token defines the state of the data being synchronized at a particular point in time. It can then be used to determine what has changed between one point in time and another.

在两个实体之间同步数据的一种方法是使用某种形式的同步令牌。令牌定义在特定时间点同步的数据的状态。然后可以使用它来确定在一个时间点和另一个时间点之间发生了什么变化。

This specification defines a new WebDAV report that is used to enable client-server collection synchronization based on such a token.

此规范定义了一个新的WebDAV报告,用于基于此令牌启用客户端-服务器集合同步。

In order to synchronize the contents of a collection between a server and client, the server provides the client with a synchronization token each time the synchronization report is executed. That token represents the state of the data being synchronized at that point in time. The client can then present that same token back to the server at some later time, and the server will return only those items that are new, have changed, or were deleted since that token was generated. The server also returns a new token representing the new state at the time the report was run.

为了在服务器和客户端之间同步集合的内容,服务器在每次执行同步报告时都向客户端提供一个同步令牌。该标记表示在该时间点同步的数据的状态。然后,客户机可以在稍后的某个时间将相同的令牌返回给服务器,服务器将只返回自该令牌生成以来新的、已更改的或已删除的项目。服务器还返回一个新令牌,表示运行报表时的新状态。

Typically, the first time a client connects to the server it will need to be informed of the entire state of the collection (i.e., a full list of all member URLs that are currently in the collection). That is done by the client sending an empty token value to the server. This indicates to the server that a full listing is required.

通常,客户机第一次连接到服务器时,需要通知其集合的整个状态(即,当前在集合中的所有成员URL的完整列表)。这是由客户端向服务器发送空令牌值来完成的。这向服务器表明需要完整的列表。

As an alternative, the client might choose to do its first synchronization using some other mechanism on the collection (e.g., some other form of batch resource information retrieval such as PROPFIND, SEARCH [RFC5323], or specialized REPORTs such as those defined in CalDAV [RFC4791] and CardDAV [RFC6352]) and ask for the

作为替代方案,客户机可以选择使用集合上的某些其他机制(例如,一些其他形式的批处理资源信息检索,如PROPFIND、SEARCH[RFC5323]或专门报告,如CalDAV[RFC4791]和CardDAV[RFC6352]中定义的报告)进行第一次同步,并请求

DAV:sync-token property to be returned. This property (defined in Section 4) contains the same token that can be used later to issue a DAV:sync-collection report.

DAV:要返回的同步令牌属性。此属性(在第4节中定义)包含稍后可用于发布DAV:sync收集报告的相同令牌。

In some cases, a server might only wish to maintain a limited amount of history about changes to a collection. In that situation, it will return an error to the client when the client presents a token that is "out of date". At that point, the client has to fall back to synchronizing the entire collection by re-running the report request using an empty token value.

在某些情况下,服务器可能只希望维护有关集合更改的有限历史记录。在这种情况下,当客户端呈现“过期”的令牌时,它将向客户端返回一个错误。此时,客户机必须返回到同步整个集合,方法是使用空令牌值重新运行报告请求。

Typically, a client will use the synchronization report to retrieve the list of changes and will follow that with requests to retrieve the content of changed resources. It is possible that additional changes to the collection could occur between the time of the synchronization report and resource content retrieval, which could result in an inconsistent view of the collection. When clients use this method of synchronization, they need to be aware that such additional changes could occur and track them, e.g., by differences between the ETag values returned in the synchronization report and those returned when actually fetching resource content, by using conditional requests as described in Section 5, or by repeating the synchronization process until no changes are returned.

通常,客户端将使用同步报告来检索更改列表,并随后请求检索已更改资源的内容。在同步报告和资源内容检索之间,可能会对集合进行其他更改,这可能会导致集合视图不一致。当客户端使用这种同步方法时,他们需要意识到可能会发生这种额外的更改并跟踪它们,例如,通过同步报告中返回的ETag值与实际获取资源内容时返回的ETag值之间的差异,通过使用第5节中描述的条件请求,或者重复同步过程,直到不返回任何更改。

3.2. DAV:sync-collection Report
3.2. DAV:同步收集报告

If the DAV:sync-collection report is implemented by a WebDAV server, then the server MUST list the report in the "DAV:supported-report-set" property on any collection that supports synchronization.

如果DAV:sync集合报告由WebDAV服务器实现,则服务器必须在任何支持同步的集合的“DAV:supported report set”属性中列出该报告。

To implement the behavior for this report, a server needs to keep track of changes to any member URLs and their mapped resources in a collection (as defined in Section 3 of [RFC4918]). This includes noting the addition of new member URLs, the changes to the mapped resources of existing member URLs, and the removal of member URLs. The server will track each change and provide a synchronization "token" to the client that describes the state of the server at a specific point in time. This "token" is returned as part of the response to the "sync-collection" report. Clients include the last token they got from the server in the next "sync-collection" report that they execute, and the server provides the changes from the previous state (represented by the token) to the current state (represented by the new token returned).

要实现此报表的行为,服务器需要跟踪集合中任何成员URL及其映射资源的更改(如[RFC4918]第3节所定义)。这包括添加新成员URL、更改现有成员URL的映射资源以及删除成员URL。服务器将跟踪每个更改,并向客户端提供一个同步“令牌”,用于描述服务器在特定时间点的状态。此“令牌”作为“同步收集”报告响应的一部分返回。客户端在执行的下一个“sync collection”报告中包含从服务器获得的最后一个令牌,服务器提供从以前状态(由令牌表示)到当前状态(由返回的新令牌表示)的更改。

The synchronization token itself MUST be treated as an "opaque" string by the client, i.e., the actual string data has no specific meaning or syntax. However, the token MUST be a valid URI to allow

客户端必须将同步令牌本身视为“不透明”字符串,即实际字符串数据没有特定含义或语法。但是,令牌必须是有效的URI才能允许

its use in an If precondition request header (see Section 5). For example, a simple implementation of such a token could be a numeric counter that counts each change as it occurs and relates that change to the specific object that changed. The numeric value could be appended to a "base" URI to form the valid sync-token.

它在If前提条件请求头中的使用(参见第5节)。例如,这样一个令牌的简单实现可以是一个数字计数器,它在每次更改发生时对其进行计数,并将该更改与更改的特定对象相关联。数值可以附加到“基本”URI以形成有效的同步令牌。

Marshalling:

编组:

The request-URI MUST identify a collection. The request body MUST be a DAV:sync-collection XML element (see Section 6.1), which MUST contain one DAV:sync-token XML element, one DAV:sync-level element, and one DAV:prop XML element, and MAY contain a DAV:limit XML element.

请求URI必须标识一个集合。请求主体必须是DAV:sync集合XML元素(请参见第6.1节),该元素必须包含一个DAV:sync令牌XML元素、一个DAV:sync级别元素和一个DAV:prop XML元素,并且可能包含一个DAV:limit XML元素。

This report is only defined when the Depth header has value "0"; other values result in a 400 (Bad Request) error response. Note that [RFC3253], Section 3.6, states that if the Depth header is not present, it defaults to a value of "0".

仅当深度标头的值为“0”时才定义此报告;其他值会导致400(错误请求)错误响应。请注意,[RFC3253]第3.6节规定,如果深度标题不存在,则默认值为“0”。

The response body for a successful request MUST be a DAV:multistatus XML element, which MUST contain one DAV:sync-token element in addition to one DAV:response element for each member URL that was added, has had its mapped resource changed, or was deleted since the last synchronization operation as specified by the DAV:sync-token provided in the request. A given member URL MUST appear only once in the response. In the case where multiple member URLs of the request-URI are mapped to the same resource, if the resource is changed, each member URL MUST be returned in the response.

成功请求的响应体必须是一个DAV:multistatus XML元素,该元素必须包含一个DAV:sync令牌元素,此外,对于已添加的每个成员URL,必须包含一个DAV:response元素,并且其映射的资源已更改,或自请求中提供的DAV:sync令牌指定的上次同步操作后被删除。给定的成员URL在响应中只能出现一次。在请求URI的多个成员URL映射到同一资源的情况下,如果资源发生更改,则必须在响应中返回每个成员URL。

The content of each DAV:response element differs depending on how the member was altered:

每个DAV:response元素的内容因成员的更改方式而异:

For members that have changed (i.e., are new or have had their mapped resource modified), the DAV:response MUST contain at least one DAV:propstat element and MUST NOT contain any DAV:status element.

对于已更改的成员(即新成员或已修改其映射的资源),DAV:response必须至少包含一个DAV:propstat元素,并且不得包含任何DAV:status元素。

For members that have been removed, the DAV:response MUST contain one DAV:status with a value set to '404 Not Found' and MUST NOT contain any DAV:propstat element.

对于已删除的成员,DAV:response必须包含一个DAV:status,其值设置为“404未找到”,并且不得包含任何DAV:propstat元素。

For members that are collections and are unable to support the DAV:sync-collection report, the DAV:response MUST contain one DAV:status with a value set to '403 Forbidden', a DAV:error containing DAV:supported-report or DAV:sync-traversal-supported (see Section 3.3 for which is appropriate) and MUST NOT contain any DAV:propstat element.

对于属于集合且无法支持DAV:sync集合报告的成员,DAV:response必须包含一个值设置为“403 Forbidden”的DAV:status,一个包含DAV:supported报告或支持DAV:sync遍历的DAV:error(请参见第3.3节,该节适用),并且不得包含任何DAV:propstat元素。

The conditions under which each type of change can occur are further described in Section 3.5.

第3.5节进一步描述了每种类型的变化可能发生的条件。

Preconditions:

先决条件:

(DAV:valid-sync-token): The DAV:sync-token element value MUST be a valid token previously returned by the server for the collection targeted by the request-URI. Servers might need to invalidate tokens previously returned to clients. Doing so will cause the clients to fall back to doing full synchronization using the report, though that will not require clients to download resources that are already cached and have not changed. Even so, servers MUST limit themselves to invalidating tokens only when absolutely necessary. Specific reasons include:

(DAV:valid-sync-token):DAV:sync-token元素值必须是服务器先前为请求URI所针对的集合返回的有效令牌。服务器可能需要使以前返回给客户端的令牌无效。这样做会导致客户机退回到使用报表执行完全同步,尽管这不需要客户机下载已缓存且未更改的资源。即便如此,服务器必须仅在绝对必要时使令牌失效。具体原因包括:

* Servers might be unable to maintain all of the change data for a collection due to storage or performance reasons, e.g., servers might only be able to maintain up to 3 weeks worth of changes to a collection, or only up to 10,000 total changes, or not wish to maintain changes for a deleted collection.

* 由于存储或性能原因,服务器可能无法维护集合的所有更改数据,例如,服务器可能最多只能维护集合3周的更改,或者最多只能维护10000个总更改,或者不希望维护已删除集合的更改。

* Change to server implementation: servers might be upgraded to a new implementation that tracks the history in a different manner, and thus previous synchronization history is no longer valid.

* 更改为服务器实现:服务器可能升级为以不同方式跟踪历史的新实现,因此以前的同步历史不再有效。

Postconditions:

后条件:

(DAV:number-of-matches-within-limits): The number of changes reported in the response must fall within the client-specified limit. This condition might be triggered if a client requests a limit on the number of responses (as per Section 3.7), but the server is unable to truncate the result set at or below that limit.

(DAV:限制内的匹配数):响应中报告的更改数必须在客户端指定的限制内。如果客户端请求限制响应数量(根据第3.7节),但服务器无法将结果集截断为该限制或低于该限制,则可能会触发此情况。

3.3. Depth Behavior
3.3. 深度行为

Servers MUST support only Depth:0 behavior with the DAV:sync-collection report, i.e., the report targets only the collection being synchronized in a single request. However, clients do need to "scope" the synchronization to different levels within that collection -- specifically, immediate children (level "1") and all children at any depth (level "infinite"). To specify which level to use, clients MUST include a DAV:sync-level XML element in the request.

服务器必须仅支持DAV:sync集合报告的深度:0行为,即该报告仅针对单个请求中正在同步的集合。但是,客户端确实需要将同步“范围”到该集合中的不同级别——具体地说,是直接子级(级别“1”)和任何深度的所有子级(级别“无限”)。要指定要使用的级别,客户端必须在请求中包含DAV:sync-level XML元素。

o When the client specifies the DAV:sync-level XML element with a value of "1", only appropriate internal member URLs (immediate children) of the collection specified as the request-URI are reported.

o 当客户端指定值为“1”的DAV:sync-level XML元素时,仅报告指定为请求URI的集合的适当内部成员URL(直接子级)。

o When the client specifies the DAV:sync-level XML element with a value of "infinite", all appropriate member URLs of the collection specified as the request-URI are reported, provided child collections themselves also support the DAV:sync-collection report.

o 当客户端指定值为“无限”的DAV:sync级别XML元素时,将报告指定为请求URI的集合的所有适当成员URL,前提是子集合本身也支持DAV:sync集合报告。

o DAV:sync-token values returned by the server are not specific to the value of the DAV:sync-level XML element used in the request. As such, clients MAY use a DAV:sync-token value from a request with one DAV:sync-level XML element value for a similar request with a different DAV:sync-level XML element value; however, the utility of this is limited.

o 服务器返回的DAV:sync令牌值不特定于请求中使用的DAV:sync级别XML元素的值。因此,对于具有不同DAV:sync级别XML元素值的类似请求,客户端可以使用来自具有一个DAV:sync级别XML元素值的请求的DAV:sync令牌值;然而,这种方法的实用性是有限的。

Note that when a server supports a DAV:sync-level XML element with a value of "infinite", it might not be possible to synchronize some child collections within the collection targeted by the report. When this occurs, the server MUST include a DAV:response element for the child collection with status 403 (Forbidden). The 403 response MUST be sent once, when the collection is first reported to the client. In addition, the server MUST include a DAV:error element in the DAV:response element, indicating one of two possible causes for this:

请注意,当服务器支持值为“无限”的DAV:sync级别XML元素时,可能无法同步报表目标集合中的某些子集合。发生这种情况时,服务器必须为状态为403(禁止)的子集合包含DAV:response元素。当收集首次报告给客户端时,403响应必须发送一次。此外,服务器必须在DAV:response元素中包含一个DAV:error元素,指出导致此问题的两个可能原因之一:

The DAV:sync-collection report is not supported at all on the child collection. The DAV:error element MUST contain the DAV:supported-report element.

子集合上根本不支持DAV:sync集合报告。DAV:error元素必须包含DAV:supported报告元素。

The server is unwilling to report results for the child collection when a DAV:sync-collection report with the DAV:sync-level XML element set to "infinite" is executed on a parent resource. This might happen when, for example, the synchronization state of the collection resource is controlled by another subsystem. In such cases clients can perform the DAV:sync-collection report directly on the child collection instead. The DAV:error element MUST contain the DAV:sync-traversal-supported element.

在父资源上执行DAV:sync级别XML元素设置为“无限”的DAV:sync集合报告时,服务器不愿意报告子集合的结果。例如,当收集资源的同步状态由另一个子系统控制时,可能会发生这种情况。在这种情况下,客户端可以直接在子集合上执行DAV:sync集合报告。DAV:error元素必须包含支持的DAV:sync遍历元素。

3.4. Types of Changes Reported on Initial Synchronization
3.4. 初始同步时报告的更改类型

When the DAV:sync-collection request contains an empty DAV:sync-token element, the server MUST return all member URLs of the collection (taking account of the DAV:sync-level XML element value as per Section 3.3, and optional truncation of the result set as per Section 3.6) and it MUST NOT return any removed member URLs. All types of member (collection or non-collection) MUST be reported.

当DAV:sync集合请求包含空的DAV:sync令牌元素时,服务器必须返回集合的所有成员URL(根据第3.3节考虑DAV:sync级别的XML元素值,并根据第3.6节考虑结果集的可选截断),并且不得返回任何删除的成员URL。必须报告所有类型的成员(集合或非集合)。

3.5. Types of Changes Reported on Subsequent Synchronizations
3.5. 在后续同步中报告的更改类型

When the DAV:sync-collection request contains a valid value for the DAV:sync-token element, two types of member URL state changes can be returned (changed or removed). This section defines what triggers each of these to be returned. It also clarifies the case where a member URL might have undergone multiple changes between two synchronization report requests. In all cases, the DAV:sync-level XML element value (as per Section 3.3) and optional truncation of the result set (as per Section 3.6) are taken into account by the server.

当DAV:sync收集请求包含DAV:sync令牌元素的有效值时,可以返回(更改或删除)两种类型的成员URL状态更改。本节定义了触发每个返回的事件。它还澄清了成员URL可能在两个同步报告请求之间发生多次更改的情况。在所有情况下,服务器都会考虑DAV:sync级别的XML元素值(根据第3.3节)和结果集的可选截断(根据第3.6节)。

3.5.1. Changed Member
3.5.1. 更换成员

A member URL MUST be reported as changed if it has been newly mapped as a member of the target collection since the request sync-token was generated (e.g., when a new resource has been created as a child of the collection). For example, this includes member URLs that have been newly mapped as the result of a COPY, MOVE, BIND [RFC5842], or REBIND [RFC5842] request. All types of member URL (collection or non-collection) MUST be reported.

如果自生成请求同步令牌以来(例如,当新资源已创建为集合的子资源时),成员URL已新映射为目标集合的成员,则必须报告为已更改。例如,这包括由于复制、移动、绑定[RFC5842]或重新绑定[RFC5842]请求而新映射的成员URL。必须报告所有类型的成员URL(集合或非集合)。

In the case where a mapping between a member URL and the target collection was removed, then a new mapping with the same URI was created, the member URL MUST be reported as changed and MUST NOT be reported as removed.

如果删除了成员URL和目标集合之间的映射,然后创建了具有相同URI的新映射,则必须将成员URL报告为已更改,而不能将其报告为已删除。

A member URL MUST be reported as changed if its mapped resource's entity tag value (defined in Section 3.11 of [RFC2616]) has changed since the request sync-token was generated.

如果成员URL的映射资源的实体标记值(在[RFC2616]第3.11节中定义)在生成请求同步令牌后发生更改,则必须将其报告为已更改。

A member URL MAY be reported as changed if the user issuing the request was granted access to this member URL, due to access control changes.

如果发出请求的用户由于访问控制更改而被授予对此成员URL的访问权限,则可能会将成员URL报告为已更改。

Collection member URLs MUST be returned as changed if they are mapped to an underlying resource (i.e., entity body) and if the entity tag associated with that resource changes. There is no guarantee that changes to members of a collection will result in a change in any entity tag of that collection, so clients cannot rely on a series of reports using the DAV:sync-level XML element value set to "1" at multiple levels to track all changes within a collection. Instead, a DAV:sync-level XML element with a value of "infinite" has to be used.

如果集合成员URL映射到基础资源(即实体主体),并且与该资源关联的实体标记发生更改,则必须将其作为更改返回。无法保证对集合成员所做的更改会导致该集合的任何实体标记发生更改,因此客户端无法依赖一系列在多个级别使用设置为“1”的DAV:sync-level XML元素值的报告来跟踪集合中的所有更改。相反,必须使用值为“无限”的DAV:sync级别的XML元素。

3.5.2. Removed Member
3.5.2. 删除成员

A member MUST be reported as removed if its mapping under the target collection has been removed since the request sync-token was generated, and it has not been remapped since it was removed. For

如果自生成请求同步令牌后已删除其在目标集合下的映射,并且自删除后未重新映射,则必须将成员报告为已删除。对于

example, this includes members that have been unmapped as the result of a MOVE, UNBIND [RFC5842], or REBIND [RFC5842] operation. This also includes collection members that have been removed, including ones that themselves do not support the DAV:sync-collection report.

例如,这包括由于移动、取消绑定[RFC5842]或重新绑定[RFC5842]操作而取消映射的成员。这还包括已删除的集合成员,包括本身不支持DAV:sync集合报告的集合成员。

If a member was added (and its mapped resource possibly modified), then removed between two synchronization report requests, it MUST be reported as removed. This ensures that a client that adds a member is informed of the removal of the member, if the removal occurs before the client has had a chance to execute a synchronization report.

如果在两个同步报告请求之间添加了一个成员(其映射的资源可能已修改),然后将其删除,则必须将其报告为已删除。这可确保添加成员的客户端在该客户端有机会执行同步报告之前被通知删除该成员。

A member MAY be reported as removed if the user issuing the request no longer has access to this member, due to access control changes.

如果发出请求的用户由于访问控制更改而不再具有对该成员的访问权限,则可能会将该成员报告为已删除。

For a report with the DAV:sync-level XML element value set to "infinite", where a collection is removed, the server MUST NOT report the removal of any members of the removed collection. Clients MUST assume that if a collection is reported as being removed, then all members of that collection have also been removed.

对于DAV:sync-level XML元素值设置为“无限”的报表,如果删除了集合,则服务器不得报告删除的集合的任何成员。客户端必须假定,如果报告某个集合已被删除,则该集合的所有成员也已被删除。

3.6. Truncation of Results
3.6. 结果的截断

A server MAY limit the number of member URLs in a response, for example, to limit the amount of work expended in processing a request, or as the result of an explicit limit set by the client. If the result set is truncated, the response MUST use status code 207 (Multi-Status), return a DAV:multistatus response body, and indicate a status of 507 (Insufficient Storage) for the request-URI. That DAV:response element SHOULD include a DAV:error element with the DAV:number-of-matches-within-limits precondition, as defined in [RFC3744] (Section 9.2). DAV:response elements for all the changes being reported are also included.

服务器可以限制响应中成员URL的数量,例如,限制处理请求所花费的工作量,或者作为客户端设置的显式限制的结果。如果结果集被截断,响应必须使用状态代码207(多状态),返回DAV:multistatus响应正文,并为请求URI指示507(存储不足)状态。根据[RFC3744](第9.2节)中的定义,该DAV:response元素应包括一个DAV:error元素,该元素具有DAV:number of matches in limits前提条件。DAV:还包括报告的所有更改的响应元素。

When truncation occurs, the DAV:sync-token value returned in the response MUST represent the correct state for the partial set of changes returned. That allows the client to use the returned DAV:sync-token to fetch the next set of changes. In this way, the client can effectively "page" through the entire set of changes in a consistent manner.

发生截断时,响应中返回的DAV:sync令牌值必须表示返回的部分更改集的正确状态。这允许客户端使用返回的DAV:sync令牌获取下一组更改。通过这种方式,客户端可以以一致的方式有效地“分页”整个更改集。

Clients MUST handle the 507 status on the request-URI in the response to the report.

客户端必须在对报告的响应中处理请求URI上的507状态。

For example, consider a server that records changes using a strictly increasing integer to represent a "revision number" and uses that quantity as the DAV:sync-token value (appropriately encoded as a URI). Assume the last DAV:sync-token used by the client was

例如,考虑一个服务器,它使用一个严格增加的整数来记录更改,以表示一个“修订号”,并将该数量用作DAV:同步令牌值(适当地编码为URI)。假设客户端使用的最后一个DAV:sync令牌为

"http://example.com/sync/10", and since then 15 additional changes to different resources have occurred. If the client executes a DAV:sync-collection request with a DAV:sync-token of "http://example.com/sync/10", without a limit, the server would return 15 DAV:response elements and a DAV:sync-token with value "http://example.com/sync/25". But if the server chooses to limit responses to at most 10 changes, then it would return only 10 DAV:response elements and a DAV:sync-token with value "http://example.com/sync/20", together with an additional DAV:response element for the request-URI with a status code of 507. Subsequently, the client can reissue the request with the DAV:sync-token value returned from the server and fetch the remaining 5 changes.

"http://example.com/sync/10“,从那时起,对不同资源又进行了15次更改。如果客户端执行DAV:sync收集请求,且DAV:sync令牌为“http://example.com/sync/10,没有限制,服务器将返回15个DAV:response元素和一个具有值的DAV:sync令牌http://example.com/sync/25". 但是,如果服务器选择将响应限制为最多10个更改,那么它将只返回10个DAV:response元素和一个值为“”的DAV:sync令牌http://example.com/sync/20,以及状态代码为507的请求URI的附加DAV:response元素。随后,客户端可以使用从服务器返回的DAV:sync令牌值重新发出请求,并获取其余5项更改。

3.7. Limiting Results
3.7. 极限结果

A client can limit the number of results returned by the server through use of the DAV:limit element ([RFC5323], Section 5.17) in the request body. This is useful when clients have limited space or bandwidth for the results. If a server is unable to truncate the result at or below the requested number, then it MUST fail the request with a DAV:number-of-matches-within-limits postcondition error. When the results can be correctly limited by the server, the server MUST follow the rules above for indicating a result set truncation to the client.

客户端可以通过使用请求正文中的DAV:limit元素([RFC5323],第5.17节)来限制服务器返回的结果数。当客户端用于结果的空间或带宽有限时,这非常有用。如果服务器无法在请求的编号或以下截断结果,则必须使用DAV:限制内的匹配数后置条件错误使请求失败。当服务器可以正确限制结果时,服务器必须遵循上面的规则向客户端指示结果集截断。

3.8. Example: Initial DAV:sync-collection Report
3.8. 示例:初始DAV:同步收集报告

In this example, the client is making its first synchronization request to the server, so the DAV:sync-token element in the request is empty. It also asks for the DAV:getetag property and for a proprietary property. The server responds with the items currently in the targeted collection. The current synchronization token is also returned.

在本例中,客户端向服务器发出第一个同步请求,因此请求中的DAV:sync令牌元素为空。它还要求DAV:getetag属性和专有属性。服务器使用目标集合中当前的项目进行响应。还将返回当前同步令牌。

   >> Request <<
        
   >> Request <<
        
   REPORT /home/cyrusdaboo/ HTTP/1.1
   Host: webdav.example.com
   Depth: 0
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   REPORT /home/cyrusdaboo/ HTTP/1.1
   Host: webdav.example.com
   Depth: 0
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:sync-collection xmlns:D="DAV:">
     <D:sync-token/>
     <D:sync-level>1</D:sync-level>
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:sync-collection xmlns:D="DAV:">
     <D:sync-token/>
     <D:sync-level>1</D:sync-level>
        
     <D:prop xmlns:R="urn:ns.example.com:boxschema">
       <D:getetag/>
       <R:bigbox/>
     </D:prop>
   </D:sync-collection>
        
     <D:prop xmlns:R="urn:ns.example.com:boxschema">
       <D:getetag/>
       <R:bigbox/>
     </D:prop>
   </D:sync-collection>
        
   >> Response <<
        
   >> Response <<
        
   HTTP/1.1 207 Multi-Status
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   HTTP/1.1 207 Multi-Status
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:multistatus xmlns:D="DAV:">
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/test.doc</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00001-abcd1"</D:getetag>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema">
             <R:BoxType>Box type A</R:BoxType>
           </R:bigbox>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/vcard.vcf</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00002-abcd1"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
       <D:propstat>
         <D:prop>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema"/>
         </D:prop>
         <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/calendar.ics</D:href>
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:multistatus xmlns:D="DAV:">
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/test.doc</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00001-abcd1"</D:getetag>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema">
             <R:BoxType>Box type A</R:BoxType>
           </R:bigbox>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/vcard.vcf</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00002-abcd1"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
       <D:propstat>
         <D:prop>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema"/>
         </D:prop>
         <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/calendar.ics</D:href>
        
       <D:propstat>
         <D:prop>
           <D:getetag>"00003-abcd1"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
       <D:propstat>
         <D:prop>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema"/>
         </D:prop>
         <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
     </D:response>
     <D:sync-token>http://example.com/ns/sync/1234</D:sync-token>
   </D:multistatus>
        
       <D:propstat>
         <D:prop>
           <D:getetag>"00003-abcd1"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
       <D:propstat>
         <D:prop>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema"/>
         </D:prop>
         <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
     </D:response>
     <D:sync-token>http://example.com/ns/sync/1234</D:sync-token>
   </D:multistatus>
        
3.9. Example: DAV:sync-collection Report with Token
3.9. 示例:DAV:使用令牌同步收集报告

In this example, the client is making a synchronization request to the server and is using the DAV:sync-token element returned from the last report it ran on this collection. The server responds, listing the items that have been added, changed, or removed. The (new) current synchronization token is also returned.

在本例中,客户端向服务器发出同步请求,并使用从上次在此集合上运行的报告返回的DAV:sync令牌元素。服务器响应,列出已添加、更改或删除的项目。还将返回(新的)当前同步令牌。

   >> Request <<
        
   >> Request <<
        
   REPORT /home/cyrusdaboo/ HTTP/1.1
   Host: webdav.example.com
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   REPORT /home/cyrusdaboo/ HTTP/1.1
   Host: webdav.example.com
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:sync-collection xmlns:D="DAV:">
     <D:sync-token>http://example.com/ns/sync/1234</D:sync-token>
     <D:sync-level>1</D:sync-level>
     <D:prop xmlns:R="urn:ns.example.com:boxschema">
       <D:getetag/>
       <R:bigbox/>
     </D:prop>
   </D:sync-collection>
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:sync-collection xmlns:D="DAV:">
     <D:sync-token>http://example.com/ns/sync/1234</D:sync-token>
     <D:sync-level>1</D:sync-level>
     <D:prop xmlns:R="urn:ns.example.com:boxschema">
       <D:getetag/>
       <R:bigbox/>
     </D:prop>
   </D:sync-collection>
        
   >> Response <<
        
   >> Response <<
        
   HTTP/1.1 207 Multi-Status
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   HTTP/1.1 207 Multi-Status
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:multistatus xmlns:D="DAV:">
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/file.xml</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00004-abcd1"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
       <D:propstat>
         <D:prop>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema"/>
         </D:prop>
         <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/vcard.vcf</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00002-abcd2"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
       <D:propstat>
         <D:prop>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema"/>
         </D:prop>
         <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/test.doc</D:href>
       <D:status>HTTP/1.1 404 Not Found</D:status>
     </D:response>
     <D:sync-token>http://example.com/ns/sync/1238</D:sync-token>
   </D:multistatus>
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:multistatus xmlns:D="DAV:">
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/file.xml</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00004-abcd1"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
       <D:propstat>
         <D:prop>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema"/>
         </D:prop>
         <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/vcard.vcf</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00002-abcd2"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
       <D:propstat>
         <D:prop>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema"/>
         </D:prop>
         <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/test.doc</D:href>
       <D:status>HTTP/1.1 404 Not Found</D:status>
     </D:response>
     <D:sync-token>http://example.com/ns/sync/1238</D:sync-token>
   </D:multistatus>
        
3.10. Example: Initial DAV:sync-collection Report with Truncation
3.10. 示例:初始DAV:带截断的同步收集报告

In this example, the client is making its first synchronization request to the server, so the DAV:sync-token element in the request is empty. It also asks for the DAV:getetag property. The server responds with the items currently in the targeted collection but truncated at two items. The synchronization token for the truncated result set is returned.

在本例中,客户端向服务器发出第一个同步请求,因此请求中的DAV:sync令牌元素为空。它还请求DAV:getetag属性。服务器使用当前在目标集合中但被截断为两个项目的项目进行响应。将返回截断结果集的同步令牌。

   >> Request <<
        
   >> Request <<
        
   REPORT /home/cyrusdaboo/ HTTP/1.1
   Host: webdav.example.com
   Depth: 0
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   REPORT /home/cyrusdaboo/ HTTP/1.1
   Host: webdav.example.com
   Depth: 0
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:sync-collection xmlns:D="DAV:">
     <D:sync-token/>
     <D:sync-level>1</D:sync-level>
     <D:prop>
       <D:getetag/>
     </D:prop>
   </D:sync-collection>
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:sync-collection xmlns:D="DAV:">
     <D:sync-token/>
     <D:sync-level>1</D:sync-level>
     <D:prop>
       <D:getetag/>
     </D:prop>
   </D:sync-collection>
        
   >> Response <<
        
   >> Response <<
        
   HTTP/1.1 207 Multi-Status
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   HTTP/1.1 207 Multi-Status
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:multistatus xmlns:D="DAV:">
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/test.doc</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00001-abcd1"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
     </D:response>
     <D:response>
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:multistatus xmlns:D="DAV:">
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/test.doc</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00001-abcd1"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
     </D:response>
     <D:response>
        
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/vcard.vcf</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00002-abcd1"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/</D:href>
       <D:status>HTTP/1.1 507 Insufficient Storage</D:status>
       <D:error><D:number-of-matches-within-limits/></D:error>
     </D:response>
     <D:sync-token>http://example.com/ns/sync/1233</D:sync-token>
   </D:multistatus>
        
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/vcard.vcf</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00002-abcd1"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/</D:href>
       <D:status>HTTP/1.1 507 Insufficient Storage</D:status>
       <D:error><D:number-of-matches-within-limits/></D:error>
     </D:response>
     <D:sync-token>http://example.com/ns/sync/1233</D:sync-token>
   </D:multistatus>
        
3.11. Example: Initial DAV:sync-collection Report with Limit
3.11. 示例:初始DAV:与限制同步收集报告

In this example, the client is making its first synchronization request to the server, so the DAV:sync-token element in the request is empty. It requests a limit of 1 for the responses returned by the server. It also asks for the DAV:getetag property. The server responds with the items currently in the targeted collection, but truncated at one item. The synchronization token for the truncated result set is returned.

在本例中,客户端向服务器发出第一个同步请求,因此请求中的DAV:sync令牌元素为空。它请求服务器返回的响应限制为1。它还请求DAV:getetag属性。服务器使用目标集合中当前的项进行响应,但在一个项处被截断。将返回截断结果集的同步令牌。

   >> Request <<
        
   >> Request <<
        
   REPORT /home/cyrusdaboo/ HTTP/1.1
   Host: webdav.example.com
   Depth: 0
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   REPORT /home/cyrusdaboo/ HTTP/1.1
   Host: webdav.example.com
   Depth: 0
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:sync-collection xmlns:D="DAV:">
     <D:sync-token/>
     <D:sync-level>1</D:sync-level>
     <D:limit>
       <D:nresults>1</D:nresults>
     </D:limit>
     <D:prop>
       <D:getetag/>
     </D:prop>
   </D:sync-collection>
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:sync-collection xmlns:D="DAV:">
     <D:sync-token/>
     <D:sync-level>1</D:sync-level>
     <D:limit>
       <D:nresults>1</D:nresults>
     </D:limit>
     <D:prop>
       <D:getetag/>
     </D:prop>
   </D:sync-collection>
        
   >> Response <<
        
   >> Response <<
        
   HTTP/1.1 207 Multi-Status
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   HTTP/1.1 207 Multi-Status
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:multistatus xmlns:D="DAV:">
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/test.doc</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00001-abcd1"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/</D:href>
       <D:status>HTTP/1.1 507 Insufficient Storage</D:status>
       <D:error><D:number-of-matches-within-limits/></D:error>
     </D:response>
     <D:sync-token>http://example.com/ns/sync/1232</D:sync-token>
   </D:multistatus>
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:multistatus xmlns:D="DAV:">
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/test.doc</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00001-abcd1"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href
   >http://webdav.example.com/home/cyrusdaboo/</D:href>
       <D:status>HTTP/1.1 507 Insufficient Storage</D:status>
       <D:error><D:number-of-matches-within-limits/></D:error>
     </D:response>
     <D:sync-token>http://example.com/ns/sync/1232</D:sync-token>
   </D:multistatus>
        
3.12. Example: DAV:sync-collection Report with Unsupported Limit
3.12. 示例:DAV:具有不支持的限制的同步收集报告

In this example, the client is making a synchronization request to the server with a valid DAV:sync-token element value. It requests a limit of 100 for the responses returned by the server. It also asks for the DAV:getetag property. The server is unable to limit the results to the maximum specified by the client, so it responds with a 507 status code and appropriate postcondition error code.

在本例中,客户端使用有效的DAV:sync令牌元素值向服务器发出同步请求。它请求服务器返回的响应限制为100。它还请求DAV:getetag属性。服务器无法将结果限制到客户端指定的最大值,因此它会使用507状态代码和相应的后置条件错误代码进行响应。

   >> Request <<
        
   >> Request <<
        
   REPORT /home/cyrusdaboo/ HTTP/1.1
   Host: webdav.example.com
   Depth: 0
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   REPORT /home/cyrusdaboo/ HTTP/1.1
   Host: webdav.example.com
   Depth: 0
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:sync-collection xmlns:D="DAV:">
     <D:sync-token>http://example.com/ns/sync/1232</D:sync-token>
     <D:sync-level>1</D:sync-level>
     <D:limit>
       <D:nresults>100</D:nresults>
     </D:limit>
     <D:prop>
       <D:getetag/>
     </D:prop>
   </D:sync-collection>
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:sync-collection xmlns:D="DAV:">
     <D:sync-token>http://example.com/ns/sync/1232</D:sync-token>
     <D:sync-level>1</D:sync-level>
     <D:limit>
       <D:nresults>100</D:nresults>
     </D:limit>
     <D:prop>
       <D:getetag/>
     </D:prop>
   </D:sync-collection>
        
   >> Response <<
        
   >> Response <<
        
   HTTP/1.1 507 Insufficient Storage
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   HTTP/1.1 507 Insufficient Storage
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:error xmlns:D="DAV:">
     <D:number-of-matches-within-limits/>
   </D:error>
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:error xmlns:D="DAV:">
     <D:number-of-matches-within-limits/>
   </D:error>
        

3.13. Example: DAV:sync-level Set to Infinite, Initial DAV:sync-collection Report

3.13. 示例:DAV:sync级别设置为无限,初始DAV:sync收集报告

In this example, the client is making its first synchronization request to the server, so the DAV:sync-token element in the request is empty, and it is using DAV:sync-level set to "infinite". It also asks for the DAV:getetag property and for a proprietary property. The server responds with the items currently in the targeted collection. The current synchronization token is also returned.

在本例中,客户机向服务器发出第一个同步请求,因此请求中的DAV:sync令牌元素为空,并且它正在使用设置为“无限”的DAV:sync级别。它还要求DAV:getetag属性和专有属性。服务器使用目标集合中当前的项目进行响应。还将返回当前同步令牌。

The collection /home/cyrusdaboo/collection1/ exists and has one child resource that is also reported. The collection /home/cyrusdaboo/ collection2/ exists but has no child resources. The collection /home/cyrusdaboo/shared/ is returned with a 403 status indicating that a collection exists, but it is unable to report on changes within it in the scope of the current DAV:sync-level "infinite" report. Instead, the client can try a DAV:sync-collection report directly on the collection URI.

集合/home/cyrusdaboo/collection1/存在,并且有一个子资源也被报告。集合/home/cyrusdaboo/collection2/存在,但没有子资源。返回的collection/home/cyrusdaboo/shared/状态为403,表示存在集合,但无法报告当前DAV:sync级别“无限”报告范围内的集合内的更改。相反,客户端可以直接在集合URI上尝试DAV:sync集合报告。

   >> Request <<
        
   >> Request <<
        
   REPORT /home/cyrusdaboo/ HTTP/1.1
   Host: webdav.example.com
   Depth: 0
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   REPORT /home/cyrusdaboo/ HTTP/1.1
   Host: webdav.example.com
   Depth: 0
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:sync-collection xmlns:D="DAV:">
     <D:sync-token/>
     <D:sync-level>infinite</D:sync-level>
     <D:prop xmlns:R="urn:ns.example.com:boxschema">
       <D:getetag/>
       <R:bigbox/>
     </D:prop>
   </D:sync-collection>
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:sync-collection xmlns:D="DAV:">
     <D:sync-token/>
     <D:sync-level>infinite</D:sync-level>
     <D:prop xmlns:R="urn:ns.example.com:boxschema">
       <D:getetag/>
       <R:bigbox/>
     </D:prop>
   </D:sync-collection>
        
   >> Response <<
        
   >> Response <<
        
   HTTP/1.1 207 Multi-Status
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   HTTP/1.1 207 Multi-Status
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:multistatus xmlns:D="DAV:">
     <D:response>
       <D:href>/home/cyrusdaboo/collection1/</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00001-abcd1"</D:getetag>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema">
             <R:BoxType>Box type A</R:BoxType>
           </R:bigbox>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href>/home/cyrusdaboo/collection1/test.doc</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00001-abcd1"</D:getetag>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema">
             <R:BoxType>Box type A</R:BoxType>
        
   <?xml version="1.0" encoding="utf-8" ?>
   <D:multistatus xmlns:D="DAV:">
     <D:response>
       <D:href>/home/cyrusdaboo/collection1/</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00001-abcd1"</D:getetag>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema">
             <R:BoxType>Box type A</R:BoxType>
           </R:bigbox>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href>/home/cyrusdaboo/collection1/test.doc</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00001-abcd1"</D:getetag>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema">
             <R:BoxType>Box type A</R:BoxType>
        
           </R:bigbox>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href>/home/cyrusdaboo/collection2/</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag/>
         </D:prop>
         <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
       <D:propstat>
         <D:prop>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema"/>
         </D:prop>
         <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href>/home/cyrusdaboo/calendar.ics</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00003-abcd1"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
       <D:propstat>
         <D:prop>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema"/>
         </D:prop>
         <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href>/home/cyrusdaboo/shared/</D:href>
       <D:status>HTTP/1.1 403 Forbidden</D:status>
       <D:error><D:sync-traversal-supported/></D:error>
     </D:response>
     <D:sync-token>http://example.com/ns/sync/1234</D:sync-token>
   </D:multistatus>
        
           </R:bigbox>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href>/home/cyrusdaboo/collection2/</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag/>
         </D:prop>
         <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
       <D:propstat>
         <D:prop>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema"/>
         </D:prop>
         <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href>/home/cyrusdaboo/calendar.ics</D:href>
       <D:propstat>
         <D:prop>
           <D:getetag>"00003-abcd1"</D:getetag>
         </D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
       <D:propstat>
         <D:prop>
           <R:bigbox xmlns:R="urn:ns.example.com:boxschema"/>
         </D:prop>
         <D:status>HTTP/1.1 404 Not Found</D:status>
       </D:propstat>
     </D:response>
     <D:response>
       <D:href>/home/cyrusdaboo/shared/</D:href>
       <D:status>HTTP/1.1 403 Forbidden</D:status>
       <D:error><D:sync-traversal-supported/></D:error>
     </D:response>
     <D:sync-token>http://example.com/ns/sync/1234</D:sync-token>
   </D:multistatus>
        
4. DAV:sync-token Property
4. DAV:同步令牌属性

Name: sync-token

名称:同步令牌

Namespace: DAV:

名称空间:DAV:

Purpose: Contains the value of the synchronization token as it would be returned by a DAV:sync-collection report.

用途:包含同步令牌的值,该值将由DAV:sync收集报告返回。

Value: Any valid URI.

值:任何有效的URI。

Protected: MUST be protected because this value is created and controlled by the server.

受保护:必须受保护,因为此值由服务器创建和控制。

COPY/MOVE behavior: This property value is dependent on the final state of the destination resource, not the value of the property on the source resource.

复制/移动行为:此属性值取决于目标资源的最终状态,而不是源资源上属性的值。

Description: The DAV:sync-token property MUST be defined on all resources that support the DAV:sync-collection report. It contains the value of the synchronization token as it would be returned by a DAV:sync-collection report on that resource at the same point in time. It SHOULD NOT be returned by a PROPFIND DAV:allprop request (as defined in Section 14.2 of [RFC4918]).

描述:必须在支持DAV:sync收集报告的所有资源上定义DAV:sync令牌属性。它包含同步令牌的值,该值将在同一时间点由该资源上的DAV:sync收集报告返回。它不应通过PROPFIND DAV:allprop请求返回(如[RFC4918]第14.2节所定义)。

Definition:

定义:

   <!ELEMENT sync-token #PCDATA>
        
   <!ELEMENT sync-token #PCDATA>
        
   <!-- Text MUST be a valid URI -->
        
   <!-- Text MUST be a valid URI -->
        
5. DAV:sync-token Use with If Header
5. DAV:与If头同步令牌使用

WebDAV provides an If precondition header that allows for "state tokens" to be used as preconditions on HTTP requests (as defined in Section 10.4 of [RFC4918]). This specification allows the DAV:sync-token value to be used as one such token in an If header. By using this, clients can ensure requests only complete when there have been no changes to the content of a collection, by virtue of an unchanged DAV:sync-token value. Servers MUST support use of DAV:sync-token values in If request headers.

WebDAV提供了一个If前提条件标头,允许将“状态令牌”用作HTTP请求的前提条件(如[RFC4918]第10.4节所定义)。此规范允许在If头中将DAV:sync令牌值用作此类令牌。通过使用此选项,客户端可以确保请求仅在集合的内容没有更改时才能完成,这得益于未更改的DAV:sync令牌值。服务器必须支持在If请求头中使用DAV:sync令牌值。

5.1. Example: If Precondition with PUT
5.1. 示例:如果前提条件为PUT

In this example, the client has already used the DAV:sync-collection report to synchronize the collection /home/cyrusdaboo/collection/. Now it wants to add a new resource to the collection, but only if there have been no other changes since the last synchronization.

在本例中,客户端已经使用DAV:sync collection报告来同步collection/home/cyrusdaboo/collection/。现在,它希望向集合添加一个新资源,但前提是自上次同步以来没有其他更改。

Note that because the DAV:sync-token is defined on the collection and not on the resource targeted by the request, the If header value needs to use the "Resource_Tag" construct for the header syntax to correctly identify that the supplied state token refers to the collection resource.

请注意,由于DAV:sync令牌是在集合上定义的,而不是在请求所针对的资源上定义的,因此If标头值需要使用标头语法的“resource_Tag”构造来正确标识提供的状态令牌是否引用集合资源。

   >> Request <<
        
   >> Request <<
        
   PUT /home/cyrusdaboo/collection/newresource.txt HTTP/1.1
   Host: webdav.example.com
   If: </home/cyrusdaboo/collection/>
     (<http://example.com/ns/sync/12345>)
   Content-Type: text/plain; charset="utf-8"
   Content-Length: xxxx
        
   PUT /home/cyrusdaboo/collection/newresource.txt HTTP/1.1
   Host: webdav.example.com
   If: </home/cyrusdaboo/collection/>
     (<http://example.com/ns/sync/12345>)
   Content-Type: text/plain; charset="utf-8"
   Content-Length: xxxx
        

Some content here...

这里有一些内容。。。

   >> Response <<
        
   >> Response <<
        

HTTP/1.1 201 Created

HTTP/1.1201已创建

5.2. Example: If Precondition with MKCOL
5.2. 示例:使用MKCOL的If前置条件

In this example, the client has already used the DAV:sync-collection report to synchronize the collection /home/cyrusdaboo/collection/. Now, it wants to add a new collection to the collection, but only if there have been no other changes since the last synchronization. Note that because the DAV:sync-token is defined on the collection and not on the resource targeted by the request, the If header value needs to use the "Resource_Tag" construct for the header syntax to correctly identify that the supplied state token refers to the collection resource. In this case, the request fails as another change has occurred to the collection corresponding to the supplied DAV:sync-token.

在本例中,客户端已经使用DAV:sync collection报告来同步collection/home/cyrusdaboo/collection/。现在,它希望向集合中添加一个新集合,但前提是自上次同步以来没有其他更改。请注意,由于DAV:sync令牌是在集合上定义的,而不是在请求所针对的资源上定义的,因此If标头值需要使用标头语法的“resource_Tag”构造来正确标识提供的状态令牌是否引用集合资源。在这种情况下,请求失败,因为与提供的DAV:sync令牌对应的集合发生了另一个更改。

   >> Request <<
        
   >> Request <<
        
   MKCOL /home/cyrusdaboo/collection/child/ HTTP/1.1
   Host: webdav.example.com
   If: </home/cyrusdaboo/collection/>
     (<http://example.com/ns/sync/12346>)
        
   MKCOL /home/cyrusdaboo/collection/child/ HTTP/1.1
   Host: webdav.example.com
   If: </home/cyrusdaboo/collection/>
     (<http://example.com/ns/sync/12346>)
        
   >> Response <<
        
   >> Response <<
        

HTTP/1.1 412 Precondition Failed

HTTP/1.1 412前置条件失败

6. XML Element Definitions
6. XML元素定义
6.1. DAV:sync-collection XML Element
6.1. DAV:同步集合XML元素

Name: sync-collection

名称:同步集合

Namespace: DAV:

名称空间:DAV:

Purpose: WebDAV report used to synchronize data between client and server.

用途:WebDAV报表用于在客户端和服务器之间同步数据。

Description: See Section 3.

说明:见第3节。

   <!ELEMENT sync-collection (sync-token, sync-level, limit?, prop)>
        
   <!ELEMENT sync-collection (sync-token, sync-level, limit?, prop)>
        
   <!-- DAV:limit defined in RFC 5323, Section 5.17 -->
   <!-- DAV:prop defined in RFC 4918, Section 14.18 -->
        
   <!-- DAV:limit defined in RFC 5323, Section 5.17 -->
   <!-- DAV:prop defined in RFC 4918, Section 14.18 -->
        
6.2. DAV:sync-token XML Element
6.2. DAV:同步令牌XML元素

Name: sync-token

名称:同步令牌

Namespace: DAV:

名称空间:DAV:

Purpose: The synchronization token provided by the server and returned by the client.

用途:服务器提供,客户端返回的同步令牌。

Description: See Section 3.

说明:见第3节。

   <!ELEMENT sync-token CDATA>
        
   <!ELEMENT sync-token CDATA>
        
   <!-- Text MUST be a URI -->
        
   <!-- Text MUST be a URI -->
        
6.3. DAV:sync-level XML Element
6.3. DAV:同步级别的XML元素

Name: sync-level

名称:同步级别

Namespace: DAV:

名称空间:DAV:

Purpose: Indicates the "scope" of the synchronization report request.

目的:指示同步报告请求的“范围”。

Description: See Section 3.3.

说明:见第3.3节。

   <!ELEMENT sync-level CDATA>
        
   <!ELEMENT sync-level CDATA>
        
   <!-- Text MUST be either "1" or "infinite" -->
        
   <!-- Text MUST be either "1" or "infinite" -->
        
6.4. DAV:multistatus XML Element
6.4. DAV:multistatusxml元素

Name: multistatus

姓名:multistatus

Namespace: DAV:

名称空间:DAV:

Purpose: Extends the DAV:multistatus element to include synchronization details.

目的:扩展DAV:multistatus元素以包含同步细节。

Description: See Section 3.

说明:见第3节。

   <!ELEMENT multistatus (response*, responsedescription?,
                          sync-token?) >
        
   <!ELEMENT multistatus (response*, responsedescription?,
                          sync-token?) >
        
   <!-- DAV:multistatus originally defined in RFC 4918, Section 14.16
        but overridden here to add the DAV:sync-token element -->
   <!-- DAV:response defined in RFC 4918, Section 14.24 -->
   <!-- DAV:responsedescription defined in RFC 4918, Section 14.25 -->
        
   <!-- DAV:multistatus originally defined in RFC 4918, Section 14.16
        but overridden here to add the DAV:sync-token element -->
   <!-- DAV:response defined in RFC 4918, Section 14.24 -->
   <!-- DAV:responsedescription defined in RFC 4918, Section 14.25 -->
        
7. Security Considerations
7. 安全考虑

This extension does not introduce any new security concerns beyond those already described in HTTP and WebDAV.

除了HTTP和WebDAV中已经描述的安全问题外,此扩展不会引入任何新的安全问题。

8. Acknowledgments
8. 致谢

The following individuals contributed their ideas and support for writing this specification: Bernard Desruisseaux, Werner Donne, Mike Douglass, Ciny Joy, Andrew McMillan, Julian Reschke, and Wilfredo Sanchez. We would like to thank the Calendaring and Scheduling Consortium for facilitating interoperability testing for early implementations of this specification.

以下个人为编写本规范贡献了他们的想法和支持:Bernard Desruisseaux、Werner Donne、Mike Douglass、Ciny Joy、Andrew McMillan、Julian Reschke和Wilfredo Sanchez。我们要感谢日历和日程安排联盟为本规范早期实现的互操作性测试提供了便利。

9. References
9. 工具书类
9.1. Normative References
9.1. 规范性引用文件

[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.

[RFC2119]Bradner,S.,“RFC中用于表示需求水平的关键词”,BCP 14,RFC 2119,1997年3月。

[RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.

[RFC2616]菲尔丁,R.,盖蒂斯,J.,莫卧儿,J.,弗莱斯蒂克,H.,马斯特,L.,利奇,P.,和T.伯纳斯李,“超文本传输协议——HTTP/1.1”,RFC 2616,1999年6月。

[RFC3253] Clemm, G., Amsden, J., Ellison, T., Kaler, C., and J. Whitehead, "Versioning Extensions to WebDAV (Web Distributed Authoring and Versioning)", RFC 3253, March 2002.

[RFC3253]Clemm,G.,Amsden,J.,Ellison,T.,Kaler,C.,和J.Whitehead,“WebDAV的版本控制扩展(Web分布式创作和版本控制)”,RFC 3253,2002年3月。

[RFC3744] Clemm, G., Reschke, J., Sedlar, E., and J. Whitehead, "Web Distributed Authoring and Versioning (WebDAV) Access Control Protocol", RFC 3744, May 2004.

[RFC3744]Clemm,G.,Reschke,J.,Sedlar,E.,和J.Whitehead,“Web分布式创作和版本控制(WebDAV)访问控制协议”,RFC 3744,2004年5月。

[RFC4918] Dusseault, L., "HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)", RFC 4918, June 2007.

[RFC4918]Dusseault,L.,“用于Web分布式创作和版本控制(WebDAV)的HTTP扩展”,RFC4918,2007年6月。

[RFC5323] Reschke, J., Reddy, S., Davis, J., and A. Babich, "Web Distributed Authoring and Versioning (WebDAV) SEARCH", RFC 5323, November 2008.

[RFC5323]Reschke,J.,Reddy,S.,Davis,J.,和A.Babich,“Web分布式创作和版本控制(WebDAV)搜索”,RFC 53232008年11月。

[W3C.REC-xml-20081126] Sperberg-McQueen, C., Yergeau, F., Paoli, J., Maler, E., and T. Bray, "Extensible Markup Language (XML) 1.0 (Fifth Edition)", World Wide Web Consortium Recommendation REC-xml-20081126, November 2008, <http://www.w3.org/TR/2008/REC-xml-20081126>.

[W3C.REC-xml-20081126]Sperberg McQueen,C.,Yergeau,F.,Paoli,J.,Maler,E.,和T.Bray,“可扩展标记语言(xml)1.0(第五版)”,万维网联盟建议REC-xml-20081126,2008年11月<http://www.w3.org/TR/2008/REC-xml-20081126>.

9.2. Informative References
9.2. 资料性引用

[RFC4791] Daboo, C., Desruisseaux, B., and L. Dusseault, "Calendaring Extensions to WebDAV (CalDAV)", RFC 4791, March 2007.

[RFC4791]Daboo,C.,Desruisseaux,B.,和L.Dusseault,“WebDAV(CalDAV)的日历扩展”,RFC 47912007年3月。

[RFC5842] Clemm, G., Crawford, J., Reschke, J., and J. Whitehead, "Binding Extensions to Web Distributed Authoring and Versioning (WebDAV)", RFC 5842, April 2010.

[RFC5842]Clemm,G.,Crawford,J.,Reschke,J.,和J.Whitehead,“将扩展绑定到Web分布式创作和版本控制(WebDAV)”,RFC 5842,2010年4月。

[RFC6352] Daboo, C., "CardDAV: vCard Extensions to Web Distributed Authoring and Versioning (WebDAV)", RFC 6352, August 2011.

[RFC6352]Daboo,C.,“CardDAV:Web分布式创作和版本控制(WebDAV)的vCard扩展”,RFC 63522011年8月。

Appendix A. Backwards-Compatible Handling of Depth
附录A.向后兼容的深度处理

In prior draft versions of this specification, the Depth request header was used instead of the DAV:sync-level element to indicate the "scope" of the synchronization request. Servers that wish to be backwards compatible with clients conforming to the older specification should do the following: if a DAV:sync-level element is not present in the request body, use the Depth header value as the equivalent value for the missing DAV:sync-level element.

在本规范以前的草稿版本中,使用深度请求头而不是DAV:sync-level元素来指示同步请求的“范围”。希望与符合旧规范的客户端向后兼容的服务器应执行以下操作:如果请求正文中不存在DAV:sync级别元素,则使用深度标头值作为缺少的DAV:sync级别元素的等效值。

Appendix B. Example of a Client Synchronization Approach
附录B.客户端同步方法示例

This appendix gives an example of how a client might accomplish collection synchronization using the WebDAV sync report defined in this specification. Note that this is provided purely as an example, and is not meant to be treated as a normative "algorithm" for client synchronization.

本附录给出了一个示例,说明客户端如何使用本规范中定义的WebDAV sync报告完成集合同步。请注意,这纯粹是作为示例提供的,并不意味着被视为客户端同步的标准“算法”。

This example assumes a WebDAV client interacting with a WebDAV server supporting the sync report. The client keeps a local cache of resources in a targeted collection, "/collection/". Local changes are assumed to not occur. The client is only tracking changes to the immediate children of the collection resource.

此示例假定WebDAV客户端与支持同步报告的WebDAV服务器交互。客户端在目标集合“/collection/”中保留资源的本地缓存。假设不会发生局部变化。客户端仅跟踪对集合资源的直接子级所做的更改。

      ** Initial State **
        
      ** Initial State **
        

The client starts out with an empty local cache.

客户端以一个空的本地缓存开始。

The client starts out with no DAV:sync-token stored for "/collection/".

客户端启动时没有为“/collection/”存储DAV:sync令牌。

      ** Initial Synchronization **
        
      ** Initial Synchronization **
        

The client issues a sync report request to the server with an empty DAV:sync-token element, and DAV:sync-level set to "1". The request asks for the server to return the DAV:getetag WebDAV property for each resource it reports.

客户端向服务器发出一个同步报告请求,其中包含一个空的DAV:sync令牌元素,并且DAV:sync级别设置为“1”。该请求要求服务器为其报告的每个资源返回DAV:getetag-WebDAV属性。

The server returns a response containing the list of current resources (with their associated DAV:getetag properties) as well as a new DAV:sync-token value.

服务器返回一个响应,其中包含当前资源的列表(及其关联的DAV:getetag属性)以及一个新的DAV:sync令牌值。

The client associates the new DAV:sync-token value with the collection.

客户端将新的DAV:sync令牌值与集合相关联。

For each reported resource, the client creates a set of (resource path, DAV:getetag) tuples.

对于每个报告的资源,客户端创建一组(资源路径,DAV:getetag)元组。

For each tuple, the client issues an HTTP GET request to the server to retrieve its content, and updates the (resource path, DAV:getetag) entry in its local cache for that resource with the ETag response header value returned in the GET request.

对于每个元组,客户机向服务器发出HTTP GET请求以检索其内容,并使用GET请求中返回的ETag响应头值更新其本地缓存中该资源的(resource path,DAV:getetag)项。

      ** Routine Synchronization **
        
      ** Routine Synchronization **
        

The client issues a sync report request to the server with the DAV:sync-token set to the current cached value from the last sync, and DAV:sync-level set to "1". The request asks for the server to return the DAV:getetag WebDAV property for each resource it reports.

客户端向服务器发出同步报告请求,将DAV:sync令牌设置为上次同步的当前缓存值,并将DAV:sync级别设置为“1”。该请求要求服务器为其报告的每个资源返回DAV:getetag-WebDAV属性。

The server returns a response containing the list of changes as well as a new DAV:sync-token value.

服务器返回一个包含更改列表以及新的DAV:sync令牌值的响应。

The client associates the new DAV:sync-token value with the collection.

客户端将新的DAV:sync令牌值与集合相关联。

* Process Removed Resources *

* 处理删除的资源*

For each resource reported with a 404 response status, the client removes the corresponding resource from its local cache.

对于报告为404响应状态的每个资源,客户端将从其本地缓存中删除相应的资源。

* Process Resources *

* 过程资源*

For each remaining reported resource, the client creates a new set of (resource path, DAV:getetag) tuples.

对于每个剩余的报告资源,客户端创建一组新的(资源路径,DAV:getetag)元组。

The client then determines which resources are in the new set but not in the current cache, and which resources are in the new set and the current cache but have a different DAV:getetag value. For each of those, the client issues an HTTP GET request to the server to retrieve the resource content, and updates the (resource path, DAV:getetag) entry in its local cache for that resource with the ETag response header value returned in the GET request.

然后,客户机确定哪些资源在新集合中但不在当前缓存中,哪些资源在新集合和当前缓存中但具有不同的DAV:getetag值。对于其中的每一个,客户机向服务器发出HTTP GET请求以检索资源内容,并使用GET请求中返回的ETag响应头值更新其本地缓存中该资源的(resource path,DAV:getetag)项。

Authors' Addresses

作者地址

Cyrus Daboo Apple Inc. 1 Infinite Loop Cupertino, CA 95014 USA

Cyrus Daboo苹果公司,美国加利福尼亚州库珀蒂诺市无限环路1号,邮编95014

   EMail: cyrus@daboo.name
   URI:   http://www.apple.com/
        
   EMail: cyrus@daboo.name
   URI:   http://www.apple.com/
        

Arnaud Quillaud Oracle Corporation 180, Avenue de l'Europe Saint Ismier cedex 38334 France

Arnaud Quillaud Oracle Corporation 180,法国圣伊斯梅尔塞德克斯欧洲大道38334号

   EMail: arnaud.quillaud@oracle.com
   URI:   http://www.oracle.com/
        
   EMail: arnaud.quillaud@oracle.com
   URI:   http://www.oracle.com/