26#ifndef ROUTER_SRC_HTTP_SRC_HTTP_SERVER_CONNECTION_H_
27#define ROUTER_SRC_HTTP_SRC_HTTP_SERVER_CONNECTION_H_
40template <
typename Socket>
51 :
Parent(
std::move(s), allowed_method, connection_handler,
52 CNO_CONNECTION_KIND::CNO_SERVER, CNO_HTTP_VERSION::CNO_HTTP1),
63 const size_t size)
override {
72 sessions_[session_id].get_data().input_body_.get().append(data,
size);
77 [[maybe_unused]]
const cno_tail_t *tail)
override {
91 const cno_message_t *msg)
override {
94 const auto method_pos =
101 for (
const auto &header :
sequence) {
106 if (!(*Parent::allowed_method_)[method_pos]) {
108 path, std::move(input_headers))
114 auto pair =
sessions_.try_emplace(session_id,
this, session_id,
116 path, std::move(input_headers));
120 pair.first->second.get_output_headers().add(
"Date",
buffer);
121 pair.first->second.get_output_headers().add(
122 "Content-Type",
"text/html; charset=ISO-8859-1");
Definition: connection_status_callbacks.h:35
Definition: connection.h:103
Definition: buffer_sequence.h:39
Definition: request_handler_interface.h:36
virtual void route(http::base::Request &request)=0
Definition: connection.h:41
typename Parent::ConnectionStatusCallbacks ConnectionStatusCallbacks
Definition: connection.h:45
int on_cno_message_head(const uint32_t session_id, const cno_message_t *msg) override
Definition: connection.h:90
int on_cno_message_body(const uint32_t session_id, const char *data, const size_t size) override
Definition: connection.h:62
ServerConnection(Socket s, base::method::Bitset *allowed_method, RequestHandlerInterface *rhi, ConnectionStatusCallbacks *connection_handler)
Definition: connection.h:48
RequestHandlerInterface * request_handler_
Definition: connection.h:129
bool first_request_
Definition: connection.h:127
uint32_t SessionId
Definition: connection.h:44
int on_cno_stream_end(const uint32_t id) override
Definition: connection.h:85
int on_cno_message_tail(const uint32_t session_id, const cno_tail_t *tail) override
Definition: connection.h:76
int on_settings() override
Definition: connection.h:56
std::map< SessionId, ServerRequest > sessions_
Definition: connection.h:128
a HTTP request and response.
Definition: request.h:46
void send_error(StatusType status_code) override
Definition: request.cc:76
Definition: socket.h:1090
static char * path
Definition: mysqldump.cc:149
std::bitset< Pos::_LAST+1 > Bitset
Definition: method.h:57
HTTP_COMMON_EXPORT pos_type from_string_to_post(const std::string_view &method)
Definition: method.cc:50
int key_type
Definition: method.h:38
constexpr key_type NotImplemented
Definition: status_code.h:94
HTTP_COMMON_EXPORT int time_to_rfc5322_fixdate(time_t ts, char *date_buf, size_t date_buf_len)
convert time_t into a Date: header value.
Definition: http_time.cc:39
std::string to_string(const T &str)
Convert CNO buffers to strings.
Definition: string.h:42
HTTP_SERVER_LIB_EXPORT std::atomic< uint64_t > http_connections_reused
Definition: server.cc:43
Definition: connection.h:56
size_t size(const char *const c)
Definition: base64.h:46
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
Definition: gcs_xcom_synode.h:64
Definition: server_struct.h:39
long long sequence(UDF_INIT *initid, UDF_ARGS *args, unsigned char *, unsigned char *)
Definition: udf_example.cc:568