Network Working Group                                      L. Masinter
Request for Comments: 2397                           Xerox Corporation
Category: Standards Track                                  August 1998
        
Network Working Group                                      L. Masinter
Request for Comments: 2397                           Xerox Corporation
Category: Standards Track                                  August 1998
        

The "data" URL scheme

“数据”URL方案

Status of this Memo

本备忘录的状况

This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited.

本文件规定了互联网社区的互联网标准跟踪协议,并要求进行讨论和提出改进建议。有关本协议的标准化状态和状态,请参考当前版本的“互联网官方协议标准”(STD 1)。本备忘录的分发不受限制。

Copyright Notice

版权公告

Copyright (C) The Internet Society (1998). All Rights Reserved.

版权所有(C)互联网协会(1998年)。版权所有。

1. Abstract
1. 摘要

A new URL scheme, "data", is defined. It allows inclusion of small data items as "immediate" data, as if it had been included externally.

定义了一个新的URL方案“数据”。它允许将小数据项作为“即时”数据包含,就好像它是外部包含的一样。

2. Description
2. 描述

Some applications that use URLs also have a need to embed (small) media type data directly inline. This document defines a new URL scheme that would work like 'immediate addressing'. The URLs are of the form:

一些使用URL的应用程序还需要直接内联嵌入(小型)媒体类型的数据。本文档定义了一个新的URL方案,其工作原理类似于“即时寻址”。URL的格式如下:

                    data:[<mediatype>][;base64],<data>
        
                    data:[<mediatype>][;base64],<data>
        

The <mediatype> is an Internet media type specification (with optional parameters.) The appearance of ";base64" means that the data is encoded as base64. Without ";base64", the data (as a sequence of octets) is represented using ASCII encoding for octets inside the range of safe URL characters and using the standard %xx hex encoding of URLs for octets outside that range. If <mediatype> is omitted, it defaults to text/plain;charset=US-ASCII. As a shorthand, "text/plain" can be omitted but the charset parameter supplied.

<mediatype>是一种Internet媒体类型规范(带有可选参数)。“base64”的出现意味着数据编码为base64。如果没有“base64”,数据(作为八位字节序列)将使用ASCII编码表示安全URL字符范围内的八位字节,并使用标准的%xx十六进制编码表示该范围外的八位字节的URL。如果省略<mediatype>,则默认为text/plain;字符集=US-ASCII。简而言之,“text/plain”可以省略,但提供了charset参数。

The "data:" URL scheme is only useful for short values. Note that some applications that use URLs may impose a length limit; for example, URLs embedded within <A> anchors in HTML have a length limit determined by the SGML declaration for HTML [RFC1866]. The LITLEN (1024) limits the number of characters which can appear in a single

“数据:”URL方案仅对短值有用。请注意,一些使用URL的应用程序可能会施加长度限制;例如,嵌入HTML中<A>锚定中的URL具有由HTML的SGML声明[RFC1866]确定的长度限制。LITLEN(1024)限制了单个字符中可以出现的字符数

attribute value literal, the ATTSPLEN (2100) limits the sum of all lengths of all attribute value specifications which appear in a tag, and the TAGLEN (2100) limits the overall length of a tag.

属性值文字,ATTPLEN(2100)限制标记中出现的所有属性值规范的所有长度之和,TAGLEN(2100)限制标记的总长度。

The "data" URL scheme has no relative URL forms.

“数据”URL方案没有相对URL表单。

3. Syntax
3. 语法
       dataurl    := "data:" [ mediatype ] [ ";base64" ] "," data
       mediatype  := [ type "/" subtype ] *( ";" parameter )
       data       := *urlchar
       parameter  := attribute "=" value
        
       dataurl    := "data:" [ mediatype ] [ ";base64" ] "," data
       mediatype  := [ type "/" subtype ] *( ";" parameter )
       data       := *urlchar
       parameter  := attribute "=" value
        

where "urlchar" is imported from [RFC2396], and "type", "subtype", "attribute" and "value" are the corresponding tokens from [RFC2045], represented using URL escaped encoding of [RFC2396] as necessary.

