<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc-ext parse-xml-in-artwork="yes" ?>
<?rfc-ext allow-markup-in-artwork="yes" ?>
<?rfc-ext html-pretty-print="prettyprint https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"?>

<rfc xmlns:x="http://purl.org/net/xml2rfc/ext" xmlns:ed="http://greenbytes.de/2002/rfcedit" ipr="full3978" number="4709" category="info" xmlns:grddl='http://www.w3.org/2003/g/data-view#' grddl:transformation='rfc2629grddl.xslt'>
	<front>
  <title abbrev="Mounting WebDAV servers">Mounting Web Distributed Authoring and Versioning (WebDAV) Servers</title>

  <author initials="J. F." surname="Reschke" fullname="Julian F. Reschke">
    <organization abbrev="greenbytes">greenbytes GmbH</organization>
    <address>
      <postal>
        <street>Hafenweg 16</street>
        <city>Muenster</city><region>NW</region><code>48155</code>
        <country>Germany</country>
      </postal>
      <phone>+49 251 2807760</phone>	
      <facsimile>+49 251 2807761</facsimile>	
      <email>julian.reschke@greenbytes.de</email>	
      <uri>http://greenbytes.de/tech/webdav/</uri>	
    </address>
  </author>

  <date month="October" year="2006"/>
  
  <abstract>
    <t>
      In current Web browsers, there is no uniform way to specify that a user
      clicking on a link will be presented with an editable view of a 
      Web Distinguished Authoring and Versioning (WebDAV)
      server.  For example, it is frequently desirable to be able to click
      on a link and have this link open a window that can handle drag-and-drop interaction with the resources of a WebDAV server.
    </t>
    <t>
      This document specifies a mechanism and a document format that enables
      WebDAV servers to send
      "mounting" information to a WebDAV client.  The 
      mechanism is designed to work on any platform and with any combination
      of browser and WebDAV client, relying solely on the well-understood
      dispatch of documents through their MIME type. 
    </t>
  </abstract>
  
  </front>

	<middle>

<section title="Introduction">
<t>
  By definition, a Web Distributed Authoring and Versioning (WebDAV) server (<xref target="RFC2518"/>) is an HTTP
  server as well (<xref target="RFC2616"/>).  Most WebDAV servers can be
  (at least partly) operated from an HTML-based user interface in a web browser.  However,
  it is frequently desirable to be able to switch from an HTML-based view to
  a presentation provided by a native WebDAV client, directly supporting 
  the authoring features defined in WebDAV and related specifications.
</t>
<t>
  This document specifies a platform-neutral mechanism based on the dispatch
  of documents through their MIME type.  For completeness, <xref target="alternative.approaches"/> lists other
  approaches that have been implemented in existing clients.
</t>
<t>
  For example, many educational institutions use WebDAV servers as a mechanism
  for sharing documents among students. Each student owns a separate collection
  structure on a WebDAV server, often called his/her "locker".  Ideally, when
  users click on a link in an HTML page provided by the university (perhaps
  by their university Web portal), an editable view of their locker will appear.
</t>

</section>
  
<section title="Terminology" anchor="terminology">
<t>
  The terminology used here follows that in the WebDAV Distributed
  Authoring Protocol specification <xref target="RFC2518"/>.
</t>
<t>
  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 <xref target="RFC2119"/>. 
</t>
<t>
  This document uses XML DTD fragments 
  (<xref target="XML"/>) as a purely notational convention.  In particular:
  <list style="symbols">
    <t>Element names use the namespace "http://purl.org/NET/webdav/mount".  When
    an XML element type in this namespace is referenced in this document outside
    of the context of an XML fragment, the string "dm:" will be prefixed to the element name.
    </t>
    <t>Element ordering is irrelevant.</t>
    <t>Extension elements/attributes (elements/attributes not already defined
    as valid child elements) may be added anywhere, except when explicitly
    stated otherwise.</t> 
  </list>
</t>
</section>

<section title="Format" anchor="format">
<t>
  A WebDAV mount request is encoded in a specific XML format (<xref target="XML"/>)
  with a well-defined MIME type (see <xref target="mime.type.registration"/>).
  The MIME type allows user agents to dispatch the content to a handler
  specific to the system's WebDAV client. 
