精华区 [关闭][返回]

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

主题:RFC2068-HTTP/1.1(11)
发信人: kenmlee()
整理人: kenmlee(2000-07-08 16:49:16), 站内信件
4.5 General Header Fields

#4.5 通用头域 /#

   There are a few header fields which have general applicability for


   both request and response messages, but which do not apply to the
   entity being transferred. These header fields apply only to the
   message being transmitted.

          general-header = Cache-Control            ; Section 14.9
                         | Connection               ; Section 14.10
                         | Date                     ; Section 14.19
                         | Pragma                   ; Section 14.32
                         | Transfer-Encoding        ; Section 14.40
                         | Upgrade                  ; Section 14.41
                         | Via                      ; Section 14.44

#  有一些头域同时通用于请求和响应消息,但它们对转换的实体不起作用,这些头


   只用于传输中的消息.

          general-header = Cache-Control            ; 第14.9节
                         | Connection               ; 第14.10节
                         | Date                     ; 第14.19节
                         | Pragma                   ; 第14.32节
                         | Transfer-Encoding        ; 第14.40节
                         | Upgrade                  ; 第14.41节
                         | Via                      ; 第14.44节
/#

   General-header field names can be extended reliably only in
   combination with a change in the protocol version. However, new or


   experimental header fields may be given the semantics of general
   header fields if all parties in the communication recognize them to


   be general-header fields.  Unrecognized header fields are treated a

s
   entity-header fields.

#  通用头域只有在改变协议版本时才能有扩展.然而如果通讯双方承认是通用头

域,
   新的或试验性的头域可以给通用头域赋予其他语义.未被承认的头域被认为是

实体
   头域.
/#

5 Request

#5 请求 /#

   A request message from a client to a server includes, within the
   first line of that message, the method to be applied to the resourc

e,
   the identifier of the resource, and the protocol version in use.

           Request       = Request-Line              ; Section 5.1
                           *( general-header         ; Section 4.5
                            | request-header         ; Section 5.3
                            | entity-header )        ; Section 7.1
                           CRLF
                           [ message-body ]          ; Section 7.2

#  从客户程序到服务器程序的请求消息在消息的第一行包括,对资源使用的方法


   资源标示符,和使用的协议版本号。

           Request       = Request-Line              ; 第5.1节
                           *( general-header         ; 第4.5节
                            | request-header         ; 第5.3节
                            | entity-header )        ; 第7.1节
                           CRLF
                           [ message-body ]          ; 第7.2节
/#

5.1 Request-Line

#5.1 请求行(Request-Line) /#

   The Request-Line begins with a method token, followed by the
   Request-URI and the protocol version, and ending with CRLF. The
   elements are separated by SP characters. No CR or LF are allowed
   except in the final CRLF sequence.

#  请求行用一个方法标示开始,接着是请求资源标示符(Request-URI)和协议

版本,
   最后用CRLF结束。各元素间用SP分割,除最后的CRLF序列外不允许有CR或LF出

现。
/#

          Request-Line   = Method SP Request-URI SP HTTP-Version CRLF



#         Request-Line   = Method SP Request-URI SP HTTP-Version CRLF 

/#

5.1.1 Method

#5.1.1 方法 /#

   The Method token indicates the method to be performed on the resour

ce
   identified by the Request-URI. The method is case-sensitive.

          Method         = "OPTIONS"                ; Section 9.2
                         | "GET"                    ; Section 9.3
                         | "HEAD"                   ; Section 9.4
                         | "POST"                   ; Section 9.5
                         | "PUT"                    ; Section 9.6
                         | "DELETE"                 ; Section 9.7
                         | "TRACE"                  ; Section 9.8
                         | extension-method

          extension-method = token

#  方法标记指出对由请求URI指定的资源所执行的方法。方法是大小写敏感的。



          Method         = "OPTIONS"                ; 第9.2节
                         | "GET"                    ; 第9.3节
                         | "HEAD"                   ; 第9.4节
                         | "POST"                   ; 第9.5节
                         | "PUT"                    ; 第9.6节
                         | "DELETE"                 ; 第9.7节
                         | "TRACE"                  ; 第9.8节
                         | extension-method

          extension-method = token
/#

   The list of methods allowed by a resource can be specified in an
   Allow header field (section 14.7). The return code of the response


   always notifies the client whether a method is currently allowed on

 a
   resource, since the set of allowed methods can change dynamically.


   Servers SHOULD return the status code 405 (Method Not Allowed) if t

he
   method is known by the server but not allowed for the requested
   resource, and 501 (Not Implemented) if the method is unrecognized o

r
   not implemented by the server. The list of methods known by a serve

r
   can be listed in a Public response-header field (section 14.35).

#  资源允许使用的方法在允许(Allow)头域中给出(见第14.7节),相应的返回码总


   通知客户程序是否对一个资源允许使用某个方法,因此允许的方法集能够动态

的改
   变。服务器在识别请求方法但请求的资源不允许使用该方法时应该返回405状

态码
   (方法不允许 Method Not Allowed),如果不能识别请求方法或服务器未实


   该方法时返回501状态码(未实现 Not Implemented)。服务器能够识别的方


   列表可以在公共响应头域(Public response-header)中给出(见第14.35节

)。
/#

   The methods GET and HEAD MUST be supported by all general-purpose
   servers. All other methods are optional; however, if the above
   methods are implemented, they MUST be implemented with the same
   semantics as those specified in section 9.

#  所有通用目的的服务器必须实现方法GET和HEAD,所有其他的方法都是可选的


   但如果实现了上面列出的方法,则方法的语义必须符合第9节的规定。
/#


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

[关闭][返回]