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> 17 #include <cppcms/cstdint.h> 25 class cache_interface;
26 namespace impl {
namespace cgi {
class connection; }}
42 continue_transfer = 100,
43 switching_protocol = 101,
47 non_authoritative_information = 203,
50 partial_content = 206,
51 multiple_choices = 300,
52 moved_permanently = 301,
57 temporary_redirect = 307,
60 payment_required = 402,
63 method_not_allowed = 405,
65 proxy_authentication_required = 407,
66 request_time_out = 408,
69 precondition_failed = 412,
70 request_entity_too_large = 413,
71 request_uri_too_large = 414,
72 unsupported_media_type = 415,
73 requested_range_not_satisfiable = 416,
74 expectation_failed = 417,
75 internal_server_error = 500,
76 not_implemented = 501,
78 service_unavailable = 503,
79 gateway_timeout = 504,
80 http_version_not_supported = 505
107 void accept_ranges(std::string
const &);
111 void age(
unsigned seconds);
115 void allow(std::string
const &);
119 void cache_control(std::string
const &);
125 void content_encoding(std::string
const &);
129 void content_language(std::string
const &);
133 void content_length(
unsigned long long len);
137 void content_location(std::string
const &);
141 void content_md5(std::string
const &);
145 void content_range(std::string
const &);
157 void etag(std::string
const &);
161 void expires(time_t t);
165 void last_modified(time_t t);
169 void location(std::string
const &);
173 void pragma(std::string
const &);
177 void proxy_authenticate(std::string
const &);
181 void retry_after(std::string
const &);
185 void retry_after(
unsigned);
189 void status(
int code);
193 void status(
int code,std::string
const &
message);
197 void trailer(std::string
const &);
201 void transfer_encoding(std::string
const &);
205 void vary(std::string
const &);
209 void via(std::string
const &);
213 void warning(std::string
const &);
217 void www_authenticate(std::string
const &);
223 void set_header(std::string
const &name,std::string
const &value);
227 std::string get_header(std::string
const &name);
231 void erase_header(std::string
const &h);
238 void add_header(std::string
const &name,std::string
const &value);
244 void set_content_header(std::string
const &
content_type);
249 void set_html_header();
253 void set_xhtml_header();
257 void set_plain_text_header();
261 void set_redirect_header(std::string
const &location,
int status = found);
265 void set_cookie(
cookie const &);
272 void make_error_response(
int stat,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 impl::cgi::connection;
367 friend class ::cppcms::cache_interface;
369 void copy_to_cache();
370 std::string copied_data();
373 std::pair<char const *,size_t> output();
375 void write_http_headers(std::ostream &);
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:89
status_type
Definition: http_response.h:41
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
The lightweight object that carries a error code information and its category.
Definition: system_error.h:83
io_mode_type
Definition: http_response.h:88
this class represents all HTTP/CGI response related API, generation of output content and HTTP header...
Definition: http_response.h:36
basic_message< char > message
Definition: message.h:494
Booster library namespace. The library that implements Boost Like API in ABI backward compatible way...
Definition: application.h:23
Same as normal but disable gzip compression.
Definition: http_response.h:90
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