Loading…
|
Translation changed |
|
|
String added in the repository |
|
Loading…
|
Translation changed |
|
|
String added in the repository |
|
The请求中的 Expectfield with the value "100-continue" in a request is special. It indicates that the after sending the message header, a client desires an immediate informational response before sending the message body, which presumably may be expensive to compute or large. This behavior is described in [@https://tools.ietf.org/html/rfc7231#section-5.1.1 rfc7231 section 5.1.1]. Handling the Expect field can be implemented easily in a server by constructing a __parser__ to read the header first, then send an informational HTTP response, and finally read the body using the same parser instance. A synchronous version of this server action looks like this:字段若值为 `100-continue`,则具有特殊含义。它表示客户端在发送消息头部之后,希望在发送消息体之前立即收到一个信息性响应。这通常是因为消息体的计算开销较大或数据量较大。[@https://tools.ietf.org/html/rfc7231#section-5.1.1 rfc7231 第 5.1.1 节] 对此行为进行了详细说明。在服务器端处理 Expect 字段较为简单:先构造一个 __parser__ 读取头部,然后发送一个信息性 HTTP 响应,最后使用同一个解析器实例读取消息体。以下是一个同步版本的服务器实现: