23 #ifndef _LIBS_WEBVIEW_REPLY_H_ 24 #define _LIBS_WEBVIEW_REPLY_H_ 98 typedef std::map<std::string, std::string>
HeaderMap;
105 void add_header(
const std::string &header,
const std::string &content);
106 void add_header(
const std::string &header_string);
121 static bool caching_default_;
131 virtual size_t size() = 0;
132 virtual size_t next_chunk(
size_t pos,
char *buffer,
size_t buf_max_size) = 0;
144 virtual const std::string &
body();
const HeaderMap & headers() const
get headers.
void set_request(WebRequest *request)
Set associated request.
virtual size_t next_chunk(size_t pos, char *buffer, size_t buf_max_size)=0
Get data of next chunk.
virtual size_t chunk_size()
Chunksize.
virtual ~WebReply()
Destructor.
WebRequest * get_request() const
Get associated request.
virtual size_t size()=0
Total size of the web reply.
Fawkes library namespace.
DynamicWebReply(Code code)
Constructor.
WebReply(Code code)
Constructor.
std::string _body
Body of the reply.
BANDWIDTH_LIMIT_EXCEEDED.
virtual const std::string & body()
Get body.
NON_AUTHORITATIVE_INFORMATION.
Code code() const
Get response code.
HTTP_VERSION_NOT_SUPPORTED.
StaticWebReply(Code code, std::string body="")
Constructor.
void set_caching(bool caching)
Enable or disable caching for this specific reply.
WebReply * no_caching(WebReply *reply)
Disable caching on a reply.
REQUEST_ENTITY_TOO_LARGE.
static void set_caching_default(bool caching)
Enable or disable caching default for replies.
std::map< std::string, std::string > HeaderMap
Map of headers.
void set_code(Code code)
Set response code.
Web request meta data carrier.
void append_body(const char *format,...)
Append to body.
void add_header(const std::string &header, const std::string &content)
Add a HTTP header.
StaticWebReply & operator+=(std::string text)
Append simple text line.
virtual void pack()
Pack the data.
PROXY_AUTHENTICATION_REQUIRED.
REQUESTED_RANGE_NOT_SATISFIABLE.
virtual std::string::size_type body_length()
Get length of body.
void pack_caching()
Called just before the reply is sent.