精华区 [关闭][返回]

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

主题:RFC2068-HTTP/1.1(12)
发信人: kenmlee()
整理人: kenmlee(2000-07-08 16:49:20), 站内信件
5.1.2 Request-URI

#5.1.2 请求URI /#

   The Request-URI is a Uniform Resource Identifier (section 3.2) and


   identifies the resource upon which to apply the request.

          Request-URI    = "*" | absoluteURI | abs_path

#  请求URI是唯一资源标示符(见第3.2节)和请求资源的标示

          Request-URI    = "*" | absoluteURI | abs_path
/#

   The three options for Request-URI are dependent on the nature of th

e
   request. The asterisk "*" means that the request does not apply to 

a
   particular resource, but to the server itself, and is only allowed


   when the method used does not necessarily apply to a resource. One


   example would be

          OPTIONS * HTTP/1.1

#  使用请求URI的三种选项依赖于请求的特性,星号“*”的意思是请求不是用于

特定
   的资源的,而是用于服务器本身,仅允许用于不需应用于某个资源的方法。一

个例
   子如下:

          OPTIONS * HTTP/1.1
/#

   The absoluteURI form is required when the request is being made to 

a
   proxy. The proxy is requested to forward the request or service it


   from a valid cache, and return the response. Note that the proxy MA

Y
   forward the request on to another proxy or directly to the server
   specified by the absoluteURI. In order to avoid request loops, a
   proxy MUST be able to recognize all of its server names, including


   any aliases, local variations, and the numeric IP address. An examp

le
   Request-Line would be:

          GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1

#  当请求是对代理发出的则要求使用抽象URI(absoluteURI)形式,代理应提交


   请求或用合法的缓存为请求服务,然后返回结果。注意代理可能将请求提交给


   一个代理或直接发送给抽象URI指定的服务器,为防止请求出现循环,代理必


   能识别所有的服务器名称,包括所有别名,局部定义的变量名和数字IP地址。


   例子如下:

          GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1
/#

   To allow for transition to absoluteURIs in all requests in future
   versions of HTTP, all HTTP/1.1 servers MUST accept the absoluteURI


   form in requests, even though HTTP/1.1 clients will only generate
   them in requests to proxies.

#  为了将来版本的HTTP允许在所有的请求中传输抽象URI,所有HTTP/1.1服务器


   必须能接受抽象URI形式的请求,即使HTTP/1.1客户程序只是在向代理发送请


   求时使用它。
/#

   The most common form of Request-URI is that used to identify a
   resource on an origin server or gateway. In this case the absolute


   path of the URI MUST be transmitted (see section 3.2.1, abs_path) a

s
   the Request-URI, and the network location of the URI (net_loc) MUST


   be transmitted in a Host header field. For example, a client wishin

g
   to retrieve the resource above directly from the origin server woul

d
   create a TCP connection to port 80 of the host "www.w3.org" and sen

d
   the lines:

          GET /pub/WWW/TheProject.html HTTP/1.1
          Host: www.w3.org

   followed by the remainder of the Request. Note that the absolute pa

th
   cannot be empty; if none is present in the original URI, it MUST be


   given as "/" (the server root).

#  最一般的请求URI形式是用于标示原始服务器或网关上的资源,在这种情况下

抽象
   路径必须作为请求URI传输(见第3.2.1节,abs_path),并且URI的网络位置必


   在主机头域(Host)中传输。例如,一个客户程序希望直接从原始服务器取得

上面
   的资源,可以创建一个到主机“www.w3.org"端口80的TCP连接,然后发送:



          GET /pub/WWW/TheProject.html HTTP/1.1
          Host: www.w3.org

   后面紧跟着请求的剩余部分。注意抽象路径不能为空,如果最初的URI中什么

也没给
   则必须用“/”(服务器跟目录)给出。
/#

   If a proxy receives a request without any path in the Request-URI a

nd
   the method specified is capable of supporting the asterisk form of


   request, then the last proxy on the request chain MUST forward the


   request with "*" as the final Request-URI. For example, the request



          OPTIONS http://www.ics.uci.edu:8001 HTTP/1.1

   would be forwarded by the proxy as

          OPTIONS * HTTP/1.1
          Host: www.ics.uci.edu:8001

   after connecting to port 8001 of host "www.ics.uci.edu".

#  如果代理接受到请求URI中没有路径,并且请求方法能够支持星号形式的请求


   那么请求链中最后的代理必须在最后的请求URI中使用“*”提交。例如,请求



          OPTIONS http://www.ics.uci.edu:8001 HTTP/1.1

   在连接到主机“www.ics.uci.edu”的8001端口后将被代理提交为:

          OPTIONS * HTTP/1.1
          Host: www.ics.uci.edu:8001
/#

   The Request-URI is transmitted in the format specified in section
   3.2.1.  The origin server MUST decode the Request-URI in order to
   properly interpret the request. Servers SHOULD respond to invalid
   Request-URIs with an appropriate status code.

#  请求URI遵循第3.2.1节规定的格式传输,原始服务器为了适当的解释请求必须


   请求URI进行解码。服务器应该用合适的状态码响应非法的请求URI。
/#

   In requests that they forward, proxies MUST NOT rewrite the
   "abs_path" part of a Request-URI in any way except as noted above t

o
   replace a null abs_path with "*", no matter what the proxy does in


   its internal implementation.

#  无论代理内部是如何实现的,在它所提交的请求中,代理必须不能重写请求U

RI的抽象
   路径"abs_path"部分,除非是前面提到的用"*"代替空的abs_path.
/#

     Note: The "no rewrite" rule prevents the proxy from changing the


     meaning of the request when the origin server is improperly using

 a
     non-reserved URL character for a reserved purpose. Implementers
     should be aware that some pre-HTTP/1.1 proxies have been known to


     rewrite the Request-URI.

#    注意:不重写"no rewrite"规则防止当原始服务器不恰当的使用非保留URL字

符用于
     保留目的时,代理改变请求的含义.实现这应该知道有些HTTP/1.1以前的代理

会重写
     请求URI.
/#


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

[关闭][返回]