Kea  1.5.0
isc::http::HttpConnection Class Reference

Accepts and handles a single HTTP connection. More...

#include <connection.h>

+ Inheritance diagram for isc::http::HttpConnection:

Public Member Functions

 HttpConnection (asiolink::IOService &io_service, HttpAcceptor &acceptor, HttpConnectionPool &connection_pool, const HttpResponseCreatorPtr &response_creator, const HttpAcceptorCallback &callback, const long request_timeout, const long idle_timeout)
 Constructor. More...
 
 ~HttpConnection ()
 Destructor. More...
 
void asyncAccept ()
 Asynchronously accepts new connection. More...
 
void close ()
 Closes the socket. More...
 
void doRead ()
 Starts asynchronous read from the socket. More...
 

Detailed Description

Accepts and handles a single HTTP connection.

Definition at line 43 of file connection.h.

Constructor & Destructor Documentation

◆ HttpConnection()

isc::http::HttpConnection::HttpConnection ( asiolink::IOService io_service,
HttpAcceptor acceptor,
HttpConnectionPool connection_pool,
const HttpResponseCreatorPtr response_creator,
const HttpAcceptorCallback callback,
const long  request_timeout,
const long  idle_timeout 
)

Constructor.

Parameters
io_serviceIO service to be used by the connection.
acceptorReference to the TCP acceptor object used to listen for new HTTP connections.
connection_poolConnection pool in which this connection is stored.
response_creatorPointer to the response creator object used to create HTTP response from the HTTP request received.
callbackCallback invoked when new connection is accepted.
request_timeoutConfigured timeout for a HTTP request.
idle_timeoutTimeout after which persistent HTTP connection is closed by the server.

Definition at line 39 of file connection.cc.

◆ ~HttpConnection()

isc::http::HttpConnection::~HttpConnection ( )

Destructor.

Closes current connection.

Definition at line 61 of file connection.cc.

References close().

+ Here is the call graph for this function:

Member Function Documentation

◆ asyncAccept()

void isc::http::HttpConnection::asyncAccept ( )

Asynchronously accepts new connection.

When the connection is established successfully, the timeout timer is setup and the asynchronous read from the socket is started.

Definition at line 84 of file connection.cc.

References isc::asiolink::TCPAcceptor< C >::asyncAccept(), isc_throw, and isc::Exception::what().

+ Here is the call graph for this function:

◆ close()

void isc::http::HttpConnection::close ( )

Closes the socket.

Definition at line 66 of file connection.cc.

References isc::asiolink::IntervalTimer::cancel(), and isc::asiolink::TCPSocket< C >::close().

Referenced by ~HttpConnection().

+ Here is the call graph for this function:

◆ doRead()

void isc::http::HttpConnection::doRead ( )

Starts asynchronous read from the socket.

The data received over the socket are supplied to the HTTP parser until the parser signals that the entire request has been received or until the parser signals an error. In the former case the server creates an HTTP response using supplied response creator object.

In case of error the connection is stopped.

Definition at line 101 of file connection.cc.

References isc::asiolink::TCPSocket< C >::asyncReceive().

+ Here is the call graph for this function:

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