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>
20 class cache_interface;
21 namespace impl {
namespace cgi {
class connection; }}
37 continue_transfer = 100,
38 switching_protocol = 101,
42 non_authoritative_information = 203,
45 partial_content = 206,
46 multiple_choices = 300,
47 moved_permanently = 301,
52 temporary_redirect = 307,
55 payment_required = 402,
58 method_not_allowed = 405,
60 proxy_authentication_required = 407,
61 request_time_out = 408,
64 precondition_failed = 412,
65 request_entity_too_large = 413,
66 request_uri_too_large = 414,
67 unsupported_media_type = 415,
68 requested_range_not_satisfiable = 416,
69 expectation_failed = 417,
70 internal_server_error = 500,
71 not_implemented = 501,
73 service_unavailable = 503,
74 gateway_timeout = 504,
75 http_version_not_supported = 505
102 void accept_ranges(std::string
const &);
106 void age(
unsigned seconds);
110 void allow(std::string
const &);
114 void cache_control(std::string
const &);
120 void content_encoding(std::string
const &);
124 void content_language(std::string
const &);
128 void content_length(
unsigned long long len);
132 void content_location(std::string
const &);
136 void content_md5(std::string
const &);
140 void content_range(std::string
const &);
152 void etag(std::string
const &);
156 void expires(time_t t);
160 void last_modified(time_t t);
164 void location(std::string
const &);
168 void pragma(std::string
const &);
172 void proxy_authenticate(std::string
const &);
176 void retry_after(std::string
const &);
180 void retry_after(
unsigned);
184 void status(
int code);
188 void status(
int code,std::string
const &
message);
192 void trailer(std::string
const &);
196 void transfer_encoding(std::string
const &);
200 void vary(std::string
const &);
204 void via(std::string
const &);
208 void warning(std::string
const &);
212 void www_authenticate(std::string
const &);
218 void set_header(std::string
const &name,std::string
const &value);
222 std::string get_header(std::string
const &name);
226 void erase_header(std::string
const &h);
232 void set_content_header(std::string
const &
content_type);
237 void set_html_header();
241 void set_xhtml_header();
245 void set_plain_text_header();
249 void set_redirect_header(std::string
const &location,
int status = found);
253 void set_cookie(
cookie const &);
260 void make_error_response(
int stat,std::string
const &msg = std::string());
265 io_mode_type io_mode();
271 void io_mode(io_mode_type);
287 static std::string make_http_time(time_t);
291 static char const *status_to_string(
int status);
297 bool some_output_was_written();
309 friend class impl::cgi::connection;
310 friend class ::cppcms::cache_interface;
312 void copy_to_cache();
313 std::string copied_data();
316 std::pair<char const *,size_t> output();
318 void write_http_headers(std::ostream &);
319 std::string get_async_chunk();
325 std::ostream *stream_;
326 io_mode_type io_mode_;
328 uint32_t disable_compression_ : 1;
329 uint32_t ostream_requested_ : 1;
330 uint32_t copy_to_cache_ : 1;
331 uint32_t finalized_ : 1;
332 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:84
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:45
this class represents all HTTP/CGI response related API, generation of output content and HTTP header...
Definition: http_response.h:31
basic_message< char > message
Definition: message.h:494
Same as normal but disable gzip compression.
Definition: http_response.h:85
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