是"file://"路径URL? [英] Is a "file://" path a URL?

查看:974
本文介绍了是"file://"路径URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有时会看到人们将文件系统路径(POSIX/Windows)称为URI和URL.我不是文件系统迷,但是我还没有找到与我对URL格式的理解相冲突的文件系统路径.也就是说,当然要考虑到它包含方案名称(例如file://localhost/path/to/file.txt).

I sometimes see people refer to file system paths (POSIX/Windows) as both URIs and URLs. I'm no file system buff, but I have yet to find a file system path that conflicts with my understanding of the URL format. That is, of course, given that it includes the scheme name (e.g. file://localhost/path/to/file.txt).

文件系统路径绝对是URI(我是说,不是),因此每个人都将文件系统路径称为URI都位于安全区域内.但是,将它们称为URL是安全的吗?

File system paths are most definitely URIs - I mean, what's not - so everyone referring to file system paths as URIs is inside the safe zone. But is it safe to call them URLs?

如果该URL是由一个(不作废的)RFC定义的,而不是由六个专门的RFC组成的,那么我就不必问这个问题.

If the URL was defined by a single (non-obsolete) RFC, rather than being comprised of half a dozen specialized ones, I wouldn't have to ask this question.

推荐答案

file

file is a registered URI scheme (for "Host-specific file names").

它链接到 RFC 1738 ,称为统一资源定位符" (URL)",其中file指定的:

It links to RFC 1738, which is called "Uniform Resource Locators (URL)", in which file is specified:

file URL的格式为:

A file URL takes the form:

file://<host>/<path>

是的,file URI是URL.

So yes, file URIs are URLs.

但是,从URI细分为URL,URN和其他"(如data)无论如何都没有用. FWIW, WHATWG URL规范试图为所有类型的URL标准化URI(甚至包括那些今天不是RFC后面的URL). W3C注意"URI,URL和URN:澄清和建议1.0"试图总结对术语的困惑:

However, the subdivision from URIs into URLs, URNs and "Other" (like data) is not that useful anyway. FWIW, the WHATWG URL spec tries to standardize on the term "URL" for all kind of URIs (even those that aren't URLs today, following the RFC). The W3C Note "URIs, URLs, and URNs: Clarifications and Recommendations 1.0" tries to summarize the confusion about the terms:

涵盖URI体系结构,语法,注册等的文档主体(RFC等)跨越了古典时期和当代时期.精通URI的人们倾向于以似乎可互换的方式使用"URL"和"URI".在这些专家中,这不是问题.但是在整个Internet社区中,确实如此.人们不相信URI和URL在文档中(显然)在其中是相同的意思. […]

The body of documents (RFCs, etc) covering URI architecture, syntax, registration, etc., spans both the classical and contemporary periods. People who are well-versed in URI matters tend to use "URL" and "URI" in ways that seem to be interchangable. Among these experts, this isn't a problem. But among the Internet community at large, it is. People are not convinced that URI and URL mean the same thing, in documents where they (apparently) do. […]

这篇关于是"file://"路径URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