Arduino DLNA Server
|
A Simple Header only implementation of Http Server that allows the registration of callback functions. This is based on the Arduino Server class. More...
#include <HttpServer.h>
Public Member Functions | |
HttpServer (WiFiServer &server, int bufferSize=1024) | |
~HttpServer () | |
IPAddress & | localIP () |
Provides the local ip address. More... | |
bool | begin (int port, const char *ssid, const char *password) |
bool | begin (int port) |
Starts the server on the indicated port. More... | |
void | end () |
stops the server_ptr More... | |
void | rewrite (const char *from, const char *to) |
adds a rewrite rule More... | |
void | on (const char *url, TinyMethodID method, web_callback_fn fn, void *ctx[]=nullptr, int ctxCount=0) |
register a generic handler More... | |
void | on (const char *url, TinyMethodID method, const char *mime, web_callback_fn fn) |
register a handler with mime More... | |
void | on (const char *url, TinyMethodID method, const char *mime, const char *result) |
register a handler which provides the indicated string More... | |
void | on (const char *url, TinyMethodID method, const char *mime, const uint8_t *data, int len) |
register a handler which provides the indicated string More... | |
void | on (const char *url, TinyMethodID method, Url &redirect) |
register a redirection More... | |
void | on (const char *url, TinyMethodID method, HttpTunnel &tunnel) |
register a redirection More... | |
bool | onRequest (const char *path) |
void | replyChunked (const char *contentType, Stream &inputStream, int status=200, const char *msg=SUCCESS) |
chunked reply with data from an input stream More... | |
void | replyChunked (const char *contentType, int status=200, const char *msg=SUCCESS) |
start of chunked reply: use HttpChunkWriter to provde the data More... | |
void | reply (const char *contentType, Stream &inputStream, int size, int status=200, const char *msg=SUCCESS) |
write reply - copies data from input stream with header size More... | |
void | reply (const char *contentType, void(*callback)(Stream &out), int status=200, const char *msg=SUCCESS) |
write reply - using callback that writes to stream More... | |
void | reply (const char *contentType, void(*callback)(Print &out), int status=200, const char *msg=SUCCESS) |
write reply - using callback that writes to stream More... | |
void | reply (const char *contentType, const char *str, int status=200, const char *msg=SUCCESS) |
write reply - string with header size More... | |
void | reply (const char *contentType, const uint8_t *str, int len, int status=200, const char *msg=SUCCESS) |
void | replyOK () |
write OK reply with 200 SUCCESS More... | |
void | replyNotFound () |
write 404 reply More... | |
void | reply (int status, const char *msg) |
Writes the status and message to the reply. More... | |
HttpRequestHeader & | requestHeader () |
provides the request header More... | |
HttpReplyHeader & | replyHeader () |
provides the reply header More... | |
void | endClient () |
closes the connection to the current client_ptr More... | |
void | crlf () |
print a CR LF More... | |
void | addHandler (HttpRequestHandlerLine *handlerLinePtr) |
adds a new handler More... | |
bool | doLoop () |
Legacy method: same as copy();. More... | |
bool | copy () |
Call this method from your loop! More... | |
Client & | client () |
Provides the current client. More... | |
operator bool () | |
Provides true if the server has been started. More... | |
const char * | localHost () |
Determines the local ip address. More... | |
void | setNoConnectDelay (int delay) |
Str | contentStr () |
converts the client content to a string More... | |
Protected Member Functions | |
const char * | nullstr (const char *in) |
Converts null to an empty string. More... | |
void | processRequest () |
const char * | resolveRewrite (const char *from) |
bool | matchesMime (const char *handler_mime, const char *request_mime) |
Protected Attributes | |
HttpRequestHeader | request_header |
HttpReplyHeader | reply_header |
List< HttpRequestHandlerLine * > | handler_collection |
List< HttpRequestRewrite * > | rewrite_collection |
Client * | client_ptr |
WiFiServer * | server_ptr |
bool | is_active |
Vector< char > | buffer {0} |
const char * | local_host = nullptr |
int | no_connect_delay = 5 |
A Simple Header only implementation of Http Server that allows the registration of callback functions. This is based on the Arduino Server class.
|
inline |
|
inline |
|
inline |
adds a new handler
|
inline |
Starts the server on the indicated port.
|
inline |
Starts the server on the indicated port - calls WiFi.begin(ssid, password);
|
inline |
Provides the current client.
|
inline |
converts the client content to a string
|
inline |
Call this method from your loop!
|
inline |
print a CR LF
|
inline |
Legacy method: same as copy();.
|
inline |
stops the server_ptr
|
inline |
closes the connection to the current client_ptr
|
inline |
Determines the local ip address.
|
inline |
Provides the local ip address.
|
inlineprotected |
compares mime of handler with mime of request: provides true if they match of one is null (=any value)
|
inlineprotected |
Converts null to an empty string.
|
inline |
register a handler which provides the indicated string
|
inline |
register a handler which provides the indicated string
|
inline |
register a handler with mime
|
inline |
register a redirection
|
inline |
register a redirection
|
inline |
register a generic handler
|
inline |
generic handler - you can overwrite this method to provide your specifc processing logic
|
inline |
Provides true if the server has been started.
|
inlineprotected |
|
inline |
write reply - string with header size
|
inline |
|
inline |
write reply - copies data from input stream with header size
|
inline |
write reply - using callback that writes to stream
|
inline |
write reply - using callback that writes to stream
|
inline |
Writes the status and message to the reply.
|
inline |
start of chunked reply: use HttpChunkWriter to provde the data
|
inline |
chunked reply with data from an input stream
|
inline |
provides the reply header
|
inline |
write 404 reply
|
inline |
write OK reply with 200 SUCCESS
|
inline |
provides the request header
|
inlineprotected |
determiens the potentially rewritten url which should be used for the further processing
|
inline |
adds a rewrite rule
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |