Arduino DLNA Server
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tiny_dlna::HttpRequest Class Reference

Simple API to process get, put, post, del http requests I tried to use Arduino HttpClient, but I did not manage to extract the mime type from streaming get requests. More...

#include <HttpRequest.h>

Collaboration diagram for tiny_dlna::HttpRequest:
Collaboration graph
[legend]

Public Member Functions

 HttpRequest ()
 
 HttpRequest (Client &client)
 
void setClient (Client &client)
 
void setHost (const char *host)
 
 operator bool ()
 
virtual bool connected ()
 
virtual int available ()
 
virtual void stop ()
 
virtual int post (Url &url, const char *mime, const char *data, int len=-1)
 
virtual int put (Url &url, const char *mime, const char *data, int len=-1)
 
virtual int del (Url &url, const char *mime=nullptr, const char *data=nullptr, int len=-1)
 
virtual int get (Url &url, const char *acceptMime=nullptr, const char *data=nullptr, int len=-1)
 
virtual int head (Url &url, const char *acceptMime=nullptr, const char *data=nullptr, int len=-1)
 
virtual int read (uint8_t *str, int len)
 
virtual int readln (uint8_t *str, int len, bool incl_nl=true)
 
virtual HttpReplyHeaderreply ()
 
virtual HttpRequestHeaderrequest ()
 
virtual void setAgent (const char *agent)
 
virtual void setConnection (const char *connection)
 
virtual void setAcceptsEncoding (const char *enc)
 
Client * client ()
 

Protected Member Functions

const char * str (const char *in)
 
virtual int connect (const char *ip, uint16_t port)
 
virtual int process (TinyMethodID action, Url &url, const char *mime, const char *data, int len=-1)
 

Protected Attributes

WiFiClient default_client
 
Client * client_ptr
 
Url url
 
HttpRequestHeader request_header
 
HttpReplyHeader reply_header
 
HttpChunkReader chunk_reader {reply_header}
 
Str host_name
 
const char * agent = nullptr
 
const char * connection = CON_CLOSE
 
const char * accept = ACCEPT_ALL
 
const char * accept_encoding = nullptr
 

Detailed Description

Simple API to process get, put, post, del http requests I tried to use Arduino HttpClient, but I did not manage to extract the mime type from streaming get requests.

The functionality is based on the Arduino Client class.

Constructor & Destructor Documentation

◆ HttpRequest() [1/2]

tiny_dlna::HttpRequest::HttpRequest ( )
inline

◆ HttpRequest() [2/2]

tiny_dlna::HttpRequest::HttpRequest ( Client &  client)
inline

Member Function Documentation

◆ available()

virtual int tiny_dlna::HttpRequest::available ( )
inlinevirtual

◆ client()

Client* tiny_dlna::HttpRequest::client ( )
inline

◆ connect()

virtual int tiny_dlna::HttpRequest::connect ( const char *  ip,
uint16_t  port 
)
inlineprotectedvirtual

◆ connected()

virtual bool tiny_dlna::HttpRequest::connected ( )
inlinevirtual

◆ del()

virtual int tiny_dlna::HttpRequest::del ( Url url,
const char *  mime = nullptr,
const char *  data = nullptr,
int  len = -1 
)
inlinevirtual

◆ get()

virtual int tiny_dlna::HttpRequest::get ( Url url,
const char *  acceptMime = nullptr,
const char *  data = nullptr,
int  len = -1 
)
inlinevirtual

◆ head()

virtual int tiny_dlna::HttpRequest::head ( Url url,
const char *  acceptMime = nullptr,
const char *  data = nullptr,
int  len = -1 
)
inlinevirtual

◆ operator bool()

tiny_dlna::HttpRequest::operator bool ( )
inline

◆ post()

virtual int tiny_dlna::HttpRequest::post ( Url url,
const char *  mime,
const char *  data,
int  len = -1 
)
inlinevirtual

◆ process()

virtual int tiny_dlna::HttpRequest::process ( TinyMethodID  action,
Url url,
const char *  mime,
const char *  data,
int  len = -1 
)
inlineprotectedvirtual

◆ put()

virtual int tiny_dlna::HttpRequest::put ( Url url,
const char *  mime,
const char *  data,
int  len = -1 
)
inlinevirtual

◆ read()

virtual int tiny_dlna::HttpRequest::read ( uint8_t *  str,
int  len 
)
inlinevirtual

◆ readln()

virtual int tiny_dlna::HttpRequest::readln ( uint8_t *  str,
int  len,
bool  incl_nl = true 
)
inlinevirtual

◆ reply()

virtual HttpReplyHeader& tiny_dlna::HttpRequest::reply ( )
inlinevirtual

◆ request()

virtual HttpRequestHeader& tiny_dlna::HttpRequest::request ( )
inlinevirtual

◆ setAcceptsEncoding()

virtual void tiny_dlna::HttpRequest::setAcceptsEncoding ( const char *  enc)
inlinevirtual

◆ setAgent()

virtual void tiny_dlna::HttpRequest::setAgent ( const char *  agent)
inlinevirtual

◆ setClient()

void tiny_dlna::HttpRequest::setClient ( Client &  client)
inline

◆ setConnection()

virtual void tiny_dlna::HttpRequest::setConnection ( const char *  connection)
inlinevirtual

◆ setHost()

void tiny_dlna::HttpRequest::setHost ( const char *  host)
inline

◆ stop()

virtual void tiny_dlna::HttpRequest::stop ( )
inlinevirtual

◆ str()

const char* tiny_dlna::HttpRequest::str ( const char *  in)
inlineprotected

Member Data Documentation

◆ accept

const char* tiny_dlna::HttpRequest::accept = ACCEPT_ALL
protected

◆ accept_encoding

const char* tiny_dlna::HttpRequest::accept_encoding = nullptr
protected

◆ agent

const char* tiny_dlna::HttpRequest::agent = nullptr
protected

◆ chunk_reader

HttpChunkReader tiny_dlna::HttpRequest::chunk_reader {reply_header}
protected

◆ client_ptr

Client* tiny_dlna::HttpRequest::client_ptr
protected

◆ connection

const char* tiny_dlna::HttpRequest::connection = CON_CLOSE
protected

◆ default_client

WiFiClient tiny_dlna::HttpRequest::default_client
protected

◆ host_name

Str tiny_dlna::HttpRequest::host_name
protected

◆ reply_header

HttpReplyHeader tiny_dlna::HttpRequest::reply_header
protected

◆ request_header

HttpRequestHeader tiny_dlna::HttpRequest::request_header
protected

◆ url

Url tiny_dlna::HttpRequest::url
protected

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