RFC 4316

Datatypes for Web Distributed Authoring and Versioning (WebDAV) Properties

πŸ“… published December 2005, from ietf

RFC 4316 πŸŽ€ Datatypes for WebDAV Properties

okay bestie, RFC 4316 is an Experimental doc by Julian Reschke from greenbytes, dated December 2005 πŸ’… It's about giving WebDAV properties datatypes so servers and clients can actually know what a value is. Nothing in the header says it obsoletes or updates another RFC, so there's no drama there 🫢

Status of This Memo πŸ“

this memo defines an Experimental Protocol for the Internet community. it's not an Internet standard of any kind, and they're actively asking for discussion and suggestions for improvement. distribution of the memo is unlimited ✨

Copyright (C) The Internet Society (2005).

Abstract πŸ’–

this spec extends WebDAV so it supports datatyping πŸ¦‹ it adds protocol elements that let clients and servers specify a property's datatype, and it tells the WebDAV PROPFIND method to send back that datatype info 🧚

Table of Contents 🌸

   1. Introduction ....................................................2
   2. Notational Conventions ..........................................2
   3. Overview ........................................................3
   4. Changes for PROPPATCH Method ....................................4
      4.1. Example of Successful PROPPATCH ............................4
      4.2. Example of Failed PROPPATCH ................................5
      4.3. Example of Successful PROPPATCH Where Type
           Information Was Not Preserved ..............................6
   5. Changes for PROPFIND Method .....................................7
      5.1. Example of PROPFIND/prop ...................................7
   6. Changes for Other Methods .......................................8
   7. Compatibility Considerations ....................................8
   8. Internationalization Considerations .............................9
   9. Security Considerations .........................................9
   10. Acknowledgements ...............................................9
   11. References .....................................................9
      11.1. Normative References ......................................9
      11.2. Informative References ....................................9

1. Introduction ✨

okay so this spec is built on top of WebDAV and adds support for data-typed properties πŸ’•

servers have to support XML content in property values, but it can be really useful to store values as plain scalars when possible, and then show the data's type when the value goes back to the client 🌈 the client is free to ignore that info, but it might be able to use it when it changes a property 🫢

when you're setting new properties, it's also helpful to send the datatype along with the value. the server can use that to optimize storage and do extra parsing (dates, for example) πŸ“… servers that do searching can use known datatypes for comparisons and sorting too, which is so smart 🧠

these potential datatyping features were deliberately left out of scope πŸ™…β€β™€οΈ:

  • getting "schema" information for classes of resources (set of "required" properties, their types, display information),
  • definition of a set of mandatory property types,
  • discovery of supported property types,
  • extensions to PROPPATCH that would allow updates to parts of a (structured) property.

2. Notational Conventions πŸ“–

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].

the term "property element" means the XML element that names a specific property, like this πŸŽ€:

     <getcontentlength xmlns="DAV:" />

the term "prop element" is used for the WebDAV "prop" element, which is defined in Section 12.11 of [RFC2518] πŸ’œ

the XML representation of schema components uses a vocabulary identified by the namespace name "http://www.w3.org/2001/XMLSchema".

to keep things short, the text and examples use the prefix "xs:" for that namespace. in practice, any prefix works πŸ’… "XML Schema Part 1: Structures" ([XS1]) also defines several attributes that you can use directly in any XML document. those attributes live in a different namespace, "http://www.w3.org/2001/XMLSchema-instance". again for brevity, the text and examples use the prefix "xsi:" for that one, and any prefix is fine in practice ✨

3. Overview πŸ¦‹

WebDAV property types can be anything that can be marshaled as content of an XML element, but in lots of cases they're actually simple types like integers, booleans, or dates πŸ“ "XML Schema Part 2: Datatypes" [XS2] defines a set of simple types you can use as a base for giving type info to attributes.

datatype info is represented with the attribute "type" from the XML Schema instance namespace, "http://www.w3.org/2001/XMLSchema-instance". in XML Schema, datatypes are qualified names, and the XML Schema recommendation defines a set of built-in datatypes (Section 3 of [XS2]) in the namespace "http://www.w3.org/2001/XMLSchema" πŸ”₯

to avoid unnecessary wordiness, datatype info should only be included if it adds something useful to the protocol πŸ™ˆ specifically, type info isn't required for live properties defined in WebDAV [RFC2518], or for properties of type "xs:string".

a server may implement any combination of datatypes, both from the XML Schema recommendation and possibly from other namespaces 🌸

a particular property can end up typed for a few different reasons:

  • The property is a live property with server-defined semantics and value space.
  • The property may have been set using a non-WebDAV protocol that the server understands in addition to WebDAV.
  • The type may have been specified in an extended PROPPATCH method as defined in Section 4.

4. Changes for PROPPATCH Method πŸ’Œ

