join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::BasicHttpSecureServer< Protocol > Class Template Reference

basic HTTPS server. More...

#include <http_server.hpp>

Inheritance diagram for join::BasicHttpSecureServer< Protocol >:
Collaboration diagram for join::BasicHttpSecureServer< Protocol >:

Public Types

using Worker = BasicHttpWorker<Protocol>
 
using Socket = typename Protocol::Socket
 
- Public Types inherited from join::BasicHttpServer< Protocol >
using Worker = BasicHttpWorker<Protocol>
 
using Content = BasicHttpContent<Protocol>
 
using Handler = typename Content::Handler
 
using Access = typename Content::Access
 
using Endpoint = typename Protocol::Endpoint
 
using Socket = typename Protocol::Socket
 
using Acceptor = typename Protocol::Acceptor
 

Public Member Functions

 BasicHttpSecureServer (TlsContext ctx, size_t workers=std::thread::hardware_concurrency())
 create the HTTPS server instance using the given context.
 
 BasicHttpSecureServer (const BasicHttpSecureServer &other)=delete
 create instance by copy.
 
BasicHttpSecureServeroperator= (const BasicHttpSecureServer &other)=delete
 assign instance by copy.
 
 BasicHttpSecureServer (BasicHttpSecureServer &&other)=delete
 create instance by move.
 
BasicHttpSecureServeroperator= (BasicHttpSecureServer &&other)=delete
 assign instance by move.
 
virtual ~BasicHttpSecureServer ()
 destroy the HTTPS server.
 
Socket accept () const override
 accept new connection and fill in the client object with connection parameters.
 
virtual std::string scheme () const override
 get scheme.
 
- Public Member Functions inherited from join::BasicHttpServer< Protocol >
 BasicHttpServer (size_t workers=std::thread::hardware_concurrency())
 create the HTTP server instance.
 
 BasicHttpServer (const BasicHttpServer &other)=delete
 create instance by copy.
 
BasicHttpServeroperator= (const BasicHttpServer &other)=delete
 assign instance by copy.
 
 BasicHttpServer (BasicHttpServer &&other)=delete
 create instance by move.
 
BasicHttpServeroperator= (BasicHttpServer &&other)=delete
 assign instance by move.
 
virtual ~BasicHttpServer ()
 destroy the HTTP server.
 
int create (const Endpoint &endpoint) noexcept
 create server.
 
void close () noexcept
 close server.
 
void baseLocation (const std::string &path)
 set file base location.
 
const std::string & baseLocation () const
 get file base location.
 
void keepAlive (std::chrono::seconds timeout, int max=1000)
 set HTTP keep alive.
 
std::chrono::seconds keepAliveTimeout () const
 get HTTP keep alive timeout.
 
int keepAliveMax () const
 get HTTP keep alive max.
 
ContentaddDocumentRoot (const std::string &dir, const std::string &name, const Access &access=nullptr)
 map an URL to filesystem adding URL path to the base location.
 
ContentaddAlias (const std::string &dir, const std::string &name, const std::string &alias, const Access &access=nullptr)
 map an URL to filesystem replacing URL path by the specified path.
 
ContentaddExecute (const HttpMethod methods, const std::string &dir, const std::string &name, const Handler &handler, const Access &access=nullptr)
 map an URL to a callback.
 
ContentaddRedirect (const std::string &dir, const std::string &name, const std::string &location, const Access &access=nullptr)
 map an URL to a redirection.
 

Public Attributes

TlsContext _ctx
 TLS context used to wrap the accepted connections.
 
friend Worker
 friendship with worker.
 

Additional Inherited Members

- Protected Member Functions inherited from join::BasicHttpServer< Protocol >
ContentfindContent (HttpMethod method, const std::string &path) const
 find content.
 
- Protected Attributes inherited from join::BasicHttpServer< Protocol >
Acceptor _acceptor
 acceptor.
 
int _event = -1
 gracefully stop all workers.
 
size_t _nworkers
 number of workers.
 
std::vector< std::unique_ptr< Worker > > _workers
 workers.
 
Mutex _mutex
 accept protection mutex.
 
std::vector< std::unique_ptr< Content > > _contents
 contents.
 
std::string _baseLocation
 base location.
 
std::chrono::seconds _keepTimeout
 keep alive timeout.
 
int _keepMax = 1000
 keep alive max.
 
Cache _cache
 file cache.
 
friend Worker
 friendship with worker.
 

Detailed Description

template<class Protocol>
class join::BasicHttpSecureServer< Protocol >

basic HTTPS server.

Member Typedef Documentation

◆ Socket

template<class Protocol >
using join::BasicHttpSecureServer< Protocol >::Socket = typename Protocol::Socket

◆ Worker

template<class Protocol >
using join::BasicHttpSecureServer< Protocol >::Worker = BasicHttpWorker<Protocol>

Constructor & Destructor Documentation

◆ BasicHttpSecureServer() [1/3]

template<class Protocol >
join::BasicHttpSecureServer< Protocol >::BasicHttpSecureServer ( TlsContext ctx,
size_t workers = std::thread::hardware_concurrency () )
inline

create the HTTPS server instance using the given context.

Parameters
ctxTLS context used to wrap the accepted connections.
workersnumber of worker threads.

◆ BasicHttpSecureServer() [2/3]

template<class Protocol >
join::BasicHttpSecureServer< Protocol >::BasicHttpSecureServer ( const BasicHttpSecureServer< Protocol > & other)
delete

create instance by copy.

Parameters
otherobject to copy.

◆ BasicHttpSecureServer() [3/3]

template<class Protocol >
join::BasicHttpSecureServer< Protocol >::BasicHttpSecureServer ( BasicHttpSecureServer< Protocol > && other)
delete

create instance by move.

Parameters
otherobject to move.

◆ ~BasicHttpSecureServer()

template<class Protocol >
virtual join::BasicHttpSecureServer< Protocol >::~BasicHttpSecureServer ( )
inlinevirtual

destroy the HTTPS server.

Member Function Documentation

◆ accept()

template<class Protocol >
Socket join::BasicHttpSecureServer< Protocol >::accept ( ) const
inlineoverridevirtual

accept new connection and fill in the client object with connection parameters.

Returns
the accepted client socket object.

Reimplemented from join::BasicHttpServer< Protocol >.

◆ operator=() [1/2]

template<class Protocol >
BasicHttpSecureServer & join::BasicHttpSecureServer< Protocol >::operator= ( BasicHttpSecureServer< Protocol > && other)
delete

assign instance by move.

Parameters
otherobject to move.
Returns
a reference of the current object.

◆ operator=() [2/2]

template<class Protocol >
BasicHttpSecureServer & join::BasicHttpSecureServer< Protocol >::operator= ( const BasicHttpSecureServer< Protocol > & other)
delete

assign instance by copy.

Parameters
otherobject to copy.
Returns
a reference of the current object.

◆ scheme()

template<class Protocol >
virtual std::string join::BasicHttpSecureServer< Protocol >::scheme ( ) const
inlineoverridevirtual

get scheme.

Returns
htpp or https.

Reimplemented from join::BasicHttpServer< Protocol >.

Member Data Documentation

◆ _ctx

template<class Protocol >
TlsContext join::BasicHttpSecureServer< Protocol >::_ctx

TLS context used to wrap the accepted connections.

◆ Worker

template<class Protocol >
friend join::BasicHttpSecureServer< Protocol >::Worker

friendship with worker.


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