Issue #8544 has been updated by phluid61 (Matthew Kerwin).


By rights, RFC 1738 is only superseded by 3986 in terms of specifying a generic syntax; and RFCs 4248 (telnet:) and 4266 (gopher:) show that there is a precedent for perpetuating the scheme definitions from 1738.

In the absence of a living RFC, the file: scheme is a de-facto standard, supported by all major web browsers (for example), and documented all over the internet, so it makes sense for us to support it too.

Also note that RFC 3986 mentions it at least three times:

* Section 1.1 [p6] uses "file:///etc/hosts" as an example
* Section 1.2.3 [p10] mentions the "file" scheme regarding relative references
* Section 3.2.2 [p21] says that '...the "file" URI scheme is defined so that no authority, an empty host, and "localhost" all mean the end-user's machine...'
----------------------------------------
Feature #8544: OpenURI should open 'file://' URIs
https://bugs.ruby-lang.org/issues/8544#change-40058

Author: silasdavis (Silas Davis)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: Next Major


The following code prints the contents of '/tmp/file.txt':

require 'open-uri'
open('/tmp/file.txt').read {|f| puts f.read }

which although useful should probably fail since a unix file path is not a URI, and therefore might shield data problems in a system

However the following should produce the same output and is a URI, but fails:

open('file:///tmp/file.txt').read {|f| puts f.read }

I note that the documentation for open-uri does explain that it is a wrapper for http, https, and ftp, but to deserve its name it should open such URIs as specified in this RFC: http://tools.ietf.org/html/rfc1630. This coupled with the fact that it already does open files, but not by a URI specification.



-- 
http://bugs.ruby-lang.org/