idnits 2.17.1 draft-ietf-appsawg-file-scheme-10.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The draft header indicates that this document updates RFC1738, but the abstract doesn't seem to directly say this. It does mention RFC1738 though, so this could be OK. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year (Using the creation date from RFC1738, updated by this document, for RFC5378 checks: 1994-12-01) -- 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 (May 31, 2016) is 2858 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) -- Possible downref: Non-RFC (?) normative reference: ref. 'UTR15' -- Obsolete informational reference (is this intentional?): RFC 1738 (Obsoleted by RFC 4248, RFC 4266) Summary: 0 errors (**), 0 flaws (~~), 1 warning (==), 5 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Applications Area Working Group M. Kerwin 3 Internet-Draft QUT 4 Updates: 1738 (if approved) May 31, 2016 5 Intended status: Standards Track 6 Expires: December 2, 2016 8 The file URI Scheme 9 draft-ietf-appsawg-file-scheme-10 11 Abstract 13 This document specifies the "file" Uniform Resource Identifier (URI) 14 scheme, replacing the definition in RFC 1738. 16 It defines a common syntax which is intended to interoperate across 17 the broad spectrum of existing usages. At the same time it notes 18 some other current practices around the use of file URIs. 20 Note to Readers (To be removed by the RFC Editor) 22 This draft should be discussed on the IETF Applications Area Working 23 Group discussion list . 25 Status of This Memo 27 This Internet-Draft is submitted in full conformance with the 28 provisions of BCP 78 and BCP 79. 30 Internet-Drafts are working documents of the Internet Engineering 31 Task Force (IETF). Note that other groups may also distribute 32 working documents as Internet-Drafts. The list of current Internet- 33 Drafts is at http://datatracker.ietf.org/drafts/current/. 35 Internet-Drafts are draft documents valid for a maximum of six months 36 and may be updated, replaced, or obsoleted by other documents at any 37 time. It is inappropriate to use Internet-Drafts as reference 38 material or to cite them other than as "work in progress." 40 This Internet-Draft will expire on December 2, 2016. 42 Copyright Notice 44 Copyright (c) 2016 IETF Trust and the persons identified as the 45 document authors. All rights reserved. 47 This document is subject to BCP 78 and the IETF Trust's Legal 48 Provisions Relating to IETF Documents 49 (http://trustee.ietf.org/license-info) in effect on the date of 50 publication of this document. Please review these documents 51 carefully, as they describe your rights and restrictions with respect 52 to this document. Code Components extracted from this document must 53 include Simplified BSD License text as described in Section 4.e of 54 the Trust Legal Provisions and are provided without warranty as 55 described in the Simplified BSD License. 57 Table of Contents 59 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 60 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3 61 2. Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 62 3. Operations Involving file URIs . . . . . . . . . . . . . . . 5 63 4. File Name Encoding . . . . . . . . . . . . . . . . . . . . . 5 64 5. Security Considerations . . . . . . . . . . . . . . . . . . . 5 65 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 66 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 7 67 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 7 68 8.1. Normative References . . . . . . . . . . . . . . . . . . 7 69 8.2. Informative References . . . . . . . . . . . . . . . . . 8 70 Appendix A. Differences from Previous Specifications . . . . . . 9 71 Appendix B. Example URIs . . . . . . . . . . . . . . . . . . . . 9 72 Appendix C. Similar Technologies . . . . . . . . . . . . . . . . 9 73 Appendix D. System-Specific Operations . . . . . . . . . . . . . 10 74 D.1. POSIX Systems . . . . . . . . . . . . . . . . . . . . . . 10 75 D.2. DOS- and Windows-Like Systems . . . . . . . . . . . . . . 10 76 D.3. Mac OS X Systems . . . . . . . . . . . . . . . . . . . . 10 77 D.4. OpenVMS Files-11 Systems . . . . . . . . . . . . . . . . 10 78 Appendix E. Nonstandard Syntax Variations . . . . . . . . . . . 11 79 E.1. User Information . . . . . . . . . . . . . . . . . . . . 11 80 E.2. DOS and Windows Drive Letters . . . . . . . . . . . . . . 11 81 E.2.1. Relative Paths . . . . . . . . . . . . . . . . . . . 12 82 E.2.2. Vertical Bar Character . . . . . . . . . . . . . . . 12 83 E.3. UNC Strings . . . . . . . . . . . . . . . . . . . . . . . 13 84 E.3.1. file URI with Authority . . . . . . . . . . . . . . . 13 85 E.3.2. file URI with UNC Path . . . . . . . . . . . . . . . 14 86 E.4. Backslash as Separator . . . . . . . . . . . . . . . . . 15 87 Appendix F. Collected Rules . . . . . . . . . . . . . . . . . . 15 88 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 17 90 1. Introduction 92 A file URI identifies an object (a "file") stored in a structured 93 object naming and accessing environment on a host (a "file system.") 94 The URI can be used in discussions about the file, and if other 95 conditions are met it can be dereferenced to directly access the 96 file. 98 This document specifies a syntax based on the generic syntax of 99 [RFC3986] that is compatible with most existing usages. Optional 100 extensions to the syntax which might be encountered in practice are 101 listed in appendices; these extensions are listed for informational 102 purposes only. 104 The file URI scheme is not coupled with a specific protocol, nor with 105 a specific media type [RFC6838]. See Section 3 for a discussion of 106 operations that can be performed on the object identified by a file 107 URI. 109 1.1. Notational Conventions 111 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 112 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 113 document are to be interpreted as described in [RFC2119]. 115 Throughout this document the term "local file" is used to describe 116 files that can be accessed through the local file system API using 117 only the information included in the file path, not relying on other 118 information such as network addresses. It is important to note that 119 a local file may not be physically located on the local machine, for 120 example if a networked file system is transparently mounted into the 121 local file system. 123 The term "local file URI" is used to describe file URIs which have no 124 authority, or where the authority is the special string "localhost" 125 or a fully qualified domain name that resolves to the machine from 126 which the URI is being interpreted (Section 2). 128 2. Syntax 130 The file URI syntax is defined here in Augmented Backus-Naur Form 131 (ABNF) [RFC5234], importing the "host" and "path-absolute" rules from 132 [RFC3986] (as updated by [RFC6874].) 134 The generic syntax in [RFC3986] includes "path" and "authority" 135 components, for each of which only a subset is used in the definition 136 of the file URI scheme. The relevant subset of "path" is "path- 137 absolute", and the subset of "authority" is "file-auth", given below. 139 The syntax definition below is different from those given in 140 [RFC1630] and [RFC1738] as it is derived from the generic syntax of 141 [RFC3986], which post-dates the previous file URI specifications. 142 Appendix A enumerates significant differences. 144 file-URI = file-scheme ":" file-hier-part 146 file-scheme = "file" 148 file-hier-part = ( "//" auth-path ) 149 / local-path 151 auth-path = [ file-auth ] path-absolute 153 local-path = path-absolute 155 file-auth = "localhost" 156 / host 158 The "host" is the fully qualified domain name of the system on which 159 the file is accessible. This allows a client on another system to 160 know that it cannot access the file system, or perhaps to use some 161 other local mecahnism to access the file. 163 As a special case, the "file-auth" rule can match the string 164 "localhost" which is interpreted as "the machine from which the URI 165 is being interpreted," exactly as if no authority were present. Some 166 current usages of the scheme incorrectly interpret all values in the 167 authority of a file URI, including "localhost", as non-local. Yet 168 others interpret any value as local, even if the "host" does not 169 resolve to the local machine. To maximise compatibility with 170 previous specifications, users MAY choose to include an "auth-path" 171 with no "file-auth" when creating a URI. 173 Some file systems have case-sensitive file naming and some do not. 174 As such the file URI scheme supports case sensitivity, in order to 175 retain the case as given. Any transport-related handling of the file 176 URI scheme MUST retain the case as given. Any mapping to or from a 177 case-insensitive form is soley the responsibility of the 178 implementation processing the file URI on behalf of the referenced 179 file system. 181 Some file systems allow directory objects to be treated as files in 182 some cases. This can be reflected in a file URI by omitting the 183 trailing slash "/" from the path. Be aware that merging a relative 184 URI reference to such a base URI as per Section 5.2 of [RFC3986] 185 could remove the directory name from the resulting target URI. 187 Also see Appendix E that lists some nonstandard syntax variations 188 that can be encountered in practice. 190 3. Operations Involving file URIs 192 Implementations that provide dereferencing operations on file URIs 193 SHOULD, at a minimum, provide a read-like operation to return the 194 contents of a file located by a file URI. Additional operations MAY 195 be provided, such as writing to, creating, and deleting files. See 196 the POSIX file and directory operations [POSIX] for examples of 197 standardized operations that can be performed on files. 199 A file URI can be dependably dereferenced or translated to a local 200 file path only if it is local. A file URI is considered "local" if 201 it has no "file-auth", or the "file-auth" is the special string 202 "localhost" or a fully qualified domain name that resolves to the 203 machine from which the URI is being interpreted (Section 2). 205 This specification neither defines nor forbids any set of operations 206 that might be performed on a file identified by a non-local file URI. 208 4. File Name Encoding 210 File systems use various encoding schemes to store file and directory 211 names. Many modern file systems store file and directory names as 212 arbitrary sequences of octets, in which case the representation as an 213 encoded string often depends on the user's localization settings, or 214 defaults to UTF-8 [STD63]. 216 When a file URI is produced, characters not allowed by the syntax in 217 Section 2 SHOULD be percent-encoded as characters using UTF-8 218 encoding, as per [RFC3986], Section 2.5. 220 However, encoding information for file and/or directory names might 221 not be available. In these cases, implementations MAY use heuristics 222 to determine the encoding. If that fails, they SHOULD percent-encode 223 the raw bytes of the label directly. 225 5. Security Considerations 227 There are many security considerations for URI schemes discussed in 228 [RFC3986]. 230 File access and the granting of privileges for specific operations 231 are complex topics, and the use of file URIs can complicate the 232 security model in effect for file privileges. 234 Historically, user agents have granted content from the file URI 235 scheme a tremendous amount of privilege. However, granting all local 236 files such wide privileges can lead to privilege escalation attacks. 237 Some user agents have had success granting local files directory- 238 based privileges, but this approach has not been widely adopted. 239 Other user agents use globally unique identifiers as the origin for 240 each file URI [RFC6454], which is the most secure option. 242 File systems typically assign an operational meaning to special 243 characters, such as the "/", "\", ":", "[", and "]" characters, and 244 to special device names like ".", "..", "...", "aux", "lpt", etc. In 245 some cases, merely testing for the existence of such a name will 246 cause the operating system to pause or invoke unrelated system calls, 247 leading to significant security concerns regarding denial of service 248 and unintended data transfer. It would be impossible for this 249 specification to list all such significant characters and device 250 names. Implementers MUST research the reserved names and characters 251 for the types of storage device that may be attached to their 252 application and restrict the use of data obtained from URI components 253 accordingly. 255 File systems vary in the way they handle case. Care must (?) be 256 taken to avoid issues resulting from possibly unexpected aliasing 257 from case-only differences between file paths or URIs. Similarly, 258 care must be taken to avoid issues resulting from aliasing from 259 mismatched encodings or Unicode equivalences [UTR15] (see Section 4). 261 6. IANA Considerations 263 This document defines the following URI scheme, so the "Permanent URI 264 Schemes" registry has been updated accordingly. This registration 265 complies with [BCP35]. 267 Scheme name: 268 file 270 Status: 271 permanent 273 Applications/protocols that use this scheme name: 274 Commonly used in hypertext documents to refer to files without 275 depending on network access. Supported by major browsers. 277 Windows API (PathCreateFromUrl, UrlCreateFromPath). 279 Perl LWP. 281 Contact: 282 Matthew Kerwin 284 Change Controller: 286 This scheme is registered under the IETF tree. As such, the IETF 287 maintains change control. 289 7. Acknowledgements 291 This specification is derived from [RFC1738], [RFC3986], and 292 [I-D.hoffman-file-uri] (expired); the acknowledgements in those 293 documents still apply. 295 Additional thanks to Dave Risney, author of the informative IE Blog 296 article , and Dave Thaler for their early comments and 298 suggestions. 300 8. References 302 8.1. Normative References 304 [BCP35] Thaler, D., Ed., Hansen, T., and T. Hardie, "Guidelines 305 and Registration Procedures for URI Schemes", BCP 35, 306 RFC 7595, DOI 10.17487/RFC7595, June 2015, 307 . 309 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 310 Requirement Levels", BCP 14, RFC 2119, 311 DOI 10.17487/RFC2119, March 1997, 312 . 314 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 315 Resource Identifier (URI): Generic Syntax", STD 66, 316 RFC 3986, DOI 10.17487/RFC3986, January 2005, 317 . 319 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 320 Specifications: ABNF", STD 68, RFC 5234, 321 DOI 10.17487/RFC5234, January 2008, 322 . 324 [RFC6874] Carpenter, B., Cheshire, S., and R. Hinden, "Representing 325 IPv6 Zone Identifiers in Address Literals and Uniform 326 Resource Identifiers", RFC 6874, DOI 10.17487/RFC6874, 327 February 2013, . 329 [UTR15] Davis, M. and K. Whistler, "Unicode Normalization Forms", 330 August 2012, 331 . 333 8.2. Informative References 335 [Bug107540] 336 Bugzilla@Mozilla, "Bug 107540", October 2007, 337 . 339 [I-D.hoffman-file-uri] 340 Hoffman, P., "The file URI Scheme", draft-hoffman-file- 341 uri-03 (work in progress), January 2005. 343 [MS-DTYP] Microsoft Open Specifications, "Windows Data Types, 2.2.57 344 UNC", October 2015, 345 . 347 [POSIX] IEEE, "IEEE Std 1003.1, 2013 Edition", 2013. 349 [RFC1630] Berners-Lee, T., "Universal Resource Identifiers in WWW: A 350 Unifying Syntax for the Expression of Names and Addresses 351 of Objects on the Network as used in the World-Wide Web", 352 RFC 1630, DOI 10.17487/RFC1630, June 1994, 353 . 355 [RFC1738] Berners-Lee, T., Masinter, L., and M. McCahill, "Uniform 356 Resource Locators (URL)", RFC 1738, DOI 10.17487/RFC1738, 357 December 1994, . 359 [RFC6454] Barth, A., "The Web Origin Concept", RFC 6454, 360 DOI 10.17487/RFC6454, December 2011, 361 . 363 [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type 364 Specifications and Registration Procedures", BCP 13, 365 RFC 6838, DOI 10.17487/RFC6838, January 2013, 366 . 368 [STD63] Yergeau, F., "UTF-8, a transformation format of ISO 369 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 370 2003, . 372 [WHATWG-URL] 373 WHATWG, "URL Living Standard", May 2013, 374 . 376 [Win32-Namespaces] 377 Microsoft Developer Network, "Naming Files, Paths, and 378 Namespaces", June 2013, . 381 Appendix A. Differences from Previous Specifications 383 According to the definition in [RFC1738] a file URL always started 384 with the token "file://", followed by an (optionally blank) host name 385 and a "/". The syntax given in Section 2 makes the entire authority 386 component, including the double slashes "//", optional. 388 Appendix B. Example URIs 390 The syntax in Section 2 is intended to support file URIs that take 391 the following forms: 393 Local files: 395 o A traditional file URI for a local file, with an empty authority. 396 This is the most common format in use today. E.g.: 398 * "file:///path/to/file" 400 o The minimal representation of a local file, with no authority 401 field and an absolute path that begins with a slash "/". E.g.: 403 * "file:/path/to/file" 405 Non-local files: 407 o A non-local file, with an explicit authority. E.g.: 409 * "file://host.example.com/path/to/file" 411 Appendix C. Similar Technologies 413 o The WHATWG defines a living URL standard [WHATWG-URL], which 414 includes algorithms for interpreting file URIs (as URLs). 416 o The Universal Naming Convention (UNC) [MS-DTYP] defines a string 417 format that can perform a similar role to the file URI scheme in 418 describing the location of files, except that files located by UNC 419 filespace selector strings are typically stored on a remote 420 machine and accessed using a network protocol. A UNC filespace 421 selector string has three parts: host, share, and path. 422 Appendix E.3 lists some ways in which UNC filespace selector 423 strings are currently made to interoperate with the file URI 424 scheme. 426 o The Microsoft Windows API defines Win32 Namespaces 427 [Win32-Namespaces] for interacting with files and devices using 428 Windows API functions. These namespaced paths are prefixed by 429 "\\?\" for Win32 File Namespaces and "\\.\" for Win32 Device 430 Namespaces. There is also a special case for UNC file paths in 431 Win32 File Namespaces, referred to as "Long UNC", using the prefix 432 "\\?\UNC\". This specification does not define a mechanism for 433 translating namespaced paths to or from file URIs. 435 Appendix D. System-Specific Operations 437 This appendix is not normative; it highlights some observed 438 behaviours and provides system-specific guidance for interacting with 439 file URIs and paths. 441 D.1. POSIX Systems 443 There is little to say about POSIX file systems; the file URI 444 structure already closely resembles POSIX file paths. 446 D.2. DOS- and Windows-Like Systems 448 When mapping a DOS- or Windows-like file path to a file URI, the 449 drive letter (e.g. "c:") is typically mapped into the first path 450 segment. 452 Appendix E lists some non-standard techniques for interacting with 453 DOS- or Windows-like file paths and URIs. 455 D.3. Mac OS X Systems 457 The HFS+ file system uses a non-standard normalization form, similar 458 to Normalization Form D [UTR15]. Take care when transforming HFS+ 459 file paths to and from URIs (Section 4). 461 D.4. OpenVMS Files-11 Systems 463 When mapping a VMS file path to a file URI, the device name is mapped 464 into the first path segment. Note that the dollars sign "$" is a 465 reserved character per the definition in [RFC3986], Section 2.2, so 466 should be percent-encoded if present in the device name. 468 If the VMS file path includes a node reference, that is used as the 469 authority. Where the original node reference includes a username and 470 password in an access control string, they can be transcribed into 471 the authority using the non-standard syntax extension in 472 Appendix E.1. 474 Appendix E. Nonstandard Syntax Variations 476 These variations may be encountered by existing usages of the file 477 URI scheme, but are not supported by the normative syntax of 478 Section 2. 480 This appendix is not normative. 482 E.1. User Information 484 It might be necessary to include user information such as a username 485 in a file URI, for example when mapping a VMS file path with a node 486 reference that includes a username. 488 To allow user information to be included in a file URI, the "file- 489 auth" rule in Section 2 can be replaced with the following: 491 file-auth = "localhost" 492 / [ userinfo "@" ] host 494 This uses the "userinfo" rule from [RFC3986]. 496 As discussed in the HP OpenVMS Systems Documentation 497 498 "access control strings include sufficient information to allow 499 someone to break in to the remote account, [therefore] they create 500 serious security exposure." In a similar vein, the presence of a 501 password in a "user:password" userinfo field is deprecated by 502 [RFC3986]. As such, the userinfo field of a file URI, if present, 503 MUST NOT (?) contain a password. 505 E.2. DOS and Windows Drive Letters 507 On Windows- or DOS-based file systems an absolute file path can begin 508 with a drive letter. To facilitate this, the "local-path" rule in 509 Section 2 can be replaced with the following: 511 local-path = [ drive-letter ] path-absolute 513 drive-letter = ALPHA ":" 515 The "ALPHA" rule is defined in [RFC5234]. 517 This is intended to support the minimal representation of a local 518 file in a DOS- or Windows-based environment, with no authority field 519 and an absolute path that begins with a drive letter. E.g.: 521 o "file:c:/path/to/file" 522 URIs of the form "file:///c:/path/to/file" are already supported by 523 the "path-absolute" rule. 525 Note that comparison of drive letters in DOS or Windows file paths is 526 case-insensitive, some usages of file URIs therefore canonicalize 527 drive letters by converting them to uppercase. 529 E.2.1. Relative Paths 531 To mimic the behaviour of DOS- or Windows-based file systems, 532 relative paths beginning with a slash "/" can be resolved relative to 533 the drive letter, when present, and resolution of ".." dot segments 534 (per Section 5.2.4 of [RFC3986]) can be modified to not ever 535 overwrite the drive letter. 537 For example: 539 base: file:///c:/path/to/file.txt 540 rel. URI: /some/other/thing.bmp 541 resolved: file:///c:/some/other/thing.bmp 543 base: file:///c:/foo.txt 544 rel. URI: ../../bar.txt 545 resolved: file:///c:/bar.txt 547 Relative paths with a drive letter followed by a character other than 548 a slash (e.g. "c:bar/baz.txt" or "c:../foo.txt") might not be 549 accepted as dereferenceable URIs in DOS or Windows systems. 551 E.2.2. Vertical Bar Character 553 Historically some usages of file URIs have included a vertical line 554 character "|" instead of a colon ":" in the drive letter construct. 555 [RFC3986] forbids the use of the vertical line, however it may be 556 necessary to interpret or update old URIs. 558 For interpreting such URIs, the "auth-path" and "local-path" rules in 559 Section 2 and the "drive-letter" rule above can be replaced with the 560 following: 562 auth-path = [ file-auth ] path-absolute 563 / [ file-auth ] file-absolute 565 local-path = [ drive-letter ] path-absolute 566 / file-absolute 568 file-absolute = "/" drive-letter path-absolute 570 drive-letter = ALPHA ":" 571 / ALPHA "|" 573 This is intended to support regular DOS or Windows file URIs with 574 vertical line characters in the drive letter construct. E.g.: 576 o "file:///c|/path/to/file" 578 o "file:/c|/path/to/file" 580 o "file:c|/path/to/file" 582 To update such an old URI, replace the vertical line "|" with a colon 583 ":". 585 E.3. UNC Strings 587 Some usages of the file URI scheme allow UNC filespace selector 588 strings [MS-DTYP] to be translated to and from file URIs, either by 589 mapping the equivalent segments of the two schemes (hostname to 590 authority, sharename+objectnames to path), or by mapping the entire 591 UNC string to the path segment of a URI. 593 E.3.1. file URI with Authority 595 The following is an algorithmic description of the process of 596 translating a UNC filespace selector string to a file URI by mapping 597 the equivalent segments of the two schemes: 599 1. Initialise the URI with the "file:" scheme identifier. 601 2. Append the authority: 603 1. Append the "//" authority sigil to the URI. 605 2. Append the host-name field of the UNC string to the URI. 607 3. Append the share-name: 609 1. Transform the share-name to a path segment ([RFC3986], 610 Section 3.3) to conform to the encoding rules of Section 2 of 611 [RFC3986]. 613 2. Append a delimiting slash character "/" and the transformed 614 segment to the URI. 616 4. For each object-name: 618 1. Transform the objectname to a path segment as above. 620 The colon character ":" is allowed as a delimiter before 621 stream-name and stream-type in the file-name, if present. 623 2. Append a delimiting slash character "/" and the transformed 624 segment to the URI. 626 For example: 628 UNC String: \\host.example.com\Share\path\to\file.txt 629 URI: file://host.example.com/Share/path/to/file.txt 631 E.3.2. file URI with UNC Path 633 It is common to encounter file URIs that encode entire UNC strings in 634 the path, usually with all backslash "\" characters replaced with 635 slashes "/". 637 To interpret such URIs, the "auth-path" rule in Section 2 can be 638 replaced with the following: 640 auth-path = [ file-auth ] path-absolute 641 / unc-authority path-absolute 643 unc-authority = 2*3"/" file-host 645 file-host = inline-IP / IPv4address / reg-name 647 inline-IP = "%5B" ( IPv6address / IPvFuture ) "%5D" 649 This syntax uses the "IPv4address", "IPv6address", "IPvFuture", and 650 "reg-name" rules from [RFC3986]. 652 Note that the "file-host" rule is the same as "host" but with 653 percent-encoding applied to "[" and "]" characters. 655 This extended syntax is intended to support URIs that take the 656 following forms, in addition to those in Appendix B: 658 Non-local files: 660 o The representation of a non-local file, with an empty authority 661 and a complete (transformed) UNC string in the path. E.g.: 663 * "file:////host.example.com/path/to/file" 665 o As above, with an extra slash between the empty authority and the 666 transformed UNC string, as per the syntax defined in [RFC1738]. 667 E.g.: 669 * "file://///host.example.com/path/to/file" 671 This representation is notably used by the Firefox web browser. 672 See Bugzilla#107540 [Bug107540]. 674 It also further limits the definition of a "local file URI" by 675 excluding any with a path that encodes a UNC string. 677 E.4. Backslash as Separator 679 Historically some usages have copied entire file paths into the path 680 components of file URIs. Where DOS or Windows file paths were thus 681 copied the resulting URI strings contained unencoded backslash "\" 682 characters, which are forbidden by both [RFC1738] and [RFC3986]. 684 It may be possible to translate or update such an invalid file URI by 685 replacing all backslashes "\" with slashes "/", if it can be 686 determined with reasonable certainty that the backslashes are 687 intended as path separators. 689 Appendix F. Collected Rules 691 Here are the collected syntax rules for all optional appendices, 692 presented for convenience. This collected syntax is not normative. 694 file-URI = file-scheme ":" file-hier-part 696 file-scheme = "file" 698 file-hier-part = ( "//" auth-path ) 699 / local-path 701 auth-path = [ file-auth ] path-absolute 702 / [ file-auth ] file-absolute 703 / unc-authority path-absolute 705 local-path = [ drive-letter ] path-absolute 706 / file-absolute 708 file-auth = "localhost" 709 / [ userinfo "@" ] host 711 unc-authority = 2*3"/" file-host 713 file-host = inline-IP / IPv4address / reg-name 715 inline-IP = "%5B" ( IPv6address / IPvFuture ) "%5D" 717 file-absolute = "/" drive-letter path-absolute 719 drive-letter = ALPHA ":" 720 / ALPHA "|" 722 This collected syntax is intended to support file URIs that take the 723 following forms: 725 Local files: 727 o A traditional file URI for a local file, with an empty authority. 728 E.g.: 730 * "file:///path/to/file" 732 o The minimal representation of a local file, with no authority 733 field and an absolute path that begins with a slash "/". E.g.: 735 * "file:/path/to/file" 737 o The minimal representation of a local file in a DOS- or Windows- 738 based environment, with no authority field and an absolute path 739 that begins with a drive letter. E.g.: 741 * "file:c:/path/to/file" 743 o Regular DOS or Windows file URIs, with vertical line characters in 744 the drive letter construct. E.g.: 746 * "file:///c|/path/to/file" 748 * "file:/c|/path/to/file" 750 * "file:c|/path/to/file" 752 Non-local files: 754 o The representation of a non-local file, with an explicit 755 authority. E.g.: 757 * "file://host.example.com/path/to/file" 759 o The "traditional" representation of a non-local file, with an 760 empty authority and a complete (transformed) UNC string in the 761 path. E.g.: 763 * "file:////host.example.com/path/to/file" 765 o As above, with an extra slash between the empty authority and the 766 transformed UNC string. E.g.: 768 * "file://///host.example.com/path/to/file" 770 Author's Address 772 Matthew Kerwin 773 Queensland University of Technology 774 Victoria Park Road 775 Kelvin Grove, QLD 4059 776 Australia 778 Email: matthew.kerwin@qut.edu.au