发信人: kenmlee()
整理人: kenmlee(2000-07-08 16:48:51), 站内信件
|
3 Protocol Parameters
#3 协议参数/#
3.1 HTTP Version
#3.1 HTTP版本/#
HTTP uses a "<major>.<minor>" numbering scheme to indicate versions
of the protocol. The protocol versioning policy is intended to allo
w
the sender to indicate the format of a message and its capacity for
understanding further HTTP communication, rather than the features
obtained via that communication. No change is made to the version
number for the addition of message components which do not affect
communication behavior or which only add to extensible field values
.
The <minor> number is incremented when the changes made to the
protocol add features which do not change the general message parsi
ng
algorithm, but which may add to the message semantics and imply
additional capabilities of the sender. The <major> number is
incremented when the format of a message within the protocol is
changed.
# HTTP使用"<主版本号>.<次版本号>"的方式指定协议的版本,协议的版本用于允
许
发送者指出消息格式和发送者对将来HTTP通讯的处理能力,而不仅只是通讯的
特征
(这段话中后半句不是很理解).附加的消息组成部分仅仅扩展域值而不影响通
讯行
为,因此版本号不变.对协议添加新特征时,<次版本号>增加,这些特征应该不改
变
一般的消息解析算法但可能增加消息语义和隐含指出发送者的能力.当协议的
消息
格式发生变化时<主版本号>增加.
/#
The version of an HTTP message is indicated by an HTTP-Version fiel
d
in the first line of the message.
HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT
# HTTP消息的版本在消息的第一行的 HTTP-Version 域中指出
HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT
/#
Note that the major and minor numbers MUST be treated as separate
integers and that each may be incremented higher than a single digi
t.
Thus, HTTP/2.4 is a lower version than HTTP/2.13, which in turn is
lower than HTTP/12.3. Leading zeros MUST be ignored by recipients a
nd
MUST NOT be sent.
# 注意主版本号和次版本号必须(MUST)被分别对待并且都可能增加到超过一个数
字.
因此,HTTP/2.4比HTTP/2.13版本低,也比HTTP/12.3低.数字前的零必须(MUST)
被
接收者忽略并必须不(MUST NOT)被发送.
/#
Applications sending Request or Response messages, as defined by th
is
specification, MUST include an HTTP-Version of "HTTP/1.1". Use of
this version number indicates that the sending application is at
least conditionally compliant with this specification.
# 应用程序发送符合本规范定义的请求或响应消息时,必须(MUST)包括版本号"H
TTP/1.1".
使用这个版本号指出发送应用程序至少在一定条件下与本规范兼容.
/#
The HTTP version of an application is the highest HTTP version for
which the application is at least conditionally compliant.
Proxy and gateway applications must be careful when forwarding
messages in protocol versions different from that of the applicatio
n.
Since the protocol version indicates the protocol capability of the
sender, a proxy/gateway MUST never send a message with a version
indicator which is greater than its actual version; if a higher
version request is received, the proxy/gateway MUST either downgrad
e
the request version, respond with an error, or switch to tunnel
behavior. Requests with a version lower than that of the
proxy/gateway's version MAY be upgraded before being forwarded; the
proxy/gateway's response to that request MUST be in the same major
version as the request.
# 一个应用程序的HTTP版本号是指至少条件兼容的最高HTTP协议.代理和网关在
不同版本号应用程序间提交消息时需要小心,由于协议版本号指出发送者的协
议
处理能力,一个代理/网关必须(MUST)永不发出版本指示域值大于消息实际版本
的消息;如果收到一个较高版本的请求代理/网关必须(MUST)或者降低请求的版
本,
或者响应错误消息,或者切换到管道行为.如果请求的版本低于代理/网关的版
本,
可以(MAY)在提交前提高请求的版本;但代理/网关的对这个请求的响应必须(M
UST)
与请求的主版本号保持相同.
/#
Note: Converting between versions of HTTP may involve modificatio
n
of header fields required or forbidden by the versions involved.
# 注:HTTP版本转换引起的对头域的修改可能被相关协议允许或禁止./#
3.2 Uniform Resource Identifiers
#3.2 统一资源标示符/#
URIs have been known by many names: WWW addresses, Universal Docume
nt
Identifiers, Universal Resource Identifiers , and finally the
combination of Uniform Resource Locators (URL) and Names (URN). As
far as HTTP is concerned, Uniform Resource Identifiers are simply
formatted strings which identify--via name, location, or any other
characteristic--a resource.
# URI有许多名称:WWW地址,通用文档标示符(Universal Document Identifiers
),
通用资源标示符(Universal Resource Identifiers),并最终组合了统一资源
定位
(URL)和命名(URN).随着对HTTP的关注,统一资源标示符成为用于标示资源的简
单格
式化的字符串,用于标示名称,位置或任何其它特征.
/#
3.2.1 General Syntax
#3.2.1 一般语法/#
URIs in HTTP can be represented in absolute form or relative to som
e
known base URI, depending upon the context of their use. The two
forms are differentiated by the fact that absolute URIs always begi
n
with a scheme name followed by a colon.
# HTTP的URI可以用绝对形式或相对形式表示,相对形式相对于已知的基本URI,这
个基本
URI依赖于使用环境.两种形式有所不同,绝对形式的URI总是以协议名开头后面
紧跟着
冒号.
URI = ( absoluteURI | relativeURI ) [ "#" fragmen
t ]
absoluteURI = scheme ":" *( uchar | reserved )
relativeURI = net_path | abs_path | rel_path
net_path = "//" net_loc [ abs_path ]
abs_path = "/" rel_path
rel_path = [ path ] [ ";" params ] [ "?" query ]
path = fsegment *( "/" segment )
fsegment = 1*pchar
segment = *pchar
params = param *( ";" param )
param = *( pchar | "/" )
scheme = 1*( ALPHA | DIGIT | "+" | "-" | "." )
net_loc = *( pchar | ";" | "?" )
query = *( uchar | reserved )
fragment = *( uchar | reserved )
pchar = uchar | ":" | "@" | "&" | "=" | "+"
uchar = unreserved | escape
unreserved = ALPHA | DIGIT | safe | extra | national
escape = "%" HEX HEX
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "
+"
extra = "!" | "*" | "'" | "(" | ")" | ","
safe = "$" | "-" | "_" | "."
unsafe = CTL | SP | <"> | "#" | "%" | "<" | ">"
national = <any OCTET excluding ALPHA, DIGIT,
reserved, extra, safe, and unsafe>
# URI = ( absoluteURI | relativeURI ) [ "#" fragmen
t ]
absoluteURI = scheme ":" *( uchar | reserved )
relativeURI = net_path | abs_path | rel_path
net_path = "//" net_loc [ abs_path ]
abs_path = "/" rel_path
rel_path = [ path ] [ ";" params ] [ "?" query ]
path = fsegment *( "/" segment )
fsegment = 1*pchar
segment = *pchar
params = param *( ";" param )
param = *( pchar | "/" )
scheme = 1*( ALPHA | DIGIT | "+" | "-" | "." )
net_loc = *( pchar | ";" | "?" )
query = *( uchar | reserved )
fragment = *( uchar | reserved )
pchar = uchar | ":" | "@" | "&" | "=" | "+"
uchar = unreserved | escape
unreserved = ALPHA | DIGIT | safe | extra | national
escape = "%" HEX HEX
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "
+"
extra = "!" | "*" | "'" | "(" | ")" | ","
safe = "$" | "-" | "_" | "."
unsafe = CTL | SP | <"> | "#" | "%" | "<" | ">"
national = <任何 OCTET 除了 ALPHA, DIGIT,
reserved, extra, safe, and unsafe>
/#
For definitive information on URL syntax and semantics, see RFC 173
8
[4] and RFC 1808 [11]. The BNF above includes national characters n
ot
allowed in valid URLs as specified by RFC 1738, since HTTP servers
are not restricted in the set of unreserved characters allowed to
represent the rel_path part of addresses, and HTTP proxies may
receive requests for URIs not defined by RFC 1738.
# URL的语法和语义的定义参见 RFC 1738[4] 和 RFC 1808[11].上面的 BNF 包
括在
RFC 1738 中不允许的本地化(national)字符,因为HTTP服务器在相对路径(re
l_path)
部分允许使用非保留(unreserved)字符集,并且HTTP代理可能接收非 RFC 173
8 定义
的URI请求.
/#
The HTTP protocol does not place any a priori limit on the length o
f
a URI. Servers MUST be able to handle the URI of any resource they
serve, and SHOULD be able to handle URIs of unbounded length if the
y
provide GET-based forms that could generate such URIs. A server
SHOULD return 414 (Request-URI Too Long) status if a URI is longer
than the server can handle (see section 10.4.15).
# HTTP协议不限制一个URI的长度,服务器必须(MUST)能够处理它的任何资源的U
RI,
并且在它提供基于GET表单所生成的很大的URI时,应该(SHOULD)能够处理.如果
URI的
长度超过了服务器的处理能力,服务器应该返回414状态码(请求URI太长),参见
10.4.15节.
/#
Note: Servers should be cautious about depending on URI lengths
above 255 bytes, because some older client or proxy implementatio
ns
may not properly support these lengths.
# 注意:服务器应该在处理长度超过255字节的URI时注意,因为一些旧的客户程
序或
代理程序的实现可能不能恰当的支持这些长度.
/#
-- ※ 修改:.kenmlee 于 Jul 8 16:23:37 修改本文.[FROM: 61.140.188.222] ※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 61.140.188.222]
|
|