发信人: kenmlee()
整理人: kenmlee(2000-07-08 16:48:42), 站内信件
|
1.4 Overall Operation
1.4 操作纵览
The HTTP protocol is a request/response protocol. A client sends a
request to the server in the form of a request method, URI, and
protocol version, followed by a MIME-like message containing reques
t
modifiers, client information, and possible body content over a
connection with a server. The server responds with a status line,
including the message's protocol version and a success or error cod
e,
followed by a MIME-like message containing server information, enti
ty
metainformation, and possible entity-body content. The relationship
between HTTP and MIME is described in appendix 19.4.
#HTTP协议是一个请求/响应协议.客户通过与服务器的连接向服务器发送这样
的请求,
包含请求方法,URI和协议版本,紧随其后的是类似MIME格式的消息包括请求修
饰,客
户信息,和可能的消息体内容.服务器用这样的响应来回答,包含状态行其中又
包括消
息协议版本和成功或失败码,紧随其后的是类似MIME格式的消息包括服务器信
息,实
体元信息和可能的实体体内容.HTTP和MIME间的关系见附录19.4./#
Most HTTP communication is initiated by a user agent and consists o
f
a request to be applied to a resource on some origin server. In the
simplest case, this may be accomplished via a single connection (v)
between the user agent (UA) and the origin server (O).
#大部分HTTP通信由用户代理启动并且由指向某个原始服务器的请求组成,最简
情况是
通过单个用户代理(UA)和原始服务器(O)间的连接实现./#
request chain ------------------------>
UA -------------------v------------------- O
<----------------------- response chain
A more complicated situation occurs when one or more intermediaries
are present in the request/response chain. There are three common
forms of intermediary: proxy, gateway, and tunnel. A proxy is a
forwarding agent, receiving requests for a URI in its absolute form
,
rewriting all or part of the message, and forwarding the reformatte
d
request toward the server identified by the URI. A gateway is a
receiving agent, acting as a layer above some other server(s) and,
if
necessary, translating the requests to the underlying server's
protocol. A tunnel acts as a relay point between two connections
without changing the messages; tunnels are used when the
communication needs to pass through an intermediary (such as a
firewall) even when the intermediary cannot understand the contents
of the messages.
#当请求/响应链中出现一个或多个中介时环境就变得较复杂了.一般由三种中
介:
代理,网关和隧道.代理是前向代理,接收指向URI的完整形式的请求,重写所有
或
部分消息,然后将重新写好的请求提交给URI表示的服务器.网关是接收代理,扮
演
其它服务器的上层,必要时将请求翻译成底层的服务器协议.隧道扮演两个连接
间
的中继点,但不改变消息本身;隧道往往用于通信需要串过某个中间件(如防火
墙)
而这个中间件不能理解消息内容时./#
request chain -------------------------------------->
UA -----v----- A -----v----- B -----v----- C -----v----- O
<------------------------------------- response chain
The figure above shows three intermediaries (A, B, and C) between t
he
user agent and origin server. A request or response message that
travels the whole chain will pass through four separate connections
.
This distinction is important because some HTTP communication optio
ns
may apply only to the connection with the nearest, non-tunnel
neighbor, only to the end-points of the chain, or to all connection
s
along the chain. Although the diagram is linear, each participant
may be engaged in multiple, simultaneous communications. For exampl
e,
B may be receiving requests from many clients other than A, and/or
forwarding requests to servers other than C, at the same time that
it
is handling A's request.
#上图显示用户代理和原始服务器之间有三个中介,一个请求或响应消息需要通
过四个
连接段才能串过整个链.之间的差别是重要的,因为某些HTTP通信选项可能只是
用于最
近的,非通道的相邻节点,或只是用于链的端节点,或链上的每一个节点.虽然图
示是线
性的,但每个参与者可能同时处于多个并发的通信连接中.例如,B可能在处理A
请求的
同时接受从除A外的其它多个客户接收请求,并且可以提交请求到并非C的服务
器./#
Any party to the communication which is not acting as a tunnel may
employ an internal cache for handling requests. The effect of a cac
he
is that the request/response chain is shortened if one of the
participants along the chain has a cached response applicable to th
at
request. The following illustrates the resulting chain if B has a
cached copy of an earlier response from O (via C) for a request whi
ch
has not been cached by UA or A.
#任何非隧道的通信链参与者,可以使用内部缓存处理请求.缓存的影响是当通
信链参与
者中存在对某个请求的响应时请求/响应链被缩短了.下图演示了B中缓存了一
个以前的
从O(通过C)来的响应,从A来的请求请求该响应,并且该响应未被UA缓存时的情
况./#
request chain ---------->
UA -----v----- A -----v----- B - - - - - - C - - - - - - O
<--------- response chain
Not all responses are usefully cachable, and some requests may
contain modifiers which place special requirements on cache behavio
r.
HTTP requirements for cache behavior and cachable responses are
defined in section 13.
#并不是所有的响应的缓存都是有用的,有些请求会包含一些修饰子用来指定特
殊的缓存
行为要求.HTTP缓存行为要求和响应的可缓存性在13节定义./#
In fact, there are a wide variety of architectures and configuratio
ns
of caches and proxies currently being experimented with or deployed
across the World Wide Web; these systems include national hierarchi
es
of proxy caches to save transoceanic bandwidth, systems that
broadcast or multicast cache entries, organizations that distribute
subsets of cached data via CD-ROM, and so on. HTTP systems are used
in corporate intranets over high-bandwidth links, and for access vi
a
PDAs with low-power radio links and intermittent connectivity. The
goal of HTTP/1.1 is to support the wide diversity of configurations
already deployed while introducing protocol constructs that meet th
e
needs of those who build web applications that require high
reliability and, failing that, at least reliable indications of
failure.
#事实上当前在World Wide Web上实现的或试验中的缓存和代理的结构和配置
多种多样.
这些系统包括用于节省跨洋带宽的国家级层次的代理缓存,广播或组播的缓存
入口,通过
CD-ROM分发缓存数据子集的组织,等等.HTTP系统既用于公司内部网的高带宽连
接,也用
于通过底功耗无线链路和间断连接接入的PDA设备.HTTP/1.1的目标是支持多种
不同的现
已采用的配置,同时引入协议架构以便符合这些要求,高可靠性和至少能可靠的
指出失败
(这点并未成功)./#
HTTP communication usually takes place over TCP/IP connections. The
default port is TCP 80, but other ports can be used. This does not
preclude HTTP from being implemented on top of any other protocol o
n
the Internet, or on other networks. HTTP only presumes a reliable
transport; any protocol that provides such guarantees can be used;
the mapping of the HTTP/1.1 request and response structures onto th
e
transport data units of the protocol in question is outside the sco
pe
of this specification.
#HTTP通信通常基于TCP/IP连接,缺省端口是TCP 80,也可使用其它端口.但不排
除在互联网
其它协议或在其它网络上实现HTTP.HTTP只要求可靠的底层传输,任何能满足这
样要求的协议
都可使用,HTTP/1.1请求和响应结构如何映射到底层传输数据单元的问题不再
本文的描述范围
内./#
In HTTP/1.0, most implementations used a new connection for each
request/response exchange. In HTTP/1.1, a connection may be used fo
r
one or more request/response exchanges, although connections may be
closed for a variety of reasons (see section 8.1).
#在HTTP/1.0中,大部分实现为每个请求/响应的交互使用一个新的连接.在HTT
P/1.1中连接可
以用于一个或多个请求/响应交互,虽然连接可能被各种原因所关闭(见8.1节)
.
-- ※ 修改:.kenmlee 于 Jul 8 16:17:01 修改本文.[FROM: 61.140.188.222] ※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 61.140.188.222]
|
|