-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: Make incremental HTTP reading as easy as incremental HTTP writing #2797
Comments
Could you please elaborate on how you can achieve the same functionality with the code in the last example? Do you want to call |
That could work if one doesn't mind the temporary memory usage. Perhaps, in those instances where one wants to discard the body, there could be a modifier in the parser that sets it to "discard mode". Or perhaps some new I should clarify that I'm not stuck and the approach provided in the incremental read example works for me. It's just that I noticed how much "cleaner" incremental writes are and wondered if the Beast API could be enhanced so that it's just as tidy for incremental reads. As the issue title suggests, this is suggestion for improvement and not a bug. Do with it as you wish. I will not feel offended if you don't deem it worthy of implementation and close this issue. |
You are right that the interface for incremental reading is a bit obtuse in Beast. This is a consequence of some design choices that weren't great. But it was the best I could do at the time. Changing this would require quite a bit of rethinking about how Beast works and I'm not so sure I want to invest in that since Beast is effectively in maintenance mode. |
I completely understand, having been down that road myself. Despite its warts, this library is still 10x better then what I could have written myself and has saved me countless hours of reinventing the wheel. Kudos to you and the other maintainers!
I was not aware of that (or I forgot). Since the library is in maintenance mode, I will close this issue, and a record will be kept for posterity in case a new Beast 2 is developed, or someone else writes a new C++ library that uses this one for inspiration. |
I ought to check those out and provide feedback now, instead of complaining years after their release like I'm doing now for Beast. 😁 |
They are still in development though, and probably will be for at least 2 years |
Having just implemented a variant of the HTTP incremental read example, I'm now implementing incremental HTTP writes and have noticed how much simpler and more intuitive it is for the latter.
For incremental reading, you have to use a
request_parser<buffer_body>
and set the body'sdata
andsize
attributes for every incremental read, which is clumsy and seems a little hackish to me:Notice the need for a separate
std::string actualBody
object because I am forced to userequest_parser<buffer_body>
instead ofrequest_parser<string_body>
.Compare that to incremental HTTP writing where the partial write size can be bounded via
serializer::limit
:It seems to me there should be a
parser::limit
function to make it symetrical withserializer::limit
. Incremental HTTP reading should be as simple as this:The text was updated successfully, but these errors were encountered: