2017-10-13 16:24 GMT-03:00 Vinnie Falco via Boost
<https://github.com/boostorg/beast/blob/f09b2d3e1c9d383e5d0f 57b1bf889568cf27c39f/include/boost/beast/http/parser.hpp#L45>
Callbacks don't need to store state used by subsequent callbacks to interpret the incoming structured HTTP data, because HTTP is simple compared to XML or HTML.
Half-truth. Indeed, there is no need to store state to interpret incoming structured HTTP data, but we still may need to store state between one call and another. This was just the case in the previous example I gave you. Given the nature of the project Tufão using Qt, I have this thing called "safe signals": http://vinipsmaker.github.io/tufao/ref/1.x/safe-signal.html This safe signal of mine forbid me to access the object after I emit a signal. So I have to parse the whole received data before emitting any signal. What happens is... in the example I gave earlier, Boost.Beast parser will force me to have state inside the object itself: https://github.com/vinipsmaker/tufao/blob/56e27d3b77d617ad1b4aea377f9935 92bc2c0d77/src/httpserverrequest.cpp#L134 If you compare to the usage of Boost.Http parser, it's different: https://github.com/vinipsmaker/tufao/blob/1d7a943e4f6aae2284045f94e2b821 4a142dea9a/src/httpserverrequest.cpp#L135 (a local variable that only exists when it needs to) You should be more humble[1] about the user needs and wants or you'll limit the potential usefulness of your library. Therefore, when designing an HTTP parser we can place
less emphasis on the style of parser and instead focus those energies to other considerations
My project Tufão couldn't care less about the other stuff you grab from ASIO that you're trying to convert into the focus of the discussion. It's a Qt project and Qt networking is used. That's just the motivation for your separate submission (as users requested abstractions to parse HTTP without ASIO from the review comments). And I still find disappointing that I still need to show specific/concrete cases. [1] https://en.wikipedia.org/wiki/There_are_known_knowns -- Vinícius dos Santos Oliveira https://vinipsmaker.github.io/