Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::internal::service::http::HttpConnectionImpl Struct Referencefinal

Http regular connection implementation. More...

#include <HttpConnection.h>

Inheritance diagram for sese::internal::service::http::HttpConnectionImpl:
sese::internal::service::http::HttpConnection sese::internal::service::http::Handleable

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::IOBufNodenode
 
io::ByteBuilder dynamic_buffer
 
std::weak_ptr< HttpServiceImplservice
 
- 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::Rangeranges
 
std::vector< sese::net::http::Range >::iterator range_iterator = ranges.begin()
 
sese::net::IPAddress::Ptr remote_address {}
 
bool keepalive = false
 
sese::StopWatch stopwatch
 

Detailed Description

Http regular connection implementation.

Member Typedef Documentation

◆ Ptr

◆ SharedSocket

◆ Socket

Constructor & Destructor Documentation

◆ HttpConnectionImpl()

sese::internal::service::http::HttpConnectionImpl::HttpConnectionImpl ( const std::shared_ptr< HttpServiceImpl > & service,
asio::io_context & context,
const sese::net::IPAddress::Ptr & addr,
SharedSocket socket )

Member Function Documentation

◆ asyncReadSome()

void sese::internal::service::http::HttpConnectionImpl::asyncReadSome ( const asio::mutable_buffers_1 & buffer,
const std::function< void(const asio::error_code &error, std::size_t bytes_transferred)> & callback )
overridevirtual

Read function. This function will call the corresponding asio::async_read_some

Parameters
bufferasio::buffer
callbackCallback function

Implements sese::internal::service::http::HttpConnection.

References callback().

◆ checkKeepalive()

void sese::internal::service::http::HttpConnectionImpl::checkKeepalive ( )
overridevirtual

Called when a request is completed to determine whether to disconnect the current connection

Note
This function must be implemented

Implements sese::internal::service::http::HttpConnection.

◆ getPtr()

Ptr sese::internal::service::http::HttpConnectionImpl::getPtr ( )
inline

◆ writeBlock()

void sese::internal::service::http::HttpConnectionImpl::writeBlock ( const char * buffer,
size_t length,
const std::function< void(const asio::error_code &code)> & callback )
overridevirtual

Write block function. This function ensures that all buffers are completely written, and the connection will be disconnected if an unexpected error occurs

Note
This function must be implemented
Parameters
bufferPointer to the buffer
lengthSize of the buffer
callbackCompletion callback function

Implements sese::internal::service::http::HttpConnection.

References callback().

Member Data Documentation

◆ socket

SharedSocket sese::internal::service::http::HttpConnectionImpl::socket

The documentation for this struct was generated from the following files: