HTTP 服务器的100 Continue处理规范

来源:互联网 发布:阿里云搭建个人网盘 编辑:程序博客网 时间:2024/05/19 09:39

服务器端,对于100 Continue的处理,比较复杂啦,国内又没什么文档,导致写WEB 服务器的脚步非常缓慢。现在觉得,一个好的程序员,除了精通编程语言本身外,还要精通英语。英文原文如下:

Requirements for HTTP/1.1 origin servers:

      - Upon receiving a request which includes an Expect request-header        field with the "100-continue" expectation, an origin server MUST        either respond with 100 (Continue) status and continue to read        from the input stream, or respond with a final status code. The        origin server MUST NOT wait for the request body before sending        the 100 (Continue) response. If it responds with a final status        code, it MAY close the transport connection or it MAY continue
        to read and discard the rest of the request.  It MUST NOT        perform the requested method if it returns a final status code.
      - An origin server SHOULD NOT send a 100 (Continue) response if        the request message does not include an Expect request-header        field with the "100-continue" expectation, and MUST NOT send a        100 (Continue) response if such a request comes from an HTTP/1.0        (or earlier) client. There is an exception to this rule: for        compatibility with RFC 2068, a server MAY send a 100 (Continue)        status in response to an HTTP/1.1 PUT or POST request that does        not include an Expect request-header field with the "100-        continue" expectation. This exception, the purpose of which is        to minimize any client processing delays associated with an        undeclared wait for 100 (Continue) status, applies only to        HTTP/1.1 requests, and not to requests with any other HTTP-        version value.
      - An origin server MAY omit a 100 (Continue) response if it has        already received some or all of the request body for the        corresponding request.
      - An origin server that sends a 100 (Continue) response MUST        ultimately send a final status code, once the request body is        received and processed, unless it terminates the transport        connection prematurely.
      - If an origin server receives a request that does not include an        Expect request-header field with the "100-continue" expectation,        the request includes a request body, and the server responds        with a final status code before reading the entire request body        from the transport connection, then the server SHOULD NOT close        the transport connection until it has read the entire request,        or until the client closes the connection. Otherwise, the client        might not reliably receive the response message. However, this        requirement is not be construed as preventing a server from        defending itself against denial-of-service attacks, or from        badly broken client implementations.
原创粉丝点击