idnits 2.17.1 draft-dusseault-http-patch-00.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Looks like you're using RFC 2026 boilerplate. This must be updated to follow RFC 3978/3979, as updated by RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == No 'Intended status' indicated for this document; assuming Proposed Standard Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack a Security Considerations section. ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** The document seems to lack separate sections for Informative/Normative References. All references will be assumed normative when checking for downward references. ** There are 2 instances of too long lines in the document, the longest one being 10 characters in excess of 72. ** There are 4 instances of lines with control characters in the document. ** The document seems to lack a both a reference to RFC 2119 and the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. RFC 2119 keyword, line 78: '...te new body, and MUST NOT be reused to...' RFC 2119 keyword, line 104: '... the Request-URI MUST already exist (t...' RFC 2119 keyword, line 106: '...e's content type MUST be one to which ...' RFC 2119 keyword, line 110: '...chable. A cache MAY mark the resource...' RFC 2119 keyword, line 114: '...he PATCH request MUST have a body. It...' (14 more instances...) Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the RFC 3978 Section 5.4 Copyright Line does not match the current year -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (November 12, 2003) is 7468 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: 'HTTP' on line 75 -- Looks like a reference, but probably isn't: 'RFC3229' on line 246 -- Looks like a reference, but probably isn't: 'WEBDAV' on line 129 -- Looks like a reference, but probably isn't: 'W3C-GDIFF' on line 237 -- Looks like a reference, but probably isn't: 'XCAP' on line 242 == Unused Reference: '1' is defined on line 280, but no explicit reference was found in the text == Unused Reference: '2' is defined on line 283, but no explicit reference was found in the text == Unused Reference: '3' is defined on line 287, but no explicit reference was found in the text == Unused Reference: '4' is defined on line 290, but no explicit reference was found in the text == Unused Reference: '5' is defined on line 294, but no explicit reference was found in the text == Unused Reference: '6' is defined on line 297, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. '1' ** Obsolete normative reference: RFC 2518 (ref. '3') (Obsoleted by RFC 4918) -- Possible downref: Non-RFC (?) normative reference: ref. '4' -- Possible downref: Non-RFC (?) normative reference: ref. '5' Summary: 8 errors (**), 0 flaws (~~), 8 warnings (==), 10 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Network Working Group L. Dusseault 2 Internet-Draft Xythos 3 Expires: May 12, 2004 November 12, 2003 5 Partial Document Changes (PATCH Method) for HTTP 6 draft-dusseault-http-patch-00 8 Status of this Memo 10 This document is an Internet-Draft and is in full conformance with 11 all provisions of Section 10 of RFC2026. 13 Internet-Drafts are working documents of the Internet Engineering 14 Task Force (IETF), its areas, and its working groups. Note that other 15 groups may also distribute working documents as Internet-Drafts. 17 Internet-Drafts are draft documents valid for a maximum of six months 18 and may be updated, replaced, or obsoleted by other documents at any 19 time. It is inappropriate to use Internet-Drafts as reference 20 material or to cite them other than as "work in progress." 22 The list of current Internet-Drafts can be accessed at http:// 23 www.ietf.org/ietf/1id-abstracts.txt. 25 The list of Internet-Draft Shadow Directories can be accessed at 26 http://www.ietf.org/shadow.html. 28 This Internet-Draft will expire on May 12, 2004. 30 Copyright Notice 32 Copyright (C) The Internet Society (2003). All Rights Reserved. 34 Abstract 36 Several applications extending HTTP require a feature to do partial 37 resource modification. Existing HTTP functionality only allows a 38 complete replacement of a document. This proposal adds a new HTTP 39 method, PATCH, to modify an existing HTTP resource. 41 1. Introduction 43 Three use cases initially motivated this proposal 45 1. WebDAV is used by authoring applications to store and share files 46 on the internet. For example, Adobe Photoshop has a Workgroup 47 feature allowing the user to browse a repository and save the 48 file. Currently, Photoshop only publishes the file to the 49 repository rarely, because Photoshop files are typically large 50 and upload is slow. Worse, large uploads are more likely to be 51 interrupted. Although HTTP provides byte range downloads, it 52 cannot provide this simple a mechanism for uploads. 54 2. DeltaV extends WebDAV to do versioning. In versioning 55 environments, a large number of files may be updated with very 56 small changes. For example, a programmer may change the name of 57 a function used in a hundred source files. Versioning 58 applications typically send deltas or 'diffs' to the server to 59 modify these files, however DetaV does not yet have this 60 functionality. 62 3. The SIMPLE WG is devising a way to store and modify configuration 63 information. The biggest feature missing from HTTP is the ability 64 to modify information in a very lightweight manner, so that the 65 client that decides to change its presence state from "free" to 66 "busy" doesn't have to upload a large document. This can be 67 accomplished through changes to a HTTP resource as well. 69 Other working groups (like netconf) are also considering manipulating 70 large files using HTTP GET and PUT. Sometimes the files aren't that 71 large but the device is small or bandwidth is limited, as when phones 72 need to add a new contact to an address book file. This feature would 73 allow much more efficient changes to files. 75 This specification defines a new HTTP 1.1 method for patches [HTTP]. 76 A new method is necessary to improve interoperability and prevent 77 errors. The PUT method is already defined to overwrite a resource 78 with a complete new body, and MUST NOT be reused to do partial 79 changes. Otherwise, proxies and caches and even clients and servers 80 may get confused as to the result of the operation. 82 Note that byte ranges are already used in HTTP to do partial 83 downloads (GET method). However, they are not defined for uploads, 84 and there are some missing pieces for uploads. For example, the HTTP 85 specification has no way for the server to send errors if the byte 86 range in a PUT is invalid. Byte ranges could be made to work in this 87 specification but they're not the only way to do partial 88 modifications. Since reliable and tested patch algorithms already 89 exist, those are preferred. 91 Other delta encodings are defined for HTTP in [RFC3229]. That 92 standard defines delta encodings for cache updates, not for user 93 write operations. It does mean that servers can reuse delta format 94 algorithms to support both that standard and this proposal. That 95 standard does not use MIME types to identify the delta algorithm, but 96 the mapping is trivial. 98 2. Mechanisms 100 2.1 PATCH Method 102 The PATCH method requests that the request body (a patch document) be 103 applied to the resource named in the Request-URI. The resource named 104 in the Request-URI MUST already exist (the server MUST NOT create a 105 new resource with the body of the PATCH method). The target 106 resource's content type MUST be one to which the patch format 107 applies. See error handling section for details on status codes and 108 possible error conditions. 110 PATCH bodies are not cachable. A cache MAY mark the resource 111 identified in the Request-URI as stale if it sees a successful 112 response to the PATCH request. 114 The PATCH request MUST have a body. It MUST include the Content-Type 115 header with a value indicating what the body type is. It MUST be a 116 format that has the semantics of defining a change to an existing 117 document (such as gdiff or vcdiff). The PATCH request MUST also use 118 one of the standard HTTP/1.1 mechanisms that let the server know when 119 the request body is done. The PATCH request body length MUST NOT be 120 indicated only by closing the connection when the body is complete, 121 because an incomplete PATCH body could conceivably corrupt the target 122 resource. 124 The PATCH request MUST only be used in a context which ensures that 125 only one user may apply a patch at a time. There are two reliable 126 ways to do this. The first way is to find out the resource ETag at 127 the time the body is downloaded, and use that Etag in the PATCH 128 request to make sure the resource is still unchanged. The second way 129 to use WebDAV LOCK/UNLOCK [WEBDAV] to reserve the file (first LOCK, 130 then GET, then PATCH, then UNLOCK). PATCH collisions from multiple 131 users are more dangerous than PUT collisions, because a PATCH that is 132 not operating from a known base point may corrupt the resource. 133 Therefore, if neither strong ETags nor LOCKS are available from the 134 server, the client MUST use If-Last-Modified as a less-reliable 135 safeguard. 137 Simple PATCH example 139 PATCH /file.txt HTTP/1.1 140 Host: www.example.com 141 Content-Type: application/gdiff 142 If-Match: "e0023aa4e" 143 Content-Length: 100 145 0xd1, 0xff, 0xd1, 0xff 146 4 147 249,0,0,2 148 2,'X','Y 149 249,0,2,2 150 249,0,1,4 151 0 153 Figure 1 155 This example illustrates use of the platform-portable 'gdiff' 156 algorithm as one possible patch format. In this case the resource is 157 a text file. 159 2.2 PATCH Response 161 2.2.1 Success Response 163 The basic success response code for PATCH is 204 No Content. For this 164 new method, 200 OK is not used because 200 OK implies a body in the 165 response, and 201 Created is not used because the resource must 166 already exist. 168 The server SHOULD provide a MD5 hash of the content after the delta 169 was applied. This allows the client to verify the success of the 170 operation. If the server supports ETags, the server MUST return a 171 strong ETag for use in future client operations. If the server does 172 not support strong ETags, then the server MUST return the 173 Last-Modified header instead. 175 Successful PATCH response 177 HTTP/1.1 204 No Content 178 Content-MD5: Q2hlY2sgSW50ZWdyaXR5IQ== 179 ETag: "e0023aa4e" 181 2.2.2 Error handling 183 This proposal uses the same mechanism as DeltaV to add much-needed 184 info to base HTTP error responses. Existing HTTP status codes are 185 not infinitely extensible but XML elements and namespaces are more 186 so, and it's simple to treat the HTTP error code as a rough category 187 and put detailed error codes in the body. 189 The PATCH method can return the following errors. Please note that 190 the notation "DAV:foobar" is merely short form for expressing "the 191 'foobar' element in the 'DAV:' namespace". It has meaning only in 192 English, not on the wire. Also note that the string error codes are 193 not meant to be displayed but instead as machine parsable known error 194 codes (thus there is no language code). 196 DAV:delta-format-unsupported: Used with 501 Not Supported status 197 code. Returned by the server when it doesn't support the delta 198 format chosen by the client. 200 DAV:delta-format-forbidden-on-resource: Used with 403 Forbidden when 201 the delta format chosen by the client is supported by the server 202 but not allowed on this kind of resource. 204 DAV:delta-format-badly-formatted: Used with 400 Bad Request when the 205 server finds that the delta document provided by the client was 206 badly formatted and non-compliant. 208 DAV:delta-empty-resource: Used with 409 Conflict when the resource 209 addressed in the Request-URI exists but is empty, and the delta 210 format cannot be applied to an empty document. Note that some 211 delta formats may be applied to an empty document, in which case 212 this error wouldn't be used. 214 DAV:patch-result-invalid: Used with 409 Conflict when the resource 215 could be patched but the result of the patch would be a resource 216 which is invalid. This could mean, for example, that a XML 217 resource would become an invalid XML file if the patch specified 218 that a close element text line should be deleted. 220 "404 Not Found" is used with no body/error element when the URL in by 221 the Request-URI does not map to a resource. 223 2.3 Delta Formats 225 A set of changes for a resource is itself a document, called a change 226 document or delta. Every change document format must be a registered 227 MIME type. Servers advertise supported delta mechanisms by 228 advertising these MIME types, and clients specify which one they're 229 using by including the MIME type in the Content-Type header. 231 This table outlines the delta format support requirements for a 232 server supporting this proposal. 234 Set of defined delta formats 236 Format Specification MIME type/ Requirements 237 GDIFF [W3C-GDIFF] application/gdiff 238 MUST support for all document types except XML. 239 MAY support for XML documents. 240 Servers supporting DeltaV MUST support for ALL 241 document types. 242 XCAP [XCAP] text/xcap+xml 243 MUST support for XML documents. 244 VCDIFF [] application/vcdiff??? 245 MAY support for all document types. 246 DIFFE [RFC3229] ??? 247 MAY support for all document types. 249 ISSUES: We only have a real mime type for GDIFF so far. It would be 250 a public service to register vcdiff and diffe as well if those are 251 used at all. 253 2.4 Advertising Support in OPTIONS: Patch header 255 The server advertises its support for the features described here 256 with an OPTIONS response header, sent on OPTIONS requests for any 257 resource. The Patch header on any OPTIONS response indicates that 258 the server supports the PATCH method and at least one delta format. 259 When the OPTIONS request addresses a specific modifiable resource, 260 the Patch header in the response indicates which delta formats may be 261 used for this specific resource. When an OPTIONS request addresses 262 the server as a whole (Request-URI = "*") the Delta header in the 263 response indicates the union of all delta formats supported by the 264 server. 266 OPTIONS request and response indicating Patch support 268 [request] 270 OPTIONS * HTTP/1.1 271 Host: www.example.com 273 [response] 275 HTTP/1.1 200 OK 276 Patch: application/gdiff, text/xcap+xml 278 References 280 [1] van Hoff, A. and J. Payne, "Generic Diff Format Specification", 281 August 1997. 283 [2] Mogul, J., Krishnamurthy, B., Douglis, F., Feldmann, A., Goland, 284 Y., van Hoff, A. and D. Hellerstein, "Delta encoding in HTTP", 285 RFC 3229, January 2002. 287 [3] Goland, Y., Whitehead, E., Faizi, A., Carter, S. and D. Jensen, 288 "HTTP Extensions for Distributed Authoring - WebDAV", RFC 2518. 290 [4] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., 291 Leach, P. and T. Berners-Lee, "Hypertext Transfer Protocol -- 292 HTTP/1.1", June 1999. 294 [5] Rosenberg, J., "The Extensible Markup Language (XML) 295 Configuration Access Protocol (XCAP)", October 2003. 297 [6] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 298 Extensions (MIME) Part Two: Media Types", RFC 2046, November 299 1996. 301 Author's Address 303 Lisa Dusseault 304 Xythos Software, Inc. 305 2064 Edgewood Dr. 306 Palo Alto, CA 94303 307 US 309 EMail: lisa@xythos.com 311 Appendix A. Changes 312 Intellectual Property Statement 314 The IETF takes no position regarding the validity or scope of any 315 intellectual property or other rights that might be claimed to 316 pertain to the implementation or use of the technology described in 317 this document or the extent to which any license under such rights 318 might or might not be available; neither does it represent that it 319 has made any effort to identify any such rights. Information on the 320 IETF's procedures with respect to rights in standards-track and 321 standards-related documentation can be found in BCP-11. Copies of 322 claims of rights made available for publication and any assurances of 323 licenses to be made available, or the result of an attempt made to 324 obtain a general license or permission for the use of such 325 proprietary rights by implementors or users of this specification can 326 be obtained from the IETF Secretariat. 328 The IETF invites any interested party to bring to its attention any 329 copyrights, patents or patent applications, or other proprietary 330 rights which may cover technology that may be required to practice 331 this standard. Please address the information to the IETF Executive 332 Director. 334 Full Copyright Statement 336 Copyright (C) The Internet Society (2003). All Rights Reserved. 338 This document and translations of it may be copied and furnished to 339 others, and derivative works that comment on or otherwise explain it 340 or assist in its implementation may be prepared, copied, published 341 and distributed, in whole or in part, without restriction of any 342 kind, provided that the above copyright notice and this paragraph are 343 included on all such copies and derivative works. However, this 344 document itself may not be modified in any way, such as by removing 345 the copyright notice or references to the Internet Society or other 346 Internet organizations, except as needed for the purpose of 347 developing Internet standards in which case the procedures for 348 copyrights defined in the Internet Standards process must be 349 followed, or as required to translate it into languages other than 350 English. 352 The limited permissions granted above are perpetual and will not be 353 revoked by the Internet Society or its successors or assignees. 355 This document and the information contained herein is provided on an 356 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING 357 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING 358 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION 359 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF 360 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 362 Acknowledgment 364 Funding for the RFC Editor function is currently provided by the 365 Internet Society.