精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>网络专区>>● Network>>● TCPIP>>RFC2068-HTTP/1.1(7)

主题:RFC2068-HTTP/1.1(7)
发信人: kenmlee()
整理人: kenmlee(2000-07-08 16:48:59), 站内信件
3.6 Transfer Codings

#3.6 传输编码 /#

   Transfer coding values are used to indicate an encoding
   transformation that has been, can be, or may need to be applied to 

an
   entity-body in order to ensure "safe transport" through the network

.
   This differs from a content coding in that the transfer coding is a


   property of the message, not of the original entity.

          transfer-coding         = "chunked" | transfer-extension

          transfer-extension      = token

#  传输编码值用于指出对实体体已使用的,能被使用的,或可能需要使用的传输

编码,
   这种编码是为了保证实体体在通过网络传输时确保“安全传送”。与内容编码

不同
   的是传输编码是消息的属性而不是原来的实体的属性。

          transfer-coding         = "chunked" | transfer-extension

          transfer-extension      = token
/#

   All transfer-coding values are case-insensitive. HTTP/1.1 uses
   transfer coding values in the Transfer-Encoding header field (secti

on
   14.40).

#  所有的传输编码值都是大小写不敏感的,HTTP/1.1在传输编码(Transfer-Enc

oding)
   头域(见第14.40节)中使用传输编码值。
/#

   Transfer codings are analogous to the Content-Transfer-Encoding
   values of MIME , which were designed to enable safe transport of
   binary data over a 7-bit transport service. However, safe transport


   has a different focus for an 8bit-clean transfer protocol. In HTTP,


   the only unsafe characteristic of message-bodies is the difficulty 

in
   determining the exact body length (section 7.2.2), or the desire to


   encrypt data over a shared transport.

#  传输编码与MIME的内容传输编码(Content-Transfer-Encoding)值相似,MI

ME是
   设计用来允许在7位传输服务之上安全的传输二进制数据。然而,安全传输在

完全8位
   的传输协议上的注重点不同,在HTTP中,唯一不安全的消息体特征是决定准确

的消息
   体长度的困难(见第7.2.2节),或者是在共享的传输中加密数据的要求。
/#

   The chunked encoding modifies the body of a message in order to
   transfer it as a series of chunks, each with its own size indicator

,
   followed by an optional footer containing entity-header fields. Thi

s
   allows dynamically-produced content to be transferred along with th

e
   information necessary for the recipient to verify that it has
   received the full message.

       Chunked-Body   = *chunk
                        "0" CRLF
                        footer
                        CRLF

       chunk          = chunk-size [ chunk-ext ] CRLF
                        chunk-data CRLF

       hex-no-zero    = <HEX excluding "0">

       chunk-size     = hex-no-zero *HEX
       chunk-ext      = *( ";" chunk-ext-name [ "=" chunk-ext-value ] 

)
       chunk-ext-name = token
       chunk-ext-val  = token | quoted-string
       chunk-data     = chunk-size(OCTET)

       footer         = *entity-header

#  chunked编码修改消息体使它作为一系列chunk传输,每个头由自己的大小指示


   并在其后跟着一个可选的注脚包含实体头域,这些允许动态产生传输的内容,


   最这些内容传输的信息是接收者能够验证它已接收到了整个消息。

       Chunked-Body   = *chunk
                        "0" CRLF
                        footer
                        CRLF

       chunk          = chunk-size [ chunk-ext ] CRLF
                        chunk-data CRLF

       hex-no-zero    = <HEX excluding "0">

       chunk-size     = hex-no-zero *HEX
       chunk-ext      = *( ";" chunk-ext-name [ "=" chunk-ext-value ] 

)
       chunk-ext-name = token
       chunk-ext-val  = token | quoted-string
       chunk-data     = chunk-size(OCTET)

       footer         = *entity-header
/#

   The chunked encoding is ended by a zero-sized chunk followed by the


   footer, which is terminated by an empty line. The purpose of the
   footer is to provide an efficient way to supply information about a

n
   entity that is generated dynamically; applications MUST NOT send
   header fields in the footer which are not explicitly defined as bei

ng
   appropriate for the footer, such as Content-MD5 or future extension

s
   to HTTP for digital signatures or other facilities.

#  chunk编码由一个零大小的chunk结束,接着是注脚,注脚由一个空行结束。注

脚的
   目的是一个有效的方法可以为动态生成的实体提供有用的信息;应用程序不能

在注脚
   发送没有显示定义可以用于该注脚的头域,如Content-MD5或将来对HTTP做的

数字签
   名或其他机制的扩展。
/#

   An example process for decoding a Chunked-Body is presented in
   appendix 19.4.6.

#  在附录19.4.6有一个解码Chunked-Body的处理的例子。 /#

   All HTTP/1.1 applications MUST be able to receive and decode the
   "chunked" transfer coding, and MUST ignore transfer coding extensio

ns
   they do not understand. A server which receives an entity-body with

 a
   transfer-coding it does not understand SHOULD return 501
   (Unimplemented), and close the connection. A server MUST NOT send
   transfer-codings to an HTTP/1.0 client.

#  所有HTTP/1.1的应用程序必须能过够接受和解码"chunked"传输编码,并且必

须忽略它
   不能理解的扩展传输编码。但服务器接收到一个不认识的传输编码的实体时,

它应该
   返回501(未实现Unimplemented),然后关闭连接。服务器一定不能向HTTP/

1.0客户
   应用程序发送传输编码。
/#


--
※ 修改:.kenmlee 于 Jul  8 16:30:06 修改本文.[FROM: 61.140.188.222]
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 61.140.188.222]

[关闭][返回]