23 #include <webview/reply.h> 25 #include <core/exception.h> 74 __headers[header] = content;
84 std::string::size_type pos;
85 if ((pos = header_string.find(
":")) != std::string::npos) {
86 std::string header = header_string.substr(0, pos);
88 if (header_string[pos+1] ==
' ') {
89 content = header_string.substr(pos+2);
91 content = header_string.substr(pos+1);
93 __headers[header] = content;
95 throw Exception(
"Invalid header '%s'", header_string.c_str());
182 va_start(args, format);
184 if ( vasprintf(&s, format, args) != -1 ) {
217 std::string::size_type
220 return _body.length();
WebReply(response_code_t code)
Constructor.
DynamicWebReply(response_code_t code)
Constructor.
virtual size_t chunk_size()
Chunksize.
virtual ~WebReply()
Destructor.
Fawkes library namespace.
StaticWebReply(response_code_t code, std::string body="")
Constructor.
void add_header(std::string header, std::string content)
Add a HTTP header.
std::string _body
Body of the reply.
virtual const std::string & body()
Get body.
Base class for exceptions in Fawkes.
std::map< std::string, std::string > HeaderMap
Map of headers.
response_code_t
HTTP response code.
const HeaderMap & headers() const
get headers.
void append_body(const char *format,...)
Append to body.
StaticWebReply & operator+=(std::string text)
Append simple text line.
virtual void pack()
Pack the data.
virtual std::string::size_type body_length()
Get length of body.
response_code_t code() const
Get response code.