C++ Actor Framework 0.19
|
Parses HTTP requests and passes them to the upper layer. More...
#include <lower_layer.hpp>
Public Member Functions | |
virtual void | request_messages ()=0 |
Start or re-start reading data from the client. | |
virtual void | suspend_reading ()=0 |
Stops reading messages until calling request_messages . | |
virtual void | begin_header (status code)=0 |
Starts writing an HTTP header. | |
virtual void | add_header_field (std::string_view key, std::string_view val)=0 |
Adds a header field. | |
virtual bool | end_header ()=0 |
Seals the header and transports it to the client. | |
virtual bool | send_payload (const_byte_span bytes)=0 |
Sends the payload after the header. | |
virtual bool | send_chunk (const_byte_span bytes)=0 |
Sends a chunk of data if the full payload is unknown when starting to send. | |
virtual bool | send_end_of_chunks ()=0 |
Sends the last chunk, completing a chunked payload. | |
bool | send_response (status code) |
Sends a response that only consists of a header with a status code such as status::no_content . | |
bool | send_response (status code, std::string_view content_type, const_byte_span content) |
Convenience function for sending header and payload. | |
bool | send_response (status code, std::string_view content_type, std::string_view content) |
Sends a response that only consists of a header with a status code such as status::no_content . | |
bool | send_response (status code, const error &err) |
Sends a response that only consists of a header with a status code such as status::no_content . | |
virtual void | switch_protocol (std::unique_ptr< octet_stream::upper_layer > next)=0 |
Asks the stream to swap the HTTP layer with next after returning from consume . | |
![]() | |
virtual multiplexer & | mpx () noexcept=0 |
Returns the multiplexer instance that executes this protocol stack. | |
virtual bool | can_send_more () const noexcept=0 |
Queries whether the output device can accept more data straight away. | |
virtual bool | is_reading () const noexcept=0 |
Queries whether the lower layer is currently reading from its input device. | |
virtual void | write_later ()=0 |
Triggers a write callback after the write device signals downstream capacity. | |
virtual void | shutdown ()=0 |
Shuts down any connection or session gracefully. | |
virtual void | shutdown (const error &reason) |
Shuts down any connection or session du to an error. | |
Parses HTTP requests and passes them to the upper layer.
|
pure virtual |
Adds a header field.
Users may only call this function between begin_header
and end_header
.
Implemented in caf::net::http::server.
|
pure virtual |
Starts writing an HTTP header.
Implemented in caf::net::http::server.
|
pure virtual |
Seals the header and transports it to the client.
Implemented in caf::net::http::server.
|
pure virtual |
Start or re-start reading data from the client.
Implemented in caf::net::http::server.
|
pure virtual |
Sends a chunk of data if the full payload is unknown when starting to send.
Implemented in caf::net::http::server.
|
pure virtual |
Sends the last chunk, completing a chunked payload.
Implemented in caf::net::http::server.
|
pure virtual |
Sends the payload after the header.
Implemented in caf::net::http::server.
Sends a response that only consists of a header with a status code such as status::no_content
.
bool caf::net::http::lower_layer::send_response | ( | status | code, |
std::string_view | content_type, | ||
const_byte_span | content | ||
) |
Convenience function for sending header and payload.
Automatically sets the header fields Content-Type
and Content-Length
.
bool caf::net::http::lower_layer::send_response | ( | status | code, |
std::string_view | content_type, | ||
std::string_view | content | ||
) |
Sends a response that only consists of a header with a status code such as status::no_content
.
|
pure virtual |
Stops reading messages until calling request_messages
.
Implemented in caf::net::http::server.
|
pure virtual |
Asks the stream to swap the HTTP layer with next
after returning from consume
.
consume
. Implemented in caf::net::http::server.