Arduino DLNA Server
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
tiny_dlna::HttpClientHandler< ClientT > Class Template Reference

Handles HTTP client connections and responses for the DLNA HTTP server. More...

#include <HttpClientHandler.h>

Inheritance diagram for tiny_dlna::HttpClientHandler< ClientT >:
Inheritance graph
[legend]

Public Member Functions

 HttpClientHandler ()=default
 
 HttpClientHandler (ClientT &client)
 
 HttpClientHandler (ClientT *client)
 
virtual ~HttpClientHandler ()=default
 
void setClient (ClientT *client)
 
void readHttpHeader ()
 Reads the http header info from the client.
 
void reply (int status, const char *msg)
 
void replyChunked (const char *contentType, Stream &inputStream, int status=200, const char *msg=SUCCESS) override
 
void replyChunked (const char *contentType, int status=200, const char *msg=SUCCESS) override
 
void reply (const char *contentType, Stream &inputStream, int size, int status=200, const char *msg=SUCCESS) override
 
void reply (const char *contentType, size_t(*callback)(Print &out, void *ref), int status=200, const char *msg=SUCCESS, void *ref=nullptr) override
 
void reply (const char *contentType, const char *str, int status=200, const char *msg=SUCCESS) override
 
void reply (const char *contentType, const uint8_t *str, int len, int status=200, const char *msg=SUCCESS) override
 
void replyOK () override
 
void replyNotFound () override
 
void replyError (int err, const char *msg="Internal Server Error") override
 
void endClient () override
 
void crlf () override
 
Client * client () override
 
HttpRequestHeaderrequestHeader ()
 
HttpReplyHeaderreplyHeader ()
 
void resize (size_t newSize)
 

Protected Attributes

ClientT * p_client = nullptr
 
HttpRequestHeader request_header
 
HttpReplyHeader reply_header
 
int buffer_size = 512
 

Detailed Description

template<typename ClientT>
class tiny_dlna::HttpClientHandler< ClientT >

Handles HTTP client connections and responses for the DLNA HTTP server.

This class encapsulates all logic for managing a single HTTP client connection, including reading requests, writing replies (including chunked and callback-based), and managing the internal buffer. It is designed to be used as a handler within the HttpServer class template, and supports both pointer and reference-based client assignment. All HTTP response methods are provided, including error and not-found replies, and the handler is responsible for managing the client lifecycle.

Template Parameters
ClientTThe concrete client type (e.g., WiFiClient, EthernetClient) used for network I/O.

Constructor & Destructor Documentation

◆ HttpClientHandler() [1/3]

template<typename ClientT >
tiny_dlna::HttpClientHandler< ClientT >::HttpClientHandler ( )
default

◆ HttpClientHandler() [2/3]

template<typename ClientT >
tiny_dlna::HttpClientHandler< ClientT >::HttpClientHandler ( ClientT &  client)
inline

◆ HttpClientHandler() [3/3]

template<typename ClientT >
tiny_dlna::HttpClientHandler< ClientT >::HttpClientHandler ( ClientT *  client)
inline

◆ ~HttpClientHandler()

template<typename ClientT >
virtual tiny_dlna::HttpClientHandler< ClientT >::~HttpClientHandler ( )
virtualdefault

Member Function Documentation

◆ client()

template<typename ClientT >
Client * tiny_dlna::HttpClientHandler< ClientT >::client ( )
inlineoverridevirtual

◆ crlf()

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::crlf ( )
inlineoverridevirtual

◆ endClient()

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::endClient ( )
inlineoverridevirtual

◆ readHttpHeader()

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::readHttpHeader ( )
inline

Reads the http header info from the client.

◆ reply() [1/5]

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::reply ( const char *  contentType,
const char *  str,
int  status = 200,
const char *  msg = SUCCESS 
)
inlineoverridevirtual

◆ reply() [2/5]

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::reply ( const char *  contentType,
const uint8_t *  str,
int  len,
int  status = 200,
const char *  msg = SUCCESS 
)
inlineoverridevirtual

◆ reply() [3/5]

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::reply ( const char *  contentType,
size_t(*)(Print &out, void *ref)  callback,
int  status = 200,
const char *  msg = SUCCESS,
void *  ref = nullptr 
)
inlineoverridevirtual

◆ reply() [4/5]

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::reply ( const char *  contentType,
Stream &  inputStream,
int  size,
int  status = 200,
const char *  msg = SUCCESS 
)
inlineoverridevirtual

◆ reply() [5/5]

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::reply ( int  status,
const char *  msg 
)
inline

◆ replyChunked() [1/2]

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::replyChunked ( const char *  contentType,
int  status = 200,
const char *  msg = SUCCESS 
)
inlineoverridevirtual

◆ replyChunked() [2/2]

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::replyChunked ( const char *  contentType,
Stream &  inputStream,
int  status = 200,
const char *  msg = SUCCESS 
)
inlineoverridevirtual

◆ replyError()

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::replyError ( int  err,
const char *  msg = "Internal Server Error" 
)
inlineoverridevirtual

◆ replyHeader()

template<typename ClientT >
HttpReplyHeader & tiny_dlna::HttpClientHandler< ClientT >::replyHeader ( )
inlinevirtual

◆ replyNotFound()

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::replyNotFound ( )
inlineoverridevirtual

◆ replyOK()

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::replyOK ( )
inlineoverridevirtual

◆ requestHeader()

template<typename ClientT >
HttpRequestHeader & tiny_dlna::HttpClientHandler< ClientT >::requestHeader ( )
inlinevirtual

◆ resize()

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::resize ( size_t  newSize)
inline

◆ setClient()

template<typename ClientT >
void tiny_dlna::HttpClientHandler< ClientT >::setClient ( ClientT *  client)
inline

Member Data Documentation

◆ buffer_size

template<typename ClientT >
int tiny_dlna::HttpClientHandler< ClientT >::buffer_size = 512
protected

◆ p_client

template<typename ClientT >
ClientT* tiny_dlna::HttpClientHandler< ClientT >::p_client = nullptr
protected

◆ reply_header

template<typename ClientT >
HttpReplyHeader tiny_dlna::HttpClientHandler< ClientT >::reply_header
protected

◆ request_header

template<typename ClientT >
HttpRequestHeader tiny_dlna::HttpClientHandler< ClientT >::request_header
protected

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