msgid ""
msgstr ""
"Project-Id-Version: English (Boost Beast Translation (zh_Hans))\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-06-07 13:36+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: English <https://insights.cppalliance.org/weblate/projects/"
"boost-beast-documentation-zh_Hans/doc-qbk-08-design-2-http-comparison-qbk/"
"en/>\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 2026.5\n"

#. type: section title
#: 10
#, read-only
msgid "HTTP Comparison to Other Libraries"
msgstr "HTTP Comparison to Other Libraries"

#. type: paragraph
#: 12
#, read-only
msgid ""
"There are a few C++ published libraries which implement some of the HTTP "
"protocol. We analyze the message model chosen by those libraries and discuss "
"the advantages and disadvantages relative to Beast."
msgstr ""
"There are a few C++ published libraries which implement some of the HTTP "
"protocol. We analyze the message model chosen by those libraries and discuss "
"the advantages and disadvantages relative to Beast."

#. type: paragraph
#: 16
#, read-only
msgid ""
"The general strategy used by the author to evaluate external libraries is as "
"follows:"
msgstr ""
"The general strategy used by the author to evaluate external libraries is as "
"follows:"

#. type: list
#: 19
#, read-only
msgid "* Review the message model. Can it represent a complete request or"
msgstr "* Review the message model. Can it represent a complete request or"

#. type: list
#: 23
#, read-only
msgid "* Review the stream abstraction. This is the type of object, such as"
msgstr "* Review the stream abstraction. This is the type of object, such as"

#. type: list
#: 28
#, read-only
msgid "* Check treatment of buffers. Does the library manage the buffers"
msgstr "* Check treatment of buffers. Does the library manage the buffers"

#. type: list
#: 31
#, read-only
msgid "* How does the library handle corner cases such as trailers,"
msgstr "* How does the library handle corner cases such as trailers,"

#. type: paragraph
#: 35
#, read-only
msgid "Declarations examples from external libraries have been edited:"
msgstr "Declarations examples from external libraries have been edited:"

#. type: heading
#: 41
#, read-only
msgid "cpp-netlib"
msgstr "cpp-netlib"

#. type: paragraph
#: 44
#, read-only
msgid ""
"is a network programming library previously intended for Boost but not "
"having gone through formal review. As of this writing it still uses the "
"Boost name, namespace, and directory structure although the project states "
"that Boost acceptance is no longer a goal. The library is based on "
"Boost.Asio and bills itself as ['\"a collection of network related routines/"
"implementations geared towards providing a robust cross-platform networking "
"library\"]. It cites ['\"Common Message Type\"] as a feature. As of the "
"branch previous linked, it uses these declarations: ``` template <class Tag> "
"struct basic_message {"
msgstr ""
"is a network programming library previously intended for Boost but not "
"having gone through formal review. As of this writing it still uses the "
"Boost name, namespace, and directory structure although the project states "
"that Boost acceptance is no longer a goal. The library is based on "
"Boost.Asio and bills itself as ['\"a collection of network related routines/"
"implementations geared towards providing a robust cross-platform networking "
"library\"]. It cites ['\"Common Message Type\"] as a feature. As of the "
"branch previous linked, it uses these declarations: ``` template <class Tag> "
"struct basic_message {"

#. type: paragraph
#: 82
#, read-only
msgctxt "82"
msgid "}; ```"
msgstr "}; ```"

#. type: paragraph
#: 85
#, read-only
msgid ""
"This container is the base class template used to represent HTTP messages. "
"It uses a \"tag\" type style specializations for a variety of trait classes, "
"allowing for customization of the various parts of the message. For example, "
"a user specializes `headers_container<T>` to determine what container type "
"holds the header fields. We note some problems with the container "
"declaration:"
msgstr ""
"This container is the base class template used to represent HTTP messages. "
"It uses a \"tag\" type style specializations for a variety of trait classes, "
"allowing for customization of the various parts of the message. For example, "
"a user specializes `headers_container<T>` to determine what container type "
"holds the header fields. We note some problems with the container "
"declaration:"