</t>
<t>
  The elements defined below use the namespace "http://purl.org/NET/webdav/mount".
</t>
<figure><artwork type="application/xml-dtd" x:lang="">
&lt;!ELEMENT mount (url, open?, username?) &gt;

&lt;!ELEMENT url (#PCDATA) &gt;
&lt;!-- PCDATA value: scheme ":" hier-part, as defined in <xref target="RFC3986" x:fmt="sec" x:sec="3"/> of
     <xref target="RFC3986"/> --&gt;

&lt;!ELEMENT open (#PCDATA) &gt;
&lt;!-- PCDATA value: path, as defined in <xref target="RFC3986" x:fmt="sec" x:sec="3"/> of
     <xref target="RFC3986"/> --&gt;

&lt;!ELEMENT username (#PCDATA) &gt;
</artwork></figure>

<section title="dm:mount" anchor="ELEMENT_mount">
<iref item="dm:mount" primary="true"/>
<t>
  The &lt;dm:mount&gt; element acts as a container for all the remaining elements
  defined by this protocol. 
</t>
</section>

<section title="dm:url" anchor="ELEMENT_url">
<iref item="dm:url" primary="true"/>
<t>
  The mandatory &lt;dm:url&gt; element provides the HTTP URL of the WebDAV collection
  that should be mounted by the client. 
</t>
</section>

<section title="dm:open" anchor="ELEMENT_open">
<iref item="dm:opent" primary="true"/>
<t>
  The optional &lt;dm:open&gt; element instructs the client to display the specified
  child collection; its URL is computed by concatenating this element's
  value with the URL obtained from the <xref target="ELEMENT_url">&lt;dm:url&gt;</xref> element 
  (see <xref target="security.considerations"/> for a discussion about
  why this element only supports displaying collections rather than opening
  arbitrary documents).
</t>
</section>

<section title="dm:username" anchor="ELEMENT_username">
<iref item="dm:username" primary="true"/>
<t>
  The server can use the optional &lt;dm:username&gt; element to specify the name
  of the currently authenticated principal.  A client can use this value to select
  a matching mount point (different users may have mounted the URL with
  different credentials under different local mount points) or to provide
  a meaningful default for 
  authentication against the server. It is common that a browser and
  WebDAV client do not share HTTP connections, so including this information
  in the mount document increases usability.
</t>

<t>
  Implementation Note: If a &lt;dm:username&gt; element is present, public
  caching of the document should be disallowed.  Thus, appropriate 'Vary' or
  'Cache-Control' headers are needed in the server response.
</t>

</section>

</section>

<section title="Example">

<t>
  In the example below, the client first retrieves a representation of a 
  WebDAV collection using a generic Web browser (1).  The returned HTML content
  contains a hyperlink that identifies the "davmount" document
  in the format defined in <xref target="format"/> (2).  The user follows this
  link (3), which causes the server to return the "davmount" document to the user's
  browser (4).  The browser in turn passes the content to the application that
  was registered to handle the "application/davmount+xml" MIME type, usually
  the default WebDAV client on the client's system.
</t>
<figure>
  <preamble>
    (1) Client retrieves representation of WebDAV collection "/user42/inbox/".
  </preamble>
  <artwork type='message/http; msgtype="request"'>
GET /user42/inbox/ HTTP/1.1
Host: www.example.com</artwork>
</figure>
<figure>
  <preamble>
    (2) Server returns representation.
  </preamble>
  <artwork type='message/http; msgtype="response"'>
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: xxx

..
&lt;a href="?action=davmount"&gt;View this collection in your
WebDAV client&lt;/a&gt;
..
</artwork>
  <postamble>(note that the example shows only that part of the HTML page
  that contains the relevant link)</postamble>
</figure>
<figure>
  <preamble>
    (3) Client follows link to "davmount" document
  </preamble>
  <artwork type='message/http; msgtype="request"'>
GET /user42/inbox/?action=davmount HTTP/1.1
Host: www.example.com</artwork>
</figure>
<figure>
  <preamble>
    (4) Server returns "davmount" document
  </preamble>
  <artwork type='message/http; msgtype="response"'>
HTTP/1.1 200 OK
Content-Type: application/davmount+xml
Content-Length: xxx
Cache-Control: private

<x:span x:lang="">&lt;dm:mount xmlns:dm="http://purl.org/NET/webdav/mount"&gt;
  &lt;dm:url&gt;http://www.example.com/user42/&lt;/dm:url&gt;
  &lt;dm:open&gt;inbox/&lt;/dm:open&gt;
&lt;/dm:mount&gt;</x:span></artwork>
</figure>

</section>

  
<section title="Internationalization Considerations" anchor="internationalization.considerations">
<t>
  This document does not introduce any new internationalization considerations
  beyond those discussed in <xref target="RFC2518" x:fmt="," x:sec="16"/>.
</t>
</section>

<section title="IANA Considerations">
  
  <section title="MIME Type Registration" anchor="mime.type.registration">
  <iref item="Media Type" subitem="application/mount+xml" primary="true"/>
  <iref item="application/mount+xml Media Type" primary="true"/>
  
    <t>
      Type name:
      <list>
        <t>application</t>
      </list>
    </t>
    <t>
      Subtype name:
      <list>
        <t>davmount+xml</t>
      </list>
    </t>
    <t>
      Required parameters:
      <list>
        <t>none</t>
      </list>
    </t>
    <t>
      Optional parameters:
      <list>
        <t>"charset":
          This parameter has identical semantics to the charset parameter of
          the "application/xml" media type as specified in <xref target="RFC3023"/>.</t>
      </list>
    </t>
    <t>
      Encoding considerations:
      <list>
        <t>Identical to those of "application/xml" as described in <xref target="RFC3023" x:sec="3.2" x:fmt=","/>.</t>
      </list>
    </t>
    <t>
      Security considerations:
      <list>
        <t>As defined in this specification.  
            In addition, as this media type uses the "+xml" convention, it shares the same security considerations as described in <xref target="RFC3023" x:sec="10" x:fmt=","/>.</t>
      </list>
    </t>
    <t>
      Interoperability considerations:
      <list>
        <t>There are no known interoperability issues.</t>
      </list>
    </t>
    <t>
      Published specification:
      <list>
        <t>This specification.</t>
      </list>
    </t>

  <t>
    Applications that use this media type:
    <list>
      <t>SAP Netweaver Knowledge Management, Xythos Drive.</t>
    </list>
  </t>

    <t>
      Additional information:
    <list>
      <t>
        Magic number(s):
        <list>
          <t>As specified for "application/xml" in <xref target="RFC3023" x:fmt="," x:sec="3.2"/>.</t>
        </list>
      </t>
      <t>
        File extension(s):
        <list>
          <t>.davmount</t>
        </list>
      </t>
      <t>
        Fragment identifiers:
        <list>
          <t>As specified for "application/xml" in <xref target="RFC3023" x:fmt="," x:sec="5"/>.</t>
        </list>
      </t>
      <t>
        Base URI:
        <list>
          <t>As specified in <xref target="RFC3023" x:fmt="," x:sec="6"/>.</t>
        </list>
      </t>
      <t>
        Macintosh file type code(s):
        <list>
          <t>TEXT</t>
        </list>
      </t>
    </list>
  </t>
  <t>
    Person &amp; email address to contact for further information:
    <list>
      <t>Julian Reschke &lt;julian.reschke@greenbytes.de&gt;</t>
    </list>
  </t>
  <t>
    Intended usage:
    <list>
      <t>COMMON</t>
    </list>
  </t>

  <t>
    Restrictions on usage:
    <list>
      <t>None.</t>
    </list>
  </t>
  <t>
    Author:
    <list>
      <t>Julian Reschke</t>
    </list>
  </t>

  <t>
    Change controller:
    <list>
      <t>IESG</t>
    </list>
  </t>

  </section>
  
</section>
  
  

<section title="Security Considerations" anchor="security.considerations">
<t>
  All security considerations connected to HTTP/WebDAV and XML apply for
  this specification as well, namely, <xref target="RFC2518" x:fmt="()" x:sec="17"/>
  and <xref target="RFC3470" x:fmt="()" x:sec="7"/>.
</t>
<t>
  In addition, client implementers must be careful when implementing the
  &lt;dm:open&gt; element (see <xref target="ELEMENT_open"/>).  It <x:bcp14>MUST NOT</x:bcp14>
  be used to initiate any action beyond displaying the contents of a 
  WebDAV collection (supporting
  "opening" documents could be abused to trick a user into letting the operating
  system's shell execute arbitrary content, possibly running it as an
  executable program).
</t>

<t>


  The <x:bcp14>OPTIONAL</x:bcp14> &lt;dm:username&gt; element defined in <xref target="ELEMENT_username"/>
  allows the inclusion of user names into mount documents.  However in some cases, user
  name information is considered to be security sensitive.  Should this
  be the case, parties generating mount documents are advised to either not to
  include user names, or to use access control to restrict access to the
  information as desired. 

</t>

</section>


<section title="Acknowledgements">
<t>
  This document has benefited from thoughtful discussion by Emile Baizel,
  Spencer Dawkins, Lisa Dusseault, Stefan Eissing,
  Joe Gregorio, Michal Gregr, Russ Housley, Jim Luther, Jaroslav Mazanec, and Jim Whitehead.
</t>
</section>


</middle>
  
  <back>
    <references title="Normative References">

<reference anchor="RFC2119">
  <front>
    <title abbrev="RFC Key Words">Key words for use in RFCs to Indicate Requirement Levels</title>
    <author initials="S." surname="Bradner" fullname="Scott Bradner">
    <organization>Harvard University</organization>
    <address>
      <email>sob@harvard.edu</email>
    </address></author>
    <date month="March" year="1997"/>
  </front>
  <seriesInfo name="BCP" value="14"/>
  <seriesInfo name="RFC" value="2119"/>
</reference>

<reference anchor="RFC2518">
  <front>
    <title>HTTP Extensions for Distributed Authoring -- WEBDAV</title>
    <author initials="Y." surname="Goland" fullname="Y. Goland">
      <organization>Microsoft Corporation</organization>
      <address><email>yarong@microsoft.com</email></address>
    </author>
    <author initials="E." surname="Whitehead" fullname="E. J. Whitehead, Jr.">
      <organization abbrev="UC Irvine">Dept. Of Information and Computer Science, University of California, Irvine</organization>
    	<address><email>ejw@ics.uci.edu</email></address>
    </author>
    <author initials="A." surname="Faizi" fullname="A. Faizi">
      <organization abbrev="Netscape">Netscape</organization>
      <address><email>asad@netscape.com</email></address>
    </author>
    <author initials="S.R." surname="Carter" fullname="S. R. Carter">
      <organization abbrev="Novell">Novell</organization>
      <address><email>srcarter@novell.com</email></address>
    </author>
    <author initials="D." surname="Jensen" fullname="D. Jensen">
      <organization abbrev="Novell">Novell</organization>
      <address><email>dcjensen@novell.com</email></address>
    </author>
    <date month="February" year="1999"/>
  </front>
  <seriesInfo name="RFC" value="2518"/>
</reference>

<reference anchor="RFC2616">
  <front>
    <title>Hypertext Transfer Protocol -- HTTP/1.1</title>
    <author initials="R." surname="Fielding" fullname="R. Fielding">
      <organization>University of California, Irvine</organization>
      <address><email>fielding@ics.uci.edu</email></address>
    </author>
    <author initials="J." surname="Gettys" fullname="J. Gettys">
      <organization>W3C</organization>
      <address><email>jg@w3.org</email></address>
    </author>
    <author initials="J." surname="Mogul" fullname="J. Mogul">
      <organization>Compaq Computer Corporation</organization>
      <address><email>mogul@wrl.dec.com</email></address>
    </author>
    <author initials="H." surname="Frystyk" fullname="H. Frystyk">
      <organization>MIT Laboratory for Computer Science</organization>
      <address><email>frystyk@w3.org</email></address>
    </author>
    <author initials="L." surname="Masinter" fullname="L. Masinter">
      <organization>Xerox Corporation</organization>
      <address><email>masinter@parc.xerox.com</email></address>
    </author>
    <author initials="P." surname="Leach" fullname="P. Leach">
      <organization>Microsoft Corporation</organization>
      <address><email>paulle@microsoft.com</email></address>
    </author>
    <author initials="T." surname="Berners-Lee" fullname="T. Berners-Lee">
      <organization>W3C</organization>
      <address><email>timbl@w3.org</email></address>
    </author>
    <date month="June" year="1999"/>
  </front>
  <seriesInfo name="RFC" value="2616"/>
</reference>

<reference anchor="RFC3023">
  <front>
    <title>XML Media Types</title>
    <author initials="M." surname="Murata" fullname="M. Murata">
      <organization>IBM Tokyo Research Laboratory</organization> 
      <address><email>mmurata@trl.ibm.co.jp</email></address>
    </author>
    <author initials="S." surname="St.Laurent" fullname="Simon  St.Laurent">
      <organization>simonstl.com</organization>
      <address><email>simonstl@simonstl.com</email></address>
    </author>
    <author initials="D." surname="Kohn" fullname="D. Kohn">
      <organization>Skymoon Ventures</organization>
      <address><email>dan@dankohn.com</email></address>
    </author>
    <date year="2001" month="January"/>
  </front>
  <seriesInfo name="RFC" value="3023"/>
</reference>


<reference anchor="XML" target="http://www.w3.org/TR/2006/REC-xml-20060816">
  <front>
    <title>Extensible Markup Language (XML) 1.0 (Fourth Edition)</title>
    <author initials="T." surname="Bray" fullname="Tim Bray">
      <organization>Textuality and Netscape</organization>
      <address>
        <email>tbray@textuality.com</email>
      </address>
    </author>
    <author initials="J." surname="Paoli" fullname="Jean Paoli">
      <organization>Microsoft</organization>
      <address>
        <email>jeanpa@microsoft.com</email>
      </address>
    </author>
    <author initials="C.M." surname="Sperberg-McQueen" fullname="C. M. Sperberg-McQueen">
      <organization>University of Illinois at Chicago and Text Encoding Initiative</organization>
      <address>
        <email>cmsmcq@uic.edu</email>
      </address>
    </author>
    <author initials="E." surname="Maler" fullname="Eve Maler">
      <organization>Sun Microsystems</organization>
      <address>
        <email>eve.maler@east.sun.com</email>
      </address>
    </author>
    <author initials="F." surname="Yergeau" fullname="Francois Yergeau">
      <organization/>
      <address>
        <email>francois@yergeau.com</email>
      </address>
    </author>
    <date day="16" month="August" year="2006"/>
  </front>
  <seriesInfo name="W3C" value="REC-xml-20060816"/>
</reference>


<reference anchor="RFC3986">
  <front>
    <title abbrev="URI Generic Syntax">Uniform Resource Identifier (URI): Generic Syntax</title>
    <author initials="T." surname="Berners-Lee" fullname="Tim Berners-Lee">
      <organization abbrev="W3C/MIT">World Wide Web Consortium</organization>
      <address>
        <email>timbl@w3.org</email>
      </address>
    </author>
    <author initials="R." surname="Fielding" fullname="Roy T. Fielding">
      <organization abbrev="Day Software">Day Software</organization>
      <address>
        <email>fielding@gbiv.com</email>
      </address>
    </author>
    <author initials="L." surname="Masinter" fullname="Larry Masinter">
      <organization abbrev="Adobe">Adobe Systems Incorporated</organization>
      <address>
        <email>LMM@acm.org</email>
      </address>
    </author>
    <date month="January" year="2005"/>
  </front>
  <seriesInfo name="STD" value="66"/>
  <seriesInfo name="RFC" value="3986"/>
</reference>

</references>
<references title="Informative References">

<reference anchor="RFC3470">
<front>
  <title abbrev="XML Within IETF Protocols">
   Guidelines for the Use of Extensible Markup Language (XML) within IETF Protocols</title>
  
  <author initials="S." surname="Hollenbeck" fullname="Scott Hollenbeck">
    <organization>VeriSign, Inc.</organization>
    <address>
      <postal>
        <street>21345 Ridgetop Circle</street>
        <city>Dulles</city>
        <region>VA</region>
        <code>20166-6503</code>
        <country>US</country>
      </postal>
      <phone>+1 703 948 3257</phone>
      <email>shollenbeck@verisign.com</email>
    </address>
  </author>
  
  <author initials="M." surname="Rose" fullname="Marshall T. Rose">
    <organization>Dover Beach Consulting, Inc.</organization>
    <address>
      <postal>
        <street>POB 255268</street>
        <city>Sacramento</city>
        <region>CA</region>
        <code>95865-5268</code>
        <country>US</country>
      </postal>
      <phone>+1 916 483 8878</phone>
      <email>mrose@dbc.mtview.ca.us</email>
    </address>
  </author>
  
  <author initials="L." surname="Masinter" fullname="Larry Masinter">
    <organization>Adobe Systems Incorporated</organization>
    <address>
      <postal>
        <street>Mail Stop W14</street>
        <street>345 Park Ave.</street>
        <city>San Jose</city>
        <region>CA</region>
        <code>95110</code>
        <country>US</country>
      </postal>
      <phone>+1 408 536 3024</phone>
      <email>LMM@acm.org</email>
      <uri>http://larry.masinter.net</uri>
    </address>
  </author>
  
  <date year="2003" month="January" day="23"/>
  </front>
  <seriesInfo name="RFC" value="3470"/>
  <seriesInfo name="BCP" value="70"/>
</reference>

<reference anchor="WEBARCH" target="http://www.w3.org/TR/2004/REC-webarch-20041215/">
  <front>
    <title>Architecture of the World Wide Web, Volume One</title>
    <author initials="N." surname="Walsh" fullname="Norman Walsh">
      <organization>Sun Microsystems, Inc.</organization>
    </author>
    <author initials="I." surname="Jacobs" fullname="Ian Jacobs">
      <organization>W3C</organization>
      <address>
        <uri>http://www.w3.org/People/Jacobs</uri>
      </address>
    </author>
    <date month="December" day="15" year="2004"/>
  </front>
  <seriesInfo name="W3C" value="REC-webarch-20041215"/>
</reference>

</references>
  
<section title="Alternative Approaches" anchor="alternative.approaches">
  
  <section title="...Through HTML/CSS Extensions">
  <t>     
    Microsoft Internet Explorer implements a 
    Cascading Style Sheet (CSS) extension that allows
    switching to its own WebDAV client ("Webfolder", see
    <eref target="http://msdn.microsoft.com/workshop/author/behaviors/reference/behaviors/anchor.asp"/>).  However, at the time
    of this writing, this extension was not implemented by any other
    user agent.
  </t>
  </section>

  <section title="...Through Custom URI Schemes">
  <t>     
    The "kio" library of the "K Desktop Enviroment" (<eref target="http://www.kde.org/"/>) uses
    the URI scheme "webdav" to dispatch to the system's WebDAV client.  This URI scheme
    is not registered, nor is it supported on other platforms.  Furthermore,
    the W3C's "Architecture of the World Wide Web, Volume One"
    explicitly advises against defining new schemes when existing schemes can be
    used:
  </t>
  <x:blockquote cite="http://www.w3.org/TR/2004/REC-webarch-20041215/#URI-scheme">
    <t>
      A specification SHOULD reuse an existing URI scheme (rather than create a new one)
      when it provides the desired properties of identifiers and their relation to resources.
    </t>
  </x:blockquote>
  <t>
    (See <xref target="WEBARCH" x:fmt="," x:sec="2.4" x:rel="#URI-scheme"/>.)
  </t>
 </section>
  
</section>  
  

<section title="Implementations">
<section title="Example Implementation for Webfolder Client">

<t>
  The figure below shows a sample implementation of a dispatcher for
  the application/davmount+xml datatype, suited for Win32 systems and the
  Microsoft "Webfolder" client.
</t>
<figure><artwork name="davmount.js" type="code" x:lang="">
<spanx>// sample implementation of application/davmount+xml
// dispatcher for Windows Webfolder client
// 
// to install/uninstall:
//        wscript davmount.js
//
// to open the webfolder:
//        wscript davmount.js filename
// (where filename refers to an XML document with MIME type
// application/davmount+xml)</spanx>

var EXTENSION = ".davmount";
var MIMETYPE = "application/davmount+xml";
var REGKW = "WebDAV.mount";
var NS = "xmlns:m='http://purl.org/NET/webdav/mount";

<spanx>// remove keys/entries from the registry</spanx>

function regdel(shell, key) {
  try {
    var x = shell.RegRead(key);
    try {
      shell.RegDelete(key);
    }
    catch(e) {
      WScript.Echo("Error removing key " + key + ": " + e);
    }
  }
  catch(e) {
    <spanx>// entry not present</spanx>
  }
}


<spanx>// methods for registering/unregistering the handler</spanx>

function install() {

  var WshShell = new ActiveXObject("WScript.Shell");
  if (WshShell == null) {
    WScript.Echo("Couldn't instantiate WScript.Shell object");
    return 2;
  }
  
  var fso = new ActiveXObject("Scripting.FileSystemObject");
  
  var RegExt = "HKCR\\" + EXTENSION + "\\";
  var RegMimeType = "HKCR\\MIME\\DataBase\\Content Type\\"
    + MIMETYPE + "\\";
  var RegKw = "HKCR\\" + REGKW + "\\";
    
  var extension = null;
  try {
    extension = WshShell.RegRead(RegMimeType + "Extension"); 
  }
  catch (e) {
  }
  
  if (extension == null) {
    var but = WshShell.popup("Install the dispatcher for mime type "
      + MIMETYPE + "?", 0, MIMETYPE + " installation", 4);

    if (but == 6) {
      try {
        WshShell.RegWrite(RegExt, REGKW);
        WshShell.RegWrite(RegExt + "Content Type", MIMETYPE);
        WshShell.RegWrite(RegMimeType + "Extension", EXTENSION);
        WshShell.RegWrite(RegKw, "WebDAV Mount Request");
        WshShell.RegWrite(RegKw + "DefaultIcon\\",
          "shell32.dll,103");
        var path = fso.getAbsolutePathName("davmount.js");
        WshShell.RegWrite(RegKw + "shell\\open\\command\\",
          "%SystemRoot%\\system32\\wscript.exe /nologo \""
          + path + "\" \"%1\"", "REG_EXPAND_SZ");
      }
      catch (e) {
        WScript.Echo("Error writing to registry");
        return 1;
      }
      
      return 0;
    }
    else {
      return 1;
    }
  }
  else {
    var but = WshShell.popup("Remove the dispatcher for mime type "
      + MIMETYPE + "?", 0, MIMETYPE + " installation", 4);

    if (but == 6) {
      regdel(WshShell, RegExt + "Content Type");
      regdel(WshShell, RegExt);
      regdel(WshShell, RegKw + "shell\\open\\command\\");
      regdel(WshShell, RegKw + "DefaultIcon\\");
      regdel(WshShell, RegKw);
      regdel(WshShell, RegMimeType + "Extension");
      regdel(WshShell, RegMimeType);
      return 0;
    }
    else {
      return 1;
    }
  }
}


if (WScript.Arguments.length == 0) {
  <spanx>// install/uninstall</spanx>
  WScript.Quit(install());
}
else {
  <spanx>// try to invoke Webfolder</spanx>
  
  var inp = new ActiveXObject("MSXML2.DOMDocument");
  var furi = encodeURI(WScript.Arguments(0));
  if (! inp.load(furi)) {
    WScript.Echo("Can't read from '"
      + WScript.Arguments(0) + "'!");
    WScript.Quit(2);
  }
  
  inp.setProperty("SelectionLanguage", "XPath");
  inp.setProperty("SelectionNamespaces",
    "xmlns:m='http://purl.org/NET/webdav/mount'");
  
  var n1 = inp.selectSingleNode("/m:mount/m:url");
  var n2 = inp.selectSingleNode("/m:mount/m:open");

  if (n1 == null) {
    WScript.Echo("&lt;url&gt; element missing.");
    WScript.Quit(2);
  }
  

  var ie = new ActiveXObject("InternetExplorer.Application");

  ie.Navigate("about:blank");
  var doc = ie.Document;
  
  var folder = doc.createElement("span");
  folder.addBehavior("#default#httpFolder");
  
  var result = folder.navigate(n1.text +
                 (n2 == null ? "" : n2.text));
                 
  <spanx>// close the window again when there was no &lt;open&gt; element</spanx>
  if (n2 == null) ie.Quit();

  if (result != "OK") {
    if (result == "PROTOCOL_NOT_SUPPORTED") {
      WScript.Echo("This site doesn't seem to support WebDAV.");
      WScript.Quit(1);
    }
    else {
      WScript.Echo("Unexpected status: " + result);
      WScript.Quit(2);
    }
  }    
}

</artwork>
</figure>
</section>

<section title="Xythos">
<t>
  The "Xythos Drive" WebDAV client for WebDAV supports this specification
  starting with version 4.4.
</t>
</section>
</section>



  </back>
  
</rfc>