if the property element has an XML attribute named xsi:type, the server may use that info to pick an optimized representation for storing the value. for example, by specifying a type of "xs:boolean", the client declares the value to be of type boolean (as defined in [XS2]) ✨ the server may pick any suitable internal format for persisting the property, and it's specifically allowed to fail the request if the format given doesn't fit the format defined for that type πŸ’€

the server should indicate that it successfully detected and parsed the typed value by setting the xsi:type attribute on the property element in the response body. (this implies it should return a MULTISTATUS status code and a <multistatus> response body) 🫢

4.1. Example of Successful PROPPATCH πŸŽ‰

Request
   PROPPATCH /bar.html HTTP/1.1
   Host: example.org
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx

   <?xml version="1.0" encoding="utf-8" ?>
   <D:propertyupdate xmlns:D="DAV:"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:Z="http://ns.example.org/standards/z39.50">
     <D:set>
       <D:prop>
         <Z:released xsi:type="xs:boolean">false</Z:released>
       </D:prop>
     </D:set>
   </D:propertyupdate>
Response
   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:"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:Z="http://ns.example.org/standards/z39.50">

     <D:response>
       <D:href>http://example.org/bar.html</D:href>
       <D:propstat>
         <D:prop><Z:released xsi:type="xs:boolean" /></D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
     </D:response>
   </D:multistatus>

in this case, the xsi:type attribute on the Z:released element shows that the server really did understand the datatype info that was sent πŸ₯°

4.2. Example of Failed PROPPATCH 😭

Request
   PROPPATCH /bar.html HTTP/1.1
   Host: example.org
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx

   <?xml version="1.0" encoding="utf-8" ?>
   <D:propertyupdate xmlns:D="DAV:"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:Z="http://ns.example.org/standards/z39.50">
     <D:set>
       <D:prop>
         <Z:released xsi:type="xs:boolean">t</Z:released>
       </D:prop>
     </D:set>
   </D:propertyupdate>
Response
   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:"
      xmlns:Z="http://ns.example.org/standards/z39.50">
     <D:response>
       <D:href>http://example.org/bar.html</D:href>
       <D:propstat>
         <D:prop><Z:released/></D:prop>
         <D:status>HTTP/1.1 422 Unprocessable Entity</D:status>
         <D:responsedescription>
           Does not parse as xs:boolean
         </D:responsedescription>
       </D:propstat>
     </D:response>
   </D:multistatus>

in this case the request failed, because the value "t" isn't a valid way to write a boolean ❌

heads up: similar errors can happen in standard WebDAV even when no datatype was specified. for example, when a client tries to set a live property that only allows a certain value space.

4.3. Example of Successful PROPPATCH Where Type Information Was Not Preserved 🫠

Request
   PROPPATCH /bar.html HTTP/1.1
   Host: example.org
   Content-Type: text/xml; charset="utf-8"
   Content-Length: xxxx

   <?xml version="1.0" encoding="utf-8" ?>
   <D:propertyupdate xmlns:D="DAV:"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:Z="http://ns.example.org/standards/z39.50">
     <D:set>
       <D:prop>
         <Z:released xsi:type="Z:custom">t</Z:released>
       </D:prop>
     </D:set>
   </D:propertyupdate>
Response
   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:"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:Z="http://ns.example.org/standards/z39.50">
     <D:response>
       <D:href>http://example.org/bar.html</D:href>
       <D:propstat>
         <D:prop><Z:released/></D:prop>
         <D:status>HTTP/1.1 200 OK</D:status>
       </D:propstat>
     </D:response>
   </D:multistatus>

in this one the request succeeded, but the server didn't know how to handle the datatype "Z:custom" πŸ€·β€β™€οΈ so no datatype info came back in the response body.

5. Changes for PROPFIND Method πŸ”

PROPFIND gets extended so it returns datatype info for properties, by adding xsi:type attributes to the property elements πŸ’– the exception is when one of these conditions is true:

  • The datatype MUST be different from "xs:string" (because this can be considered the default datatype).
  • The property's datatype MUST NOT be defined in [RFC2518] (because these types are already well-defined).

5.1. Example of PROPFIND/prop

okay so here's a PROPFIND/prop example bestie, and it's giving exactly what we need πŸ’…βœ¨

>>Request

PROPFIND /bar.html HTTP/1.1
Host: example.org
Content-Type: text/xml; charset="utf-8"
Content-Length: xxxx

<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:"
  xmlns:Z="http://ns.example.org/standards/z39.50">
  <D:prop>
    <D:getcontenttype/>
    <Z:released/>
  </D:prop>
</D:propfind>

>>Response

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:"
   xmlns:Z="http://ns.example.org/standards/z39.50"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <D:response>
    <D:href>http://example.org/bar.html</D:href>
    <D:propstat>
      <D:prop>
        <D:getcontenttype>text/html</D:getcontenttype>
        <Z:released xsi:type="xs:boolean">1</Z:released>
      </D:prop>
      <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
  </D:response>
