发信人: kenmlee()
整理人: kenmlee(2000-07-08 16:49:28), 站内信件
|
6 Response
#6 响应 /#
After receiving and interpreting a request message, a server respon
ds
with an HTTP response message.
Response = Status-Line ; Section 6.1
*( general-header ; Section 4.5
| response-header ; Section 6.2
| entity-header ) ; Section 7.1
CRLF
[ message-body ] ; Section 7.2
# 接收并解析请求消息后,服务器用HTTP响应消息做出回应。
Response = Status-Line ; 第6.1节
*( general-header ; 第4.5节
| response-header ; 第6.2节
| entity-header ) ; 第7.1节
CRLF
[ message-body ] ; 第7.2节
/#
6.1 Status-Line
#6.1 状态行 /#
The first line of a Response message is the Status-Line, consisting
of the protocol version followed by a numeric status code and its
associated textual phrase, with each element separated by SP
characters. No CR or LF is allowed except in the final CRLF
sequence.
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
# 响应消息的第一行是状态行,由协议版本号,数字状态码及其相关文本内容,
各元素
间用SP分割。出最后的CRLF序列外不能使用CR或LF。
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
/#
6.1.1 Status Code and Reason Phrase
#6.1.1 状态码和解释文本 /#
The Status-Code element is a 3-digit integer result code of the
attempt to understand and satisfy the request. These codes are full
y
defined in section 10. The Reason-Phrase is intended to give a shor
t
textual description of the Status-Code. The Status-Code is intended
for use by automata and the Reason-Phrase is intended for the human
user. The client is not required to examine or display the Reason-
Phrase.
# 状态码是3位数字整数指出对请求试图理解和满足的结果码,第10节定义了这
些代码。
解释文本用于给出状态码的简短的文本解释。状态码用于自动处理而解释文本
用于人
的阅读。客户程序不要求检查或显示解释文本。
/#
The first digit of the Status-Code defines the class of response. T
he
last two digits do not have any categorization role. There are 5
values for the first digit:
o 1xx: Informational - Request received, continuing process
o 2xx: Success - The action was successfully received, understoo
d,
and accepted
o 3xx: Redirection - Further action must be taken in order to
complete the request
o 4xx: Client Error - The request contains bad syntax or cannot
be
fulfilled
o 5xx: Server Error - The server failed to fulfill an apparently
valid request
# 状态码的第一个数字定义了相应所属的类,后两个数字不具有分类的作用,第
一个数字
共有5个值:
o 1xx: Informational - 请求被接受,继续下一步处理
o 2xx: Success - 请求行为已成功收到,理解和接受
o 3xx: Redirection - 为完成请求必须接着接受下一个行为
o 4xx: Client Error - 请求语法错或不能实现
o 5xx: Server Error - 合法的请求但无法被服务器完成
/#
The individual values of the numeric status codes defined for
HTTP/1.1, and an example set of corresponding Reason-Phrase's, are
presented below. The reason phrases listed here are only recommende
d
-- they may be replaced by local equivalents without affecting the
protocol.
# 下面给出HTTP/1.1定义的数字状态码的值和解释文本的例子。解释文本只是建
议性的
-- 它可以在不影响协议的情况下被类似局部化内容取代。
/#
Status-Code = "100" ; Continue
| "101" ; Switching Protocols
| "200" ; OK
| "201" ; Created
| "202" ; Accepted
| "203" ; Non-Authoritative Information
| "204" ; No Content
| "205" ; Reset Content
| "206" ; Partial Content
| "300" ; Multiple Choices
| "301" ; Moved Permanently
| "302" ; Moved Temporarily
| "303" ; See Other
| "304" ; Not Modified
| "305" ; Use Proxy
| "400" ; Bad Request
| "401" ; Unauthorized
| "402" ; Payment Required
| "403" ; Forbidden
| "404" ; Not Found
| "405" ; Method Not Allowed
| "406" ; Not Acceptable
| "407" ; Proxy Authentication Required
| "408" ; Request Time-out
| "409" ; Conflict
| "410" ; Gone
| "411" ; Length Required
| "412" ; Precondition Failed
| "413" ; Request Entity Too Large
| "414" ; Request-URI Too Large
| "415" ; Unsupported Media Type
| "500" ; Internal Server Error
| "501" ; Not Implemented
| "502" ; Bad Gateway
| "503" ; Service Unavailable
| "504" ; Gateway Time-out
| "505" ; HTTP Version not supported
| extension-code
extension-code = 3DIGIT
Reason-Phrase = *<TEXT, excluding CR, LF>
# Status-Code = "100" ; Continue
| "101" ; Switching Protocols
| "200" ; OK
| "201" ; Created
| "202" ; Accepted
| "203" ; Non-Authoritative Information
| "204" ; No Content
| "205" ; Reset Content
| "206" ; Partial Content
| "300" ; Multiple Choices
| "301" ; Moved Permanently
| "302" ; Moved Temporarily
| "303" ; See Other
| "304" ; Not Modified
| "305" ; Use Proxy
| "400" ; Bad Request
| "401" ; Unauthorized
| "402" ; Payment Required
| "403" ; Forbidden
| "404" ; Not Found
| "405" ; Method Not Allowed
| "406" ; Not Acceptable
| "407" ; Proxy Authentication Required
| "408" ; Request Time-out
| "409" ; Conflict
| "410" ; Gone
| "411" ; Length Required
| "412" ; Precondition Failed
| "413" ; Request Entity Too Large
| "414" ; Request-URI Too Large
| "415" ; Unsupported Media Type
| "500" ; Internal Server Error
| "501" ; Not Implemented
| "502" ; Bad Gateway
| "503" ; Service Unavailable
| "504" ; Gateway Time-out
| "505" ; HTTP Version not supported
| extension-code
extension-code = 3DIGIT
Reason-Phrase = *<TEXT, 不包括 CR, LF>
/#
HTTP status codes are extensible. HTTP applications are not require
d
to understand the meaning of all registered status codes, though su
ch
understanding is obviously desirable. However, applications MUST
understand the class of any status code, as indicated by the first
digit, and treat any unrecognized response as being equivalent to t
he
x00 status code of that class, with the exception that an
unrecognized response MUST NOT be cached. For example, if an
unrecognized status code of 431 is received by the client, it can
safely assume that there was something wrong with its request and
treat the response as if it had received a 400 status code. In such
cases, user agents SHOULD present to the user the entity returned
with the response, since that entity is likely to include human-
readable information which will explain the unusual status.
# HTTP状态码是可扩展的,HTTP应用程序不要求理解所有注册状态码的意义,但
最好能够
做到。但是应用程序必须理解任何状态码的分类,由第一个数字定义,并且对
任何不能
识别的响应认为它是与相应类的x00状态码相同的,除了一定不能对这类响应
缓存外。
例如,如果客户程序接收到一个不能识别的状态码431,它可以认为它的请求
有错误并且
像接收到400状态码一样处理这个响应。在这种情况下,用户代理应该给用户
显示返回的
响应中的实体,因为这个实体可能包含人们可以阅读的关于这个实体的信息,
它解释了
这个不常用的状态的意义。
/#
-- ※ 修改:.kenmlee 于 Jul 8 16:37:47 修改本文.[FROM: 61.140.188.222] ※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 61.140.188.222]
|
|