#. type: list
#: 91
#, read-only
msgid "* The header and body containers may only be default-constructed."
msgstr "* The header and body containers may only be default-constructed."

#. type: list
#: 93
#, read-only
msgid "* No stateful allocator support."
msgstr "* No stateful allocator support."

#. type: list
#: 95
#, read-only
msgid "* There is no way to defer the commitment of the type for `body_` to"
msgstr "* There is no way to defer the commitment of the type for `body_` to"

#. type: list
#: 98
#, read-only
msgid "* The message model includes a \"source\" and \"destination.\" This is"
msgstr "* The message model includes a \"source\" and \"destination.\" This is"

#. type: list
#: 102
#, read-only
msgid "* The use of `string_type` (a customization point) for source,"
msgstr "* The use of `string_type` (a customization point) for source,"

#. type: list
#: 112
#, read-only
msgid "* The library uses specializations of `string<Tag>` to change the type"
msgstr "* The library uses specializations of `string<Tag>` to change the type"

#. type: list
#: 121
#, read-only
msgid "* The specialized trait classes generate a proliferation of small"
msgstr "* The specialized trait classes generate a proliferation of small"

#. type: list
#: 127
#, read-only
msgid ""
"* The `string<Tag> customization point constrains user defined body types"
msgstr ""
"* The `string<Tag> customization point constrains user defined body types"

#. type: paragraph
#: 132
#, read-only
msgid ""
"The design of the message container in this library is cumbersome with its "
"system of customization using trait specializations. The use of these "
"customizations is extremely limited due to the way they are used in the "
"container declaration, making the design overly complex without "
"corresponding benefit."
msgstr ""
"The design of the message container in this library is cumbersome with its "
"system of customization using trait specializations. The use of these "
"customizations is extremely limited due to the way they are used in the "
"container declaration, making the design overly complex without "
"corresponding benefit."

#. type: heading
#: 140
#, read-only
msgid "Boost.HTTP"
msgstr "Boost.HTTP"

#. type: paragraph
#: 143
#, read-only
msgid ""
"is a library resulting from the 2014 Google Summer of Code. It was submitted "
"for a Boost formal review and rejected in 2015. It is based on Boost.Asio, "
"and development on the library has continued to the present. As of the "
"branch previously linked, it uses these message declarations: ``` "
"template<class Headers, class Body> struct basic_message {"
msgstr ""
"is a library resulting from the 2014 Google Summer of Code. It was submitted "
"for a Boost formal review and rejected in 2015. It is based on Boost.Asio, "
"and development on the library has continued to the present. As of the "
"branch previously linked, it uses these message declarations: ``` "
"template<class Headers, class Body> struct basic_message {"

#. type: paragraph
#: 166
#, read-only
msgctxt "166"
msgid "private:"
msgstr "private:"

#. type: paragraph
#: 170
#, read-only
msgctxt "170"
msgid "};"
msgstr "};"

#. type: paragraph
#: 172
#, read-only
msgid ""
"typedef basic_message<boost::http::headers, std::vector<std::uint8_t>> "
"message;"
msgstr ""
"typedef basic_message<boost::http::headers, std::vector<std::uint8_t>> "
"message;"

#. type: paragraph
#: 174
#, read-only
msgid ""
"template<class Headers, class Body> struct is_message<basic_message<Headers, "
"Body>>: public std::true_type {}; ```"
msgstr ""
"template<class Headers, class Body> struct is_message<basic_message<Headers, "
"Body>>: public std::true_type {}; ```"

#. type: list
#: 178
#, read-only
msgid ""
"* This container cannot model a complete message. The ['start-line] items"
msgstr ""
"* This container cannot model a complete message. The ['start-line] items"

#. type: list
#: 193
#, read-only
msgid "* `headers_`, `body_`, and `trailers_` may only be default-constructed,"
msgstr "* `headers_`, `body_`, and `trailers_` may only be default-constructed,"