其中“urlchar”是从[RFC2396]导入的,“type”、“subtype”、“attribute”和“value”是来自[RFC2045]的相应标记,根据需要使用[RFC2396]的URL转义编码表示。

Attribute values in [RFC2045] are allowed to be either represented as tokens or as quoted strings. However, within a "data" URL, the "quoted-string" representation would be awkward, since the quote mark is itself not a valid urlchar. For this reason, parameter values should use the URL Escaped encoding instead of quoted string if the parameter values contain any "tspecial".

[RFC2045]中的属性值可以表示为标记或带引号的字符串。但是,在“数据”URL中,“引用的字符串”表示形式会很尴尬,因为引号本身不是有效的urlchar。因此,如果参数值包含任何“tspecial”,则参数值应使用URL转义编码而不是带引号的字符串。

The ";base64" extension is distinguishable from a content-type parameter by the fact that it doesn't have a following "=" sign.

“base64”扩展名与内容类型参数的区别在于它没有下面的“=”符号。

4. Examples
4. 例子

A data URL might be used for arbitrary types of data. The URL

数据URL可用于任意类型的数据。网址

data:,A%20brief%20note

数据:,一个%20简短的%20注释

encodes the text/plain string "A brief note", which might be useful in a footnote link.

对文本/普通字符串“简短注释”进行编码,这在脚注链接中可能很有用。

The HTML fragment:

HTML片段:

   <IMG
   SRC="data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw
   AAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFz
   ByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSp
   a/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJl
   ZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uis
   F81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PH
   hhx4dbgYKAAA7"
   ALT="Larry">
        
   <IMG
   SRC="data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw
   AAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFz
   ByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSp
   a/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJl
   ZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uis
   F81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PH
   hhx4dbgYKAAA7"
   ALT="Larry">
        

could be used for a small inline image in a HTML document. (The embedded image is probably near the limit of utility. For anything else larger, data URLs are likely to be inappropriate.)

可用于HTML文档中的小型内联图像。(嵌入的图像可能已接近实用程序的极限。对于其他更大的图像,数据URL可能不合适。)

A data URL scheme's media type specification can include other parameters; for example, one might specify a charset parameter.

数据URL方案的媒体类型规范可以包括其他参数;例如,可以指定一个字符集参数。

      data:text/plain;charset=iso-8859-7,%be%fg%be
        
      data:text/plain;charset=iso-8859-7,%be%fg%be
        

can be used for a short sequence of greek characters.

可用于希腊字符的短序列。

Some applications may use the "data" URL scheme in order to provide setup parameters for other kinds of networking applications. For example, one might create a media type application/vnd-xxx-query

一些应用程序可能使用“数据”URL方案,以便为其他类型的网络应用程序提供设置参数。例如,可以创建媒体类型的应用程序/vnd xxx查询

whose content consists of a query string and a database identifier for the "xxx" vendor's databases. A URL of the form:

其内容包括“xxx”供应商数据库的查询字符串和数据库标识符。表单的URL:

data:application/vnd-xxx-query,select_vcount,fcol_from_fieldtable/local

数据:应用程序/vnd xxx查询,从\u fieldtable/local中选择\u vcount、fcol\u

could then be used in a local application to launch the "helper" for application/vnd-xxx-query and give it the immediate data included.

然后可以在本地应用程序中使用,为application/vnd xxx查询启动“helper”,并为其提供包含的即时数据。

5. History
5. 历史

This idea was originally proposed August 1995. Some versions of the data URL scheme have been used in the definition of VRML, and a version has appeared as part of a proposal for embedded data in HTML. Various changes have been made, based on requests, to elide the media type, pack the indication of the base64 encoding more tightly, and eliminate "quoted printable" as an encoding since it would not easily yield valid URLs without additional %xx encoding, which itself is sufficient. The "data" URL scheme is in use in VRML, new applications of HTML, and various commercial products. It is being used for object parameters in Java and ActiveX applications.

