Loading…
|
Translation changed |
|
|
String added in the repository |
|
Loading…
|
Translation changed |
|
|
String added in the repository |
|
In some cases, such as the handling of the在某些场景下(例如处理 [@https://tools.ietf.org/html/rfc7231#section-5.1.1 Expect: 100-continue]field, it may be desired to first serialize the header, perform some other action, and then continue with serialization of the body. This is accomplished by calling [link beast.ref.boost__beast__http__serializer.split `serializer::split`] with a boolean indicating that when buffers are produced, the last buffer containing serialized header octets will not contain any octets corresponding to the body. The function [link beast.ref.boost__beast__http__serializer.is_header_done `serializer::is_header_done`] informs the caller whether the header been serialized fully. In this C++14 example we print the header first, followed by the body:字段时),可能需要先序列化头部,执行某些其他操作,然后再继续序列化消息体。这可以通过调用 [link beast.ref.boost__beast__http__serializer.split `serializer::split`] 来实现,传入一个布尔值参数,指示在生成缓冲区时,包含序列化头部八位字节的最后一个缓冲区不应包含任何与消息体对应的八位字节。[link beast.ref.boost__beast__http__serializer.is_header_done `serializer::is_header_done`] 函数用于告知调用方头部是否已完全序列化。以下 C++14 示例先打印头部,再打印消息体: