NVIDIA DeepStream SDK API Reference

9.2 Release
HTTP_SERVER_NS::FileHttpServer Class Reference

Detailed Description

Inheritance diagram for HTTP_SERVER_NS::FileHttpServer:
Collaboration diagram for HTTP_SERVER_NS::FileHttpServer:

Public Member Functions

void setKeepalive (bool keepAlive)
 
void setKeepalive (bool keepAlive)
 
void setRequestLimits (size_t maxRequestHeadersSize, size_t maxRequestContentSize)
 
void setRequestLimits (size_t maxRequestHeadersSize, size_t maxRequestContentSize)
 
void setServerName (std::string const &name)
 
void setServerName (std::string const &name)
 
int addListeningPort (int port)
 
int addListeningPort (int port)
 
HttpRequestHandler & addHandler (const std::string &root, HttpRequestCallback &handler)
 
HttpRequestHandler & addHandler (const std::string &root, HttpRequestCallback &handler)
 
HttpRequestHandler & operator[] (const std::string &root)
 
HttpRequestHandler & operator[] (const std::string &root)
 
HttpServer & operator+= (std::pair< const std::string &, HttpRequestCallback & > other)
 
HttpServer & operator+= (std::pair< const std::string &, HttpRequestCallback & > other)
 
void start ()
 
void start ()
 
void stop ()
 
void stop ()
 

Static Public Member Functions

static const char * getDefaultResponseMessage (int code)
 
static const char * getDefaultResponseMessage (int code)
 

Protected Member Functions

 FileHttpServer (const std::string &host="127.0.0.1", int port=3333)
 Construct the server by initializing the endpoint for serving static files, which show up on the web if the user is on the given host:port. More...
 
void InitializeFileEndpoint (FileHttpServer &server)
 Set the HTTP server to serve static files from the root of host:port. More...
 
 FileHttpServer (const std::string &host="127.0.0.1", int port=3333)
 Construct the server by initializing the endpoint for serving static files, which show up on the web if the user is on the given host:port. More...
 
void InitializeFileEndpoint (FileHttpServer &server)
 Set the HTTP server to serve static files from the root of host:port. More...
 
virtual void onSocketAcceptable (SocketTools::Socket socket) override
 
virtual void onSocketAcceptable (SocketTools::Socket socket) override
 
virtual void onSocketReadable (SocketTools::Socket socket) override
 
virtual void onSocketReadable (SocketTools::Socket socket) override
 
virtual void onSocketWritable (SocketTools::Socket socket) override
 
virtual void onSocketWritable (SocketTools::Socket socket) override
 
virtual void onSocketClosed (SocketTools::Socket socket) override
 
virtual void onSocketClosed (SocketTools::Socket socket) override
 
bool sendMore (Connection &conn)
 
bool sendMore (Connection &conn)
 
void handleConnectionClosed (Connection &conn)
 
void handleConnectionClosed (Connection &conn)
 
void handleConnection (Connection &conn)
 
void handleConnection (Connection &conn)
 
bool parseHeaders (Connection &conn)
 
bool parseHeaders (Connection &conn)
 
void processRequest (Connection &conn)
 
void processRequest (Connection &conn)
 

Static Protected Member Functions

static bool equalsLowercased (std::string const &str, char const *mask)
 
static bool equalsLowercased (std::string const &str, char const *mask)
 
static std::string normalizeHeaderName (char const *begin, char const *end)
 
static std::string normalizeHeaderName (char const *begin, char const *end)
 
static std::string formatTimestamp (time_t time)
 
static std::string formatTimestamp (time_t time)
 

Protected Attributes

std::string m_serverHost
 
bool allowKeepalive {true}
 
SocketTools::Reactor m_reactor
 
std::list< SocketTools::Socket > m_listeningSockets
 
std::list< HttpRequestHandler > m_handlers
 
std::map< SocketTools::Socket, Connection > m_connections
 
size_t m_maxRequestHeadersSize
 
size_t m_maxRequestContentSize
 

Constructor & Destructor Documentation

◆ FileHttpServer() [1/2]

HTTP_SERVER_NS::FileHttpServer::FileHttpServer ( const std::string &  host = "127.0.0.1",
int  port = 3333 
)
inlineprotected

Construct the server by initializing the endpoint for serving static files, which show up on the web if the user is on the given host:port.

Static files can be seen relative to the folder where the executable was ran.

Definition at line 25 of file includes/opentelemetry/ext/http/server/file_http_server.h.

References HTTP_SERVER_NS::HttpServer::addListeningPort(), and HTTP_SERVER_NS::HttpServer::setServerName().

◆ FileHttpServer() [2/2]

HTTP_SERVER_NS::FileHttpServer::FileHttpServer ( const std::string &  host = "127.0.0.1",
int  port = 3333 
)
inlineprotected

Construct the server by initializing the endpoint for serving static files, which show up on the web if the user is on the given host:port.

Static files can be seen relative to the folder where the executable was ran.

Definition at line 25 of file 9.2/includes/opentelemetry/ext/http/server/file_http_server.h.

References HTTP_SERVER_NS::HttpServer::addListeningPort(), and HTTP_SERVER_NS::HttpServer::setServerName().

Member Function Documentation

◆ addHandler() [1/2]

HttpRequestHandler& HTTP_SERVER_NS::HttpServer::addHandler ( const std::string &  root,
HttpRequestCallback &  handler 
)
inlineinherited

◆ addHandler() [2/2]

HttpRequestHandler& HTTP_SERVER_NS::HttpServer::addHandler ( const std::string &  root,
HttpRequestCallback &  handler 
)
inlineinherited

◆ addListeningPort() [1/2]

◆ addListeningPort() [2/2]

◆ equalsLowercased() [1/2]

static bool HTTP_SERVER_NS::HttpServer::equalsLowercased ( std::string const &  str,
char const *  mask 
)
inlinestaticprotectedinherited

◆ equalsLowercased() [2/2]

static bool HTTP_SERVER_NS::HttpServer::equalsLowercased ( std::string const &  str,
char const *  mask 
)
inlinestaticprotectedinherited

◆ formatTimestamp() [1/2]

static std::string HTTP_SERVER_NS::HttpServer::formatTimestamp ( time_t  time)
inlinestaticprotectedinherited

◆ formatTimestamp() [2/2]

static std::string HTTP_SERVER_NS::HttpServer::formatTimestamp ( time_t  time)
inlinestaticprotectedinherited

◆ getDefaultResponseMessage() [1/2]

static const char* HTTP_SERVER_NS::HttpServer::getDefaultResponseMessage ( int  code)
inlinestaticinherited

◆ getDefaultResponseMessage() [2/2]

static const char* HTTP_SERVER_NS::HttpServer::getDefaultResponseMessage ( int  code)
inlinestaticinherited

◆ handleConnection() [1/2]

◆ handleConnection() [2/2]

void HTTP_SERVER_NS::HttpServer::handleConnection ( Connection &  conn)
inlineprotectedinherited

Definition at line 366 of file includes/opentelemetry/ext/http/server/http_server.h.

References SocketTools::Reactor::addSocket(), HTTP_SERVER_NS::HttpServer::allowKeepalive, HTTP_SERVER_NS::HttpResponse::body, HTTP_SERVER_NS::HttpRequest::client, SocketTools::Reactor::Closed, HTTP_SERVER_NS::HttpServer::Connection::Closing, HTTP_SERVER_NS::HttpResponse::code, HTTP_SERVER_NS::HttpRequest::content, HTTP_SERVER_NS::HttpServer::Connection::contentLength, HTTP_SERVER_NS::HttpServer::equalsLowercased(), HTTP_SERVER_NS::HttpRequest::headers, HTTP_SERVER_NS::HttpResponse::headers, HTTP_SERVER_NS::HttpServer::Connection::Idle, HTTP_SERVER_NS::HttpServer::Connection::keepalive, LOG_INFO, LOG_TRACE, LOG_WARN, HTTP_SERVER_NS::HttpServer::m_maxRequestContentSize, HTTP_SERVER_NS::HttpServer::m_maxRequestHeadersSize, HTTP_SERVER_NS::HttpServer::m_reactor, HTTP_SERVER_NS::HttpResponse::message, HTTP_SERVER_NS::HttpRequest::method, absl::move(), HTTP_SERVER_NS::HttpServer::parseHeaders(), HTTP_SERVER_NS::HttpServer::Connection::Processing, HTTP_SERVER_NS::HttpServer::processRequest(), HTTP_SERVER_NS::HttpRequest::protocol, SocketTools::Reactor::Readable, HTTP_SERVER_NS::HttpServer::Connection::receiveBuffer, HTTP_SERVER_NS::HttpServer::Connection::ReceivingBody, HTTP_SERVER_NS::HttpServer::Connection::ReceivingHeaders, HTTP_SERVER_NS::HttpServer::Connection::request, HTTP_SERVER_NS::HttpServer::Connection::response, HTTP_SERVER_NS::HttpServer::Connection::sendBuffer, HTTP_SERVER_NS::HttpServer::Connection::Sending100Continue, HTTP_SERVER_NS::HttpServer::Connection::SendingBody, HTTP_SERVER_NS::HttpServer::Connection::SendingHeaders, HTTP_SERVER_NS::HttpServer::sendMore(), SocketTools::Socket::shutdown(), SocketTools::Socket::ShutdownSend, HTTP_SERVER_NS::HttpServer::Connection::socket, HTTP_SERVER_NS::HttpServer::Connection::state, and HTTP_SERVER_NS::HttpRequest::uri.

Referenced by HTTP_SERVER_NS::HttpServer::onSocketReadable(), and HTTP_SERVER_NS::HttpServer::onSocketWritable().

◆ handleConnectionClosed() [1/2]

◆ handleConnectionClosed() [2/2]