这个想法最初是在1995年8月提出的。VRML的定义中使用了一些版本的数据URL方案,一个版本已作为HTML中嵌入数据方案的一部分出现。已根据请求进行了各种更改,以省略媒体类型,更紧密地包装base64编码的指示,并消除“引用的可打印”作为编码,因为如果没有额外的%xx编码(这本身就足够了),它将很难生成有效的URL。“数据”URL方案正在VRML、HTML的新应用程序和各种商业产品中使用。它用于Java和ActiveX应用程序中的对象参数。

6. Security
6. 安全

Interpretation of the data within a "data" URL has the same security considerations as any implementation of the given media type. An application should not interpret the contents of a data URL which is marked with a media type that has been disallowed for processing by the application's configuration.

“数据”URL中的数据解释与给定媒体类型的任何实现具有相同的安全考虑。应用程序不应解释标记有媒体类型的数据URL的内容,该媒体类型已被应用程序的配置禁止处理。

Sites which use firewall proxies to disallow the retrieval of certain media types (such as application script languages or types with known security problems) will find it difficult to screen against the inclusion of such types using the "data" URL scheme. However, they should be aware of the threat and take whatever precautions are considered necessary within their domain.

使用防火墙代理不允许检索某些媒体类型(如应用程序脚本语言或存在已知安全问题的类型)的站点将发现,使用“数据”URL方案很难屏蔽此类类型。然而,他们应该意识到这种威胁,并在其管辖范围内采取一切必要的预防措施。

The effect of using long "data" URLs in applications is currently unknown; some software packages may exhibit unreasonable behavior when confronted with data that exceeds its allocated buffer size.

在应用程序中使用长“数据”URL的效果目前尚不清楚;当遇到超过其分配的缓冲区大小的数据时,某些软件包可能会表现出不合理的行为。

7. References
7. 工具书类

[RFC2396] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifiers (URI): Generic Syntax", RFC 2396, August 1998.

[RFC2396]Berners Lee,T.,Fielding,R.,和L.Masinter,“统一资源标识符(URI):通用语法”,RFC 2396,1998年8月。

[RFC1866] Berners-Lee, T., and D. Connolly, "Hypertext Markup Language - 2.0.", RFC 1866, November 1995.

[RFC1866]Berners Lee,T.和D.Connolly,“超文本标记语言-2.0.”,RFC 18661995年11月。

[RFC2045] Freed N., and N. Borenstein., "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", RFC 2045, November 1996.

[RFC2045]Freed N.和N.Borenstein.,“多用途Internet邮件扩展(MIME)第一部分:Internet邮件正文格式”,RFC 20451996年11月。

Author contact information:

作者联系信息:

Larry Masinter Xerox Palo Alto Research Center 3333 Coyote Hill Road Palo Alto, CA 94304

美国加利福尼亚州帕洛阿尔托郊狼山路3333号帕洛阿尔托研究中心

   EMail: masinter@parc.xerox.com
        
   EMail: masinter@parc.xerox.com
        

Full Copyright Statement

完整版权声明

Copyright (C) The Internet Society (1998). All Rights Reserved.

版权所有(C)互联网协会(1998年)。版权所有。

This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.

本文件及其译本可复制并提供给他人,对其进行评论或解释或协助其实施的衍生作品可全部或部分编制、复制、出版和分发,不受任何限制,前提是上述版权声明和本段包含在所有此类副本和衍生作品中。但是,不得以任何方式修改本文件本身,例如删除版权通知或对互联网协会或其他互联网组织的引用,除非出于制定互联网标准的需要,在这种情况下,必须遵循互联网标准过程中定义的版权程序,或根据需要将其翻译成英语以外的其他语言。

The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns.

上述授予的有限许可是永久性的,互联网协会或其继承人或受让人不会撤销。

This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS 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.

本文件和其中包含的信息是按“原样”提供的,互联网协会和互联网工程任务组否认所有明示或暗示的保证,包括但不限于任何保证,即使用本文中的信息不会侵犯任何权利,或对适销性或特定用途适用性的任何默示保证。