34 #ifndef SEASTAR_MODULE
35 #include <unordered_map>
37 #include <seastar/core/sstring.hh>
38 #include <seastar/http/mime_types.hh>
39 #include <seastar/core/iostream.hh>
40 #include <seastar/util/noncopyable_function.hh>
41 #include <seastar/util/modules.hh>
42 #include <seastar/util/string_utils.hh>
46 SEASTAR_MODULE_EXPORT_BEGIN
73 partial_content = 206,
111 std::unordered_map<sstring, sstring, seastar::internal::case_insensitive_hash, seastar::internal::case_insensitive_cmp>
_headers;
118 size_t content_length = 0;
120 sstring _response_line;
121 std::unordered_map<sstring, sstring> trailing_headers;
122 std::unordered_map<sstring, sstring> chunk_extensions;
128 reply& add_header(
const sstring& h,
const sstring& value) {
146 reply& set_version(
const sstring& version) {
151 reply& set_status(
status_type status, sstring content =
"") {
174 set_mime_type(http::mime_types::extension_to_type(content_type));
178 reply&
done(
const sstring& content_type) {
186 _response_line = response_line();
189 sstring response_line();
218 void write_body(
const sstring& content_type, sstring content);
234 using reply [[deprecated(
"Use http::reply instead")]] =
http::reply;
237 SEASTAR_MODULE_EXPORT_END
240 #if FMT_VERSION >= 90000
241 template <>
struct fmt::formatter<
seastar::http::reply::status_type> : fmt::ostream_formatter {};
Seastar API namespace.
Definition: abort_on_ebadf.hh:26
Definition: noncopyable_function.hh:37
void write_body(const sstring &content_type, noncopyable_function< future<>(output_stream< char > &&)> &&body_writer)
use an output stream to write the message body
std::unordered_map< sstring, sstring, seastar::internal::case_insensitive_hash, seastar::internal::case_insensitive_cmp > _headers
Definition: reply.hh:111
sstring get_header(const sstring &name) const
Definition: reply.hh:138
status_type
Definition: reply.hh:64
@ temporary_redirect
temporary_redirect
@ reset_content
reset_content
@ unprocessable_entity
unprocessable_entity
@ moved_temporarily
moved_temporarily
@ upgrade_required
upgrade_required
@ unauthorized
unauthorized
@ nonauthoritative_information
nonauthoritative_information
@ service_unavailable
service_unavailable
@ moved_permanently
moved_permanently
@ not_acceptable
not_acceptable
@ not_implemented
not_implemented
@ not_modified
not_modified
@ payload_too_large
payload_too_large
@ insufficient_storage
insufficient_storage
@ uri_too_long
uri_too_long
@ expectation_failed
expectation_failed
@ multiple_choices
partial_content
@ too_many_requests
too_many_requests
@ unsupported_media_type
unsupported_media_type
@ gateway_timeout
gateway_timeout
@ switching_protocols
switching_protocols
@ length_required
length_required
@ internal_server_error
internal_server_error
@ request_timeout
request_timeout
@ method_not_allowed
method_not_allowed
@ payment_required
payment_required
@ http_version_not_supported
http_version_not_supported
reply & done()
Definition: reply.hh:185
reply & set_mime_type(const sstring &mime)
Definition: reply.hh:164
reply & set_content_type(const sstring &content_type="html")
Definition: reply.hh:173
sstring _content
Definition: reply.hh:117
void write_body(const sstring &content_type, sstring content)
Write a string as the reply.