</D:multistatus>

ngl the vibe here is so iconic πŸ¦‹ The server gives back the property value true with the correct datatype info attached, and it picks one of the two ways XML Schema lets you write a boolean πŸŽ€ Meanwhile D:getcontenttype doesn't get any datatype info back, because its datatype is already defined in [RFC2518] so it's not repeating itself πŸ™ˆ

6. Changes for Other Methods

servers that use the DAV:multistatus response format too (like the REPORT method from [RFC3253], Section 3.6) SHOULD apply the same extensions we just covered in Section 5 🫢 consistency is everything, periodt πŸ’œ

7. Compatibility Considerations

okay this part is lowkey the best bit for keeping things chill 🧚 This specification doesn't add any new protocol elements, and it doesn't change the informal WebDAV DTD either ✨ It just spells out extra server behaviour for when clients send datatype info in an attribute on the property element (which was never defined before), and it adds one more attribute on property elements during PROPFIND πŸ“

clients that don't know about datatype handling should not supply the "xsi: type" attribute on property elements. like, this attribute lives in the XML Schema-Instance namespace, which was literally made for this exact job, see [XS1], Section 2.6.1 πŸ’… old clients should also ignore extra attributes on property elements returned by PROPFIND (and similar methods) πŸ™ˆ the WebDAV spec only says how to handle unknown elements, and it's totally silent on unknown attributes (see [RFC2518], Section 23.3.2.2) so this is a bit of a gray zone bestie 🌈

servers that don't know about datatype handling either drop the "xsi:type" attribute or keep it hanging around along with the property value (see [RFC2518], Section 4.4) πŸ’€ but they'll never say "yep, I parsed that datatype" by sending the type back in the PROPPATCH response. So clients can just send type info without checking in advance whether the server supports it 🫢✨

8. Internationalization Considerations

this proposal is built on [RFC2518] and inherits its internationalizability 🌸 no extra work needed, which is a whole mood πŸ’–

9. Security Considerations

🚨 okay this part is serious, bestie, so listen up πŸ’œ This protocol extension does not introduce any new security implications beyond those already documented for the base protocol (see [RFC2518], Section 17). So the security stuff from the base spec still applies, and nothing new is added on top of it. Don't skip reading [RFC2518], Section 17 πŸ”₯

10. Acknowledgements

big thank you 🫢 this document got really thoughtful discussion from Lisa Dusseault, Stefan Eissing, Eric Sedlar, and Kevin Wiggen. They're the real MVPs πŸ‘‘

11. References

11.1. Normative References

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

[RFC2518]  Goland, Y., Whitehead, E., Faizi, A., Carter, S., and D.
           Jensen, "HTTP Extensions for Distributed Authoring --
           WEBDAV", RFC 2518, February 1999.

[XS1]      Thompson, H., Beech, D., Maloney, M., Mendelsohn, N., and
           World Wide Web Consortium, "XML Schema Part 1: Structures
           Second Edition", W3C REC-xmlschema-1-20041028,
           October 2004,
           <http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/>.

[XS2]      Biron, P., Malhotra, A., and World Wide Web Consortium,
           "XML Schema Part 2: Datatypes Second Edition", W3C REC-
           xmlschema-2-20041028, October 2004,
           <http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/>.

11.2. Informative References

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

Author's Address

Julian F. Reschke
greenbytes GmbH
Hafenweg 16
Muenster, NW  48155
Germany

Phone: +49 251 2807760
Fax:   +49 251 2807761
EMail: julian.reschke@greenbytes.de
URI:   http://greenbytes.de/tech/webdav/

Copyright (C) The Internet Society (2005). πŸŽ€

this document is subject to the rights, licenses and restrictions in BCP 78 and at www.rfc-editor.org/copyright.html, and unless it says otherwise there, the authors keep all their rights πŸ’–

⚠️ this document and the info in it are provided on an "AS IS" basis. THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Intellectual Property

the IETF doesn't take a position on whether any Intellectual Property Rights or other rights that might be claimed about the tech in this document are valid or how far they reach, or whether any license for them is available πŸ¦‹ it also doesn't claim to have done any independent work to find those rights. Info on the procedures for rights in RFC documents is in BCP 78 and BCP 79 πŸ“œ

copies of IPR disclosures made to the IETF Secretariat, and any assurances of licenses that might be made available, or the result of any attempt to get a general license or permission for implementers or users to use those proprietary rights, can be found in the IETF on-line IPR repository at http://www.ietf.org/ipr πŸ’œ

the IETF invites anyone interested to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology needed to implement this standard. Send that info to the IETF at ietf-ipr@ietf.org 🫢

Acknowledgement

funding for the RFC Editor function is currently provided by the Internet Society 🌈 thank you for reading all of this, bestie 🧚✨

πŸ“¦ where this page comes from