Sese Framework
2.3.0
A cross-platform framework
|
Http regular connection implementation. More...
#include <HttpConnection.h>
Public Types | |
using | Ptr = std::shared_ptr<HttpConnectionImpl> |
using | Socket = asio::ip::tcp::socket |
using | SharedSocket = std::shared_ptr<Socket> |
Public Types inherited from sese::internal::service::http::HttpConnection | |
using | Ptr = std::shared_ptr<HttpConnection> |
Public Types inherited from sese::internal::service::http::Handleable | |
using | Ptr = std::shared_ptr<Handleable> |
Public Member Functions | |
Ptr | getPtr () |
HttpConnectionImpl (const std::shared_ptr< HttpServiceImpl > &service, asio::io_context &context, const sese::net::IPAddress::Ptr &addr, SharedSocket socket) | |
void | writeBlock (const char *buffer, size_t length, const std::function< void(const asio::error_code &code)> &callback) override |
void | asyncReadSome (const asio::mutable_buffers_1 &buffer, const std::function< void(const asio::error_code &error, std::size_t bytes_transferred)> &callback) override |
void | checkKeepalive () override |
Public Member Functions inherited from sese::internal::service::http::HttpConnection | |
Ptr | getPtr () |
HttpConnection (const std::shared_ptr< HttpServiceImpl > &service, asio::io_context &io_context, const sese::net::IPAddress::Ptr &addr) | |
virtual | ~HttpConnection ()=default |
void | reset () |
void | readHeader () |
void | readBody () |
void | handleRequest () |
void | writeHeader () |
void | writeBody () |
virtual void | disponse () |
void | writeSingleRange () |
void | writeRanges () |
Public Attributes | |
SharedSocket | socket |
Public Attributes inherited from sese::internal::service::http::HttpConnection | |
asio::system_timer | timer |
size_t | expect_length |
size_t | real_length |
char | send_buffer [MTU_VALUE] {} |
bool | is0x0a = false |
iocp::IOBuf | io_buffer |
std::unique_ptr< iocp::IOBufNode > | node |
io::ByteBuilder | dynamic_buffer |
std::weak_ptr< HttpServiceImpl > | service |
Public Attributes inherited from sese::internal::service::http::Handleable | |
ConnType | conn_type = ConnType::NONE |
sese::net::http::Request | request |
sese::net::http::Response | response |
std::string | content_type = "application/x-" |
io::File::Ptr | file |
size_t | filesize = 0 |
std::vector< sese::net::http::Range > | ranges |
std::vector< sese::net::http::Range >::iterator | range_iterator = ranges.begin() |
sese::net::IPAddress::Ptr | remote_address {} |
bool | keepalive = false |
sese::StopWatch | stopwatch |
Http regular connection implementation.
using sese::internal::service::http::HttpConnectionImpl::Ptr = std::shared_ptr<HttpConnectionImpl> |
using sese::internal::service::http::HttpConnectionImpl::SharedSocket = std::shared_ptr<Socket> |
using sese::internal::service::http::HttpConnectionImpl::Socket = asio::ip::tcp::socket |
sese::internal::service::http::HttpConnectionImpl::HttpConnectionImpl | ( | const std::shared_ptr< HttpServiceImpl > & | service, |
asio::io_context & | context, | ||
const sese::net::IPAddress::Ptr & | addr, | ||
SharedSocket | socket ) |
|
overridevirtual |
Read function. This function will call the corresponding asio::async_read_some
buffer | asio::buffer |
callback | Callback function |
Implements sese::internal::service::http::HttpConnection.
References callback().
|
overridevirtual |
Called when a request is completed to determine whether to disconnect the current connection
Implements sese::internal::service::http::HttpConnection.
|
inline |
|
overridevirtual |
Write block function. This function ensures that all buffers are completely written, and the connection will be disconnected if an unexpected error occurs
buffer | Pointer to the buffer |
length | Size of the buffer |
callback | Completion callback function |
Implements sese::internal::service::http::HttpConnection.
References callback().
SharedSocket sese::internal::service::http::HttpConnectionImpl::socket |