◆ InitializeFileEndpoint() [1/2]

void HTTP_SERVER_NS::FileHttpServer::InitializeFileEndpoint ( FileHttpServer &  server)
inlineprotected

Set the HTTP server to serve static files from the root of host:port.

Derived HTTP servers should initialize the file endpoint AFTER they initialize their own, otherwise everything will be served like a file

Parameters
servershould be an instance of this object

Definition at line 39 of file 9.2/includes/opentelemetry/ext/http/server/file_http_server.h.

◆ InitializeFileEndpoint() [2/2]

void HTTP_SERVER_NS::FileHttpServer::InitializeFileEndpoint ( FileHttpServer &  server)
inlineprotected

Set the HTTP server to serve static files from the root of host:port.

Derived HTTP servers should initialize the file endpoint AFTER they initialize their own, otherwise everything will be served like a file

Parameters
servershould be an instance of this object

Definition at line 39 of file includes/opentelemetry/ext/http/server/file_http_server.h.

◆ normalizeHeaderName() [1/2]

static std::string HTTP_SERVER_NS::HttpServer::normalizeHeaderName ( char const *  begin,
char const *  end 
)
inlinestaticprotectedinherited

◆ normalizeHeaderName() [2/2]

static std::string HTTP_SERVER_NS::HttpServer::normalizeHeaderName ( char const *  begin,
char const *  end 
)
inlinestaticprotectedinherited

◆ onSocketAcceptable() [1/2]

◆ onSocketAcceptable() [2/2]

◆ onSocketClosed() [1/2]

◆ onSocketClosed() [2/2]

◆ onSocketReadable() [1/2]

◆ onSocketReadable() [2/2]

◆ onSocketWritable() [1/2]

◆ onSocketWritable() [2/2]

◆ operator+=() [1/2]

HttpServer& HTTP_SERVER_NS::HttpServer::operator+= ( std::pair< const std::string &, HttpRequestCallback & >  other)
inlineinherited

◆ operator+=() [2/2]

HttpServer& HTTP_SERVER_NS::HttpServer::operator+= ( std::pair< const std::string &, HttpRequestCallback & >  other)
inlineinherited

◆ operator[]() [1/2]

HttpRequestHandler& HTTP_SERVER_NS::HttpServer::operator[] ( const std::string &  root)
inlineinherited

◆ operator[]() [2/2]

HttpRequestHandler& HTTP_SERVER_NS::HttpServer::operator[] ( const std::string &  root)
inlineinherited

◆ parseHeaders() [1/2]

◆ parseHeaders() [2/2]

bool HTTP_SERVER_NS::HttpServer::parseHeaders ( Connection &  conn)
inlineprotectedinherited

◆ processRequest() [1/2]

◆ processRequest() [2/2]

◆ sendMore() [1/2]

◆ sendMore() [2/2]

◆ setKeepalive() [1/2]

void HTTP_SERVER_NS::HttpServer::setKeepalive ( bool  keepAlive)
inlineinherited

◆ setKeepalive() [2/2]

void HTTP_SERVER_NS::HttpServer::setKeepalive ( bool  keepAlive)
inlineinherited

◆ setRequestLimits() [1/2]

void HTTP_SERVER_NS::HttpServer::setRequestLimits ( size_t  maxRequestHeadersSize,
size_t  maxRequestContentSize 
)
inlineinherited

◆ setRequestLimits() [2/2]

void HTTP_SERVER_NS::HttpServer::setRequestLimits ( size_t  maxRequestHeadersSize,
size_t  maxRequestContentSize 
)
inlineinherited

◆ setServerName() [1/2]

void HTTP_SERVER_NS::HttpServer::setServerName ( std::string const &  name)
inlineinherited

◆ setServerName() [2/2]

void HTTP_SERVER_NS::HttpServer::setServerName ( std::string const &  name)
inlineinherited

◆ start() [1/2]

void HTTP_SERVER_NS::HttpServer::start ( )
inlineinherited

◆ start() [2/2]

void HTTP_SERVER_NS::HttpServer::start ( )
inlineinherited

◆ stop() [1/2]

void HTTP_SERVER_NS::HttpServer::stop ( )
inlineinherited

◆ stop() [2/2]

void HTTP_SERVER_NS::HttpServer::stop ( )
inlineinherited

Field Documentation

◆ allowKeepalive

bool HTTP_SERVER_NS::HttpServer::allowKeepalive {true}
protectedinherited

◆ m_connections

◆ m_handlers

◆ m_listeningSockets

◆ m_maxRequestContentSize

size_t HTTP_SERVER_NS::HttpServer::m_maxRequestContentSize
protectedinherited

◆ m_maxRequestHeadersSize

size_t HTTP_SERVER_NS::HttpServer::m_maxRequestHeadersSize
protectedinherited

◆ m_reactor

◆ m_serverHost

std::string HTTP_SERVER_NS::HttpServer::m_serverHost
protectedinherited

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