#. type: list
#: 196
#, read-only
msgid "* There is no way to defer the commitment of the [*Body] type to after"
msgstr "* There is no way to defer the commitment of the [*Body] type to after"

#. type: list
#: 200
#, read-only
msgid ""
"* No stateful allocator support. This follows from the previous limitation"
msgstr ""
"* No stateful allocator support. This follows from the previous limitation"

#. type: list
#: 204
#, read-only
msgid ""
"* The trailers are stored in a separate object. Aside from the combinatorial"
msgstr ""
"* The trailers are stored in a separate object. Aside from the combinatorial"

#. type: list
#: 212
#, read-only
msgid "* The declarations imply that `std::vector` is a model of [*Body]."
msgstr "* The declarations imply that `std::vector` is a model of [*Body]."

#. type: list
#: 223
#, read-only
msgid "* The [*Body] customization point constrains user defined types to"
msgstr "* The [*Body] customization point constrains user defined types to"

#. type: paragraph
#: 228
#, read-only
msgid ""
"This representation addresses a narrow range of  use cases. It has limited "
"potential for customization and performance. It is more difficult to use "
"because it excludes the start line fields from the model."
msgstr ""
"This representation addresses a narrow range of  use cases. It has limited "
"potential for customization and performance. It is more difficult to use "
"because it excludes the start line fields from the model."

#. type: heading
#: 234
#, read-only
msgid "C++ REST SDK (cpprestsdk)"
msgstr "C++ REST SDK (cpprestsdk)"

#. type: paragraph
#: 237
#, read-only
msgid ""
"is a Microsoft project which ['\"...aims to help C++ developers connect to "
"and interact with services\"]. It offers the most functionality of the "
"libraries reviewed here, including support for Websocket services using its "
"websocket++ dependency. It can use native APIs such as HTTP.SYS when "
"building Windows based applications, and it can use Boost.Asio. The "
"WebSocket module uses Boost.Asio exclusively."
msgstr ""
"is a Microsoft project which ['\"...aims to help C++ developers connect to "
"and interact with services\"]. It offers the most functionality of the "
"libraries reviewed here, including support for Websocket services using its "
"websocket++ dependency. It can use native APIs such as HTTP.SYS when "
"building Windows based applications, and it can use Boost.Asio. The "
"WebSocket module uses Boost.Asio exclusively."

#. type: paragraph
#: 244
#, read-only
msgid ""
"As cpprestsdk is developed by a large corporation, it contains quite a bit "
"of functionality and necessarily has more interfaces. We will break down the "
"interfaces used to model messages into more manageable pieces. This is the "
"container used to store the HTTP header fields: ``` class http_headers { "
"public:"
msgstr ""
"As cpprestsdk is developed by a large corporation, it contains quite a bit "
"of functionality and necessarily has more interfaces. We will break down the "
"interfaces used to model messages into more manageable pieces. This is the "
"container used to store the HTTP header fields: ``` class http_headers { "
"public:"

#. type: paragraph
#: 254
#, read-only
msgctxt "254"
msgid "private:"
msgstr "private:"

#. type: paragraph
#: 256
#, read-only
msgctxt "256"
msgid "}; ```"
msgstr "}; ```"

#. type: paragraph
#: 259
#, read-only
msgid ""
"This declaration is quite bare-bones. We note the typical problems of most "
"field containers:"
msgstr ""
"This declaration is quite bare-bones. We note the typical problems of most "
"field containers:"

#. type: list
#: 262
#, read-only
msgid "* The container may only be default-constructed."
msgstr "* The container may only be default-constructed."

#. type: list
#: 264
#, read-only
msgid "* No support for allocators, stateful or otherwise."
msgstr "* No support for allocators, stateful or otherwise."

#. type: list
#: 266
#, read-only
msgid "* There are no customization points at all."
msgstr "* There are no customization points at all."

