Add buffer_response for return to client images from buffer#368
Add buffer_response for return to client images from buffer#368akrabad wants to merge 1 commit intoetr:masterfrom
Conversation
The existing string_response already supports binary content (std::string can hold arbitrary bytes), but this was not documented or demonstrated anywhere. This gap caused users to believe a new response type was needed (see PR #368). - Add a note to the README's string_response description clarifying binary data support - Add a new "Serving binary data from memory" section with inline example - Add examples/binary_buffer_response.cpp as a complete, buildable example that serves a PNG image from an in-memory buffer - Register the new example in examples/Makefile.am https://claude.ai/code/session_01S3BvBrSoNvUhpYTyhPYCjJ
|
Hi @akrabad, thank you for opening this PR and surfacing this use case! Serving binary data (like camera frames) directly from memory without disk I/O is a completely valid need. That said, the fact that this wasn’t obvious is entirely a documentation gap on our side — the docs and examples only ever showed text usage, so your assumption that a new class was needed was very reasonable. |
Description of the Change
libhttpserver can fill responce with image from file on disk. But not from buffer.
I read from camera jpeg file that stored in buffer. I don't want to save this file to disk and read from disk. To many read/write operations (>5 per/sec)
Possible Drawbacks
Nothing. Use template of nullptr 0 size byte response (if file on disk dosent exist)
Verification Process
Read data from camera. Store it to my buffer. And read from buffer if get request for image