Fawkes API
Fawkes Development Version
|
Dynamic web reply. More...
#include <>>
Public Member Functions | |
DynamicWebReply (response_code_t code) | |
Constructor. More... | |
virtual size_t | chunk_size () |
Chunksize. More... | |
virtual size_t | size ()=0 |
Total size of the web reply. More... | |
virtual size_t | next_chunk (size_t pos, char *buffer, size_t buf_max_size)=0 |
Get data of next chunk. More... | |
![]() | |
WebReply (response_code_t code) | |
Constructor. More... | |
virtual | ~WebReply () |
Destructor. More... | |
response_code_t | code () const |
Get response code. More... | |
void | add_header (std::string header, std::string content) |
Add a HTTP header. More... | |
void | add_header (std::string header_string) |
Add a HTTP header. More... | |
const HeaderMap & | headers () const |
get headers. More... | |
Dynamic web reply.
A reply of this type is send out in chunks, not all as a whole. It should be used for payloads that can get very large, like file transfers.
fawkes::DynamicWebReply::DynamicWebReply | ( | response_code_t | code | ) |
|
virtual |
|
pure virtual |
Get data of next chunk.
pos | position in the stream. Note that a certain position may be called several times. |
buffer | buffer to store data in |
buf_max_size | maximum size in bytes of data that can be put into buffer |
Implemented in fawkes::DynamicFileWebReply.
Referenced by fawkes::dynamic_reply_data_cb().
|
pure virtual |
Total size of the web reply.
Return the total size of the reply if known, or 0 if it is not known. In the latter case your next_chunk() method has to return -1 at some point to end the transfer. If possible by any means return a meaningful value, as it will improve the experience of users, especially for long transfers!
Implemented in fawkes::DynamicFileWebReply.