#. type: paragraph
#: 268
#, read-only
msgid ""
"Now we analyze the structure of the larger message container. The library "
"uses a handle/body idiom. There are two public message container interfaces, "
"one for requests (`http_request`) and one for responses (`http_response`). "
"Each interface maintains a private shared pointer to an implementation "
"class. Public member function calls are routed to the internal "
"implementation. This is the first implementation class, which forms the base "
"class for both the request and response implementations: ``` namespace "
"details {"
msgstr ""
"Now we analyze the structure of the larger message container. The library "
"uses a handle/body idiom. There are two public message container interfaces, "
"one for requests (`http_request`) and one for responses (`http_response`). "
"Each interface maintains a private shared pointer to an implementation "
"class. Public member function calls are routed to the internal "
"implementation. This is the first implementation class, which forms the base "
"class for both the request and response implementations: ``` namespace "
"details {"

#. type: paragraph
#: 279
#, read-only
msgid "class http_msg_base { public:"
msgstr "class http_msg_base { public:"

#. type: paragraph
#: 294
#, read-only
msgid "protected:"
msgstr "protected:"

#. type: paragraph
#: 306
#, read-only
msgctxt "306"
msgid "}; ```"
msgstr "}; ```"

#. type: paragraph
#: 309
#, read-only
msgid ""
"To understand these declarations we need to first understand that cpprestsdk "
"uses the asynchronous model defined by Microsoft's [@https://"
"msdn.microsoft.com/en-us/library/dd504870.aspx [*Concurrency Runtime]]. "
"Identifiers from the [@https://msdn.microsoft.com/en-us/library/"
"jj987780.aspx [*`pplx` namespace]] define common asynchronous patterns such "
"as tasks and events. The `concurrency::streams::istream` parameter and "
"`m_data_available` data member indicates a lack of separation of concerns. "
"The representation of HTTP messages should not be conflated with the "
"asynchronous model used to serialize or parse those messages in the message "
"declarations."
msgstr ""
"To understand these declarations we need to first understand that cpprestsdk "
"uses the asynchronous model defined by Microsoft's [@https://"
"msdn.microsoft.com/en-us/library/dd504870.aspx [*Concurrency Runtime]]. "
"Identifiers from the [@https://msdn.microsoft.com/en-us/library/"
"jj987780.aspx [*`pplx` namespace]] define common asynchronous patterns such "
"as tasks and events. The `concurrency::streams::istream` parameter and "
"`m_data_available` data member indicates a lack of separation of concerns. "
"The representation of HTTP messages should not be conflated with the "
"asynchronous model used to serialize or parse those messages in the message "
"declarations."

#. type: paragraph
#: 319
#, read-only
msgid ""
"The next declaration forms the complete implementation class referenced by "
"the handle in the public interface (which follows after): ``` /// Internal "
"representation of an HTTP request message. class _http_request final : "
"public http::details::http_msg_base, public "
"std::enable_shared_from_this<_http_request> { public:"
msgstr ""
"The next declaration forms the complete implementation class referenced by "
"the handle in the public interface (which follows after): ``` /// Internal "
"representation of an HTTP request message. class _http_request final : "
"public http::details::http_msg_base, public "
"std::enable_shared_from_this<_http_request> { public:"

#. type: paragraph
#: 336
#, read-only
msgctxt "336"
msgid "private:"
msgstr "private:"

#. type: paragraph
#: 344
#, read-only
msgctxt "344"
msgid "};"
msgstr "};"

#. type: paragraph
#: 346
#, read-only
msgid "} // namespace details ```"
msgstr "} // namespace details ```"

#. type: paragraph
#: 349
#, read-only
msgid ""
"As before, we note that the implementation class for HTTP requests concerns "
"itself more with the mechanics of sending the message asynchronously than it "
"does with actually modeling the HTTP message as described in __rfc7230__:"
msgstr ""
"As before, we note that the implementation class for HTTP requests concerns "
"itself more with the mechanics of sending the message asynchronously than it "
"does with actually modeling the HTTP message as described in __rfc7230__:"

#. type: list
#: 353
#, read-only
msgid ""
"* The constructor accepting "
"`std::unique_ptr<http::details::_http_server_context`"
msgstr ""
"* The constructor accepting "
"`std::unique_ptr<http::details::_http_server_context`"

#. type: list
#: 357
#, read-only
msgid ""
"* The \"cancellation token\" is stored inside the message. This breaks the"
msgstr ""
"* The \"cancellation token\" is stored inside the message. This breaks the"

#. type: list
#: 360
#, read-only
msgid ""
"* The `_reply_impl` function implies that the message implementation also"
msgstr ""
"* The `_reply_impl` function implies that the message implementation also"

#. type: paragraph
#: 364
#, read-only
msgid ""
"Finally, here is the public class which represents an HTTP request: ``` "
"class http_request { public:"
msgstr ""
"Finally, here is the public class which represents an HTTP request: ``` "
"class http_request { public:"

#. type: paragraph
#: 407
#, read-only
msgctxt "407"
msgid "private:"
msgstr "private:"

#. type: paragraph
#: 412
#, read-only
msgctxt "412"
msgid "}; ```"
msgstr "}; ```"

#. type: paragraph
#: 415
#, read-only
msgid ""
"It is clear from this declaration that the goal of the message model in this "
"library is driven by its use-case (interacting with REST servers) and not to "
"model HTTP messages generally. We note problems similar to the other "
"declarations:"
msgstr ""
"It is clear from this declaration that the goal of the message model in this "
"library is driven by its use-case (interacting with REST servers) and not to "
"model HTTP messages generally. We note problems similar to the other "
"declarations:"

#. type: list
#: 420
#, read-only
msgid "* There are no compile-time customization points at all. The only"
msgstr "* There are no compile-time customization points at all. The only"

#. type: list
#: 426
#, read-only
msgid "* The extraction of the body is conflated with the asynchronous model."
msgstr "* The extraction of the body is conflated with the asynchronous model."

#. type: list
#: 428
#, read-only
msgid "* No way to define an allocator for the container used when extracting"
msgstr "* No way to define an allocator for the container used when extracting"

#. type: list
#: 431
#, read-only
msgid "* A body can only be extracted once, limiting the use of this container"
msgstr "* A body can only be extracted once, limiting the use of this container"

#. type: list
#: 434
#, read-only
msgid ""
"* Setting the body requires either a vector or a "
"`concurrency::streams::istream`."
msgstr ""
"* Setting the body requires either a vector or a "
"`concurrency::streams::istream`."

#. type: list
#: 437
#, read-only
msgid "* The HTTP request container conflates HTTP response behavior (see the"
msgstr "* The HTTP request container conflates HTTP response behavior (see the"

#. type: paragraph
#: 442
#, read-only
msgid ""
"The general theme of the HTTP message model in cpprestsdk is \"no user "
"definable customizations\". There is no allocator support, and no separation "
"of concerns. It is designed to perform a specific set of behaviors. In other "
"words, it does not follow the open/closed principle."
msgstr ""
"The general theme of the HTTP message model in cpprestsdk is \"no user "
"definable customizations\". There is no allocator support, and no separation "
"of concerns. It is designed to perform a specific set of behaviors. In other "
"words, it does not follow the open/closed principle."

#. type: paragraph
#: 447
#, read-only
msgid ""
"Tasks in the Concurrency Runtime operate in a fashion similar to "
"`std::future`, but with some improvements such as continuations which are "
"not yet in the C++ standard. The costs of using a task based asynchronous "
"interface instead of completion handlers is well documented: synchronization "
"points along the call chain of composed task operations which cannot be "
"optimized away. See: [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/"
"2013/n3747.pdf [*A Universal Model for Asynchronous Operations]] (Kohlhoff)."
msgstr ""
"Tasks in the Concurrency Runtime operate in a fashion similar to "
"`std::future`, but with some improvements such as continuations which are "
"not yet in the C++ standard. The costs of using a task based asynchronous "
"interface instead of completion handlers is well documented: synchronization "
"points along the call chain of composed task operations which cannot be "
"optimized away. See: [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/"
"2013/n3747.pdf [*A Universal Model for Asynchronous Operations]] (Kohlhoff)."
