8 #ifndef CPPCMS_HTTP_RESPONSE_H 9 #define CPPCMS_HTTP_RESPONSE_H 11 #include <cppcms/defs.h> 12 #include <booster/noncopyable.h> 13 #include <booster/hold_ptr.h> 14 #include <booster/system_error.h> 18 #include <cppcms/cstdint.h> 22 class cache_interface;
23 namespace impl {
namespace cgi {
class connection; }}
39 continue_transfer = 100,
40 switching_protocol = 101,
44 non_authoritative_information = 203,
47 partial_content = 206,
48 multiple_choices = 300,
49 moved_permanently = 301,
54 temporary_redirect = 307,
57 payment_required = 402,
60 method_not_allowed = 405,
62 proxy_authentication_required = 407,
63 request_time_out = 408,
66 precondition_failed = 412,
67 request_entity_too_large = 413,
68 request_uri_too_large = 414,
69 unsupported_media_type = 415,
70 requested_range_not_satisfiable = 416,
71 expectation_failed = 417,
72 internal_server_error = 500,
73 not_implemented = 501,
75 service_unavailable = 503,
76 gateway_timeout = 504,
77 http_version_not_supported = 505
104 void accept_ranges(std::string
const &);
108 void age(
unsigned seconds);
112 void allow(std::string
const &);
116 void cache_control(std::string
const &);
122 void content_encoding(std::string
const &);
126 void content_language(std::string
const &);
130 void content_length(
unsigned long long len);
134 void content_location(std::string
const &);
138 void content_md5(std::string
const &);
142 void content_range(std::string
const &);
154 void etag(std::string
const &);
158 void expires(time_t t);
162 void last_modified(time_t t);
166 void location(std::string
const &);
170 void pragma(std::string
const &);
174 void proxy_authenticate(std::string
const &);
178 void retry_after(std::string
const &);
182 void retry_after(
unsigned);
186 void status(
int code);
190 void status(
int code,std::string
const &
message);
194 void trailer(std::string
const &);
198 void vary(std::string
const &);
202 void via(std::string
const &);
206 void warning(std::string
const &);
210 void www_authenticate(std::string
const &);
216 void set_header(std::string
const &name,std::string
const &value);
220 std::string get_header(std::string
const &name);
224 void erase_header(std::string
const &h);
231 void add_header(std::string
const &name,std::string
const &value);
237 void set_content_header(std::string
const &
content_type);
242 void set_html_header();
246 void set_xhtml_header();
250 void set_plain_text_header();
254 void set_redirect_header(std::string
const &location,
int status = found);
258 void set_cookie(
cookie const &);
265 void make_error_response(
int stat,std::string
const &msg = std::string());
272 static void make_error_response_html_body(
int stat,std::ostream &out,std::string
const &msg = std::string());
277 io_mode_type io_mode();
283 void io_mode(io_mode_type);
299 static std::string make_http_time(time_t);
303 static char const *status_to_string(
int status);
309 bool some_output_was_written();
329 void setbuf(
int buffer_size);
342 void full_asynchronous_buffering(
bool enable);
348 bool full_asynchronous_buffering();
358 bool pending_blocked_output();
366 friend class cppcms::impl::cgi::connection;
369 void copy_to_cache();
370 std::string copied_data();
373 std::pair<char const *,size_t> output();
375 void write_http_headers();
377 int flush_async_chunk(booster::system::error_code &e);
383 std::ostream *stream_;
384 io_mode_type io_mode_;
386 uint32_t disable_compression_ : 1;
387 uint32_t ostream_requested_ : 1;
388 uint32_t copy_to_cache_ : 1;
389 uint32_t finalized_ : 1;
390 uint32_t reserved_ : 28;
std::ios_base & date(std::ios_base &ios)
Definition: formatting.h:319
Class that represents parsed Content-Type header, this is immutable class. Once it is created its val...
Definition: http_content_type.h:23
Synchronous IO. Write the request, it is buffered and possible compressed using gzip.
Definition: http_response.h:86
status_type
Definition: http_response.h:38
This is the namespace where all CppCMS functionality is placed.
Definition: application.h:19
context is a central class that holds all specific connection related information. It encapsulates CGI request and response, cache, session and locale information
Definition: http_context.h:47
io_mode_type
Definition: http_response.h:85
this class represents all HTTP/CGI response related API, generation of output content and HTTP header...
Definition: http_response.h:33
This class is the major gateway of the application to CppCMS caching abilities. Any access too cache ...
Definition: cache_interface.h:139
basic_message< char > message
Definition: message.h:494
Same as normal but disable gzip compression.
Definition: http_response.h:87
Class that represents single HTTP Cookie Generally used in context of http::request and http::respons...
Definition: http_cookie.h:27
This class makes impossible to copy any class derived from this one.
Definition: noncopyable.h:15