Loading…
|
Translation changed |
|
|
String added in the repository |
|
Loading…
|
Translation changed |
|
|
String added in the repository |
|
While the parsers included in the library will handle a broad number of use-cases, the __basic_parser__ interface can be subclassed to implement custom strategies for storing parsed results: the basic parser processes input buffers into elements according to the HTTP/1 protocol specification, while the derived class decides what to do with those elements. Custom parsers will work with all of the HTTP stream read algorithms, as those algorithms use only the basic parser interface. Some use cases for implementing custom parsers are:虽然库自带的解析器能覆盖大部分常见场景,但通过继承 __basic_parser__ 接口,也可以实现自定义的解析结果存储策略。基本解析器负责按 HTTP/1 协议规范将输入缓冲区解析为各个元素,而派生类则决定如何处理这些元素。由于所有 HTTP 流读取算法都只依赖基本解析器接口,因此自定义解析器可以与它们协同工作。以下是一些可能需要实现自定义解析器的场景: