Class WebServer
ClassList > WebServer
Public Types
Public Functions
Type |
Name |
|
WebServer (IPAddress addr, int port=80)
|
|
WebServer (int port=80)
|
void |
addHandler (RequestHandler * handler)
|
String |
arg (String name)
|
String |
arg (int i)
|
String |
argName (int i)
|
int |
args ()
|
bool |
authenticate (const char * username, const char * password)
|
virtual void |
begin ()
|
virtual void |
begin (uint16_t port)
|
virtual WiFiClient |
client ()
|
virtual void |
close ()
|
void |
collectHeaders (const char * headerKeys, const size_t headerKeysCount)
|
void |
enableCORS (boolean value=true)
|
void |
enableCrossOrigin (boolean value=true)
|
void |
enableDelay (boolean value)
|
virtual void |
handleClient ()
|
bool |
hasArg (String name)
|
bool |
hasHeader (String name)
|
String |
header (String name)
|
String |
header (int i)
|
String |
headerName (int i)
|
int |
headers ()
|
String |
hostHeader ()
|
HTTPMethod |
method ()
|
void |
on (const Uri & uri, THandlerFunction fn)
|
void |
on (const Uri & uri, HTTPMethod method, THandlerFunction fn)
|
void |
on (const Uri & uri, HTTPMethod method, THandlerFunction fn, THandlerFunction ufn)
|
void |
onFileUpload (THandlerFunction ufn)
|
void |
onNotFound (THandlerFunction fn)
|
String |
pathArg (unsigned int i)
|
void |
requestAuthentication (HTTPAuthMethod mode=BASIC_AUTH, const char * realm=NULL, const String & authFailMsg=String(""))
|
void |
send (int code, const char * content_type=NULL, const String & content=String(""))
|
void |
send (int code, char * content_type, const String & content)
|
void |
send (int code, const String & content_type, const String & content)
|
void |
sendContent (const String & content)
|
void |
sendContent (const char * content, size_t contentLength)
|
void |
sendContent_P (PGM_P content)
|
void |
sendContent_P (PGM_P content, size_t size)
|
void |
sendHeader (const String & name, const String & value, bool first=false)
|
void |
send_P (int code, PGM_P content_type, PGM_P content)
|
void |
send_P (int code, PGM_P content_type, PGM_P content, size_t contentLength)
|
void |
serveStatic (const char * uri, fs::FS & fs, const char * path, const char * cache_header=NULL)
|
void |
setContentLength (const size_t contentLength)
|
void |
stop ()
|
size_t |
streamFile (T & file, const String & contentType)
|
HTTPUpload & |
upload ()
|
String |
uri ()
|
virtual |
~WebServer ()
|
Public Static Functions
Type |
Name |
String |
urlDecode (const String & text)
|
Protected Attributes
Protected Functions
Type |
Name |
void |
_addRequestHandler (RequestHandler * handler)
|
bool |
_collectHeader (const char * headerName, const char * headerValue)
|
virtual size_t |
_currentClientWrite (const char * b, size_t l)
|
virtual size_t |
_currentClientWrite_P (PGM_P b, size_t l)
|
String |
_extractParam (String & authReq, const String & param, const char delimit='"')
|
void |
_finalizeResponse ()
|
String |
_getRandomHexString ()
|
void |
_handleRequest ()
|
void |
_parseArguments (String data)
|
bool |
_parseForm (WiFiClient & client, String boundary, uint32_t len)
|
bool |
_parseFormUploadAborted ()
|
bool |
_parseRequest (WiFiClient & client)
|
void |
_prepareHeader (String & response, int code, const char * content_type, size_t contentLength)
|
void |
_streamFileCore (const size_t fileSize, const String & fileName, const String & contentType)
|
int |
_uploadReadByte (WiFiClient & client)
|
void |
_uploadWriteByte (uint8_t b)
|
Protected Static Functions
Public Types Documentation
typedef THandlerFunction
typedef std::function<void(void)> WebServer::THandlerFunction;
Public Functions Documentation
function WebServer [1/2]
WebServer::WebServer (
IPAddress addr,
int port=80
)
function WebServer [2/2]
WebServer::WebServer (
int port=80
)
function addHandler
void WebServer::addHandler (
RequestHandler * handler
)
function arg [1/2]
String WebServer::arg (
String name
)
function arg [2/2]
String WebServer::arg (
int i
)
function argName
String WebServer::argName (
int i
)
function args
function authenticate
bool WebServer::authenticate (
const char * username,
const char * password
)
function begin [1/2]
virtual void WebServer::begin ()
function begin [2/2]
virtual void WebServer::begin (
uint16_t port
)
function client
inline virtual WiFiClient WebServer::client ()
function close
virtual void WebServer::close ()
void WebServer::collectHeaders (
const char * headerKeys,
const size_t headerKeysCount
)
function enableCORS
void WebServer::enableCORS (
boolean value=true
)
function enableCrossOrigin
void WebServer::enableCrossOrigin (
boolean value=true
)
function enableDelay
void WebServer::enableDelay (
boolean value
)
function handleClient
virtual void WebServer::handleClient ()
function hasArg
bool WebServer::hasArg (
String name
)
bool WebServer::hasHeader (
String name
)
String WebServer::header (
String name
)
String WebServer::header (
int i
)
String WebServer::headerName (
int i
)
int WebServer::headers ()
String WebServer::hostHeader ()
function method
inline HTTPMethod WebServer::method ()
function on [1/3]
void WebServer::on (
const Uri & uri,
THandlerFunction fn
)
function on [2/3]
void WebServer::on (
const Uri & uri,
HTTPMethod method,
THandlerFunction fn
)
function on [3/3]
void WebServer::on (
const Uri & uri,
HTTPMethod method,
THandlerFunction fn,
THandlerFunction ufn
)
function onFileUpload
void WebServer::onFileUpload (
THandlerFunction ufn
)
function onNotFound
void WebServer::onNotFound (
THandlerFunction fn
)
function pathArg
String WebServer::pathArg (
unsigned int i
)
function requestAuthentication
void WebServer::requestAuthentication (
HTTPAuthMethod mode=BASIC_AUTH,
const char * realm=NULL,
const String & authFailMsg=String("")
)
function send [1/3]
void WebServer::send (
int code,
const char * content_type=NULL,
const String & content=String("")
)
function send [2/3]
void WebServer::send (
int code,
char * content_type,
const String & content
)
function send [3/3]
void WebServer::send (
int code,
const String & content_type,
const String & content
)
function sendContent [1/2]
void WebServer::sendContent (
const String & content
)
function sendContent [2/2]
void WebServer::sendContent (
const char * content,
size_t contentLength
)
function sendContent_P [1/2]
void WebServer::sendContent_P (
PGM_P content
)
function sendContent_P [2/2]
void WebServer::sendContent_P (
PGM_P content,
size_t size
)
void WebServer::sendHeader (
const String & name,
const String & value,
bool first=false
)
function send_P [1/2]
void WebServer::send_P (
int code,
PGM_P content_type,
PGM_P content
)
function send_P [2/2]
void WebServer::send_P (
int code,
PGM_P content_type,
PGM_P content,
size_t contentLength
)
function serveStatic
void WebServer::serveStatic (
const char * uri,
fs::FS & fs,
const char * path,
const char * cache_header=NULL
)
function setContentLength
void WebServer::setContentLength (
const size_t contentLength
)
function stop
function streamFile
template<typename T typename T>
inline size_t WebServer::streamFile (
T & file,
const String & contentType
)
function upload
inline HTTPUpload & WebServer::upload ()
function uri
inline String WebServer::uri ()
function ~WebServer
virtual WebServer::~WebServer ()
Public Static Functions Documentation
function urlDecode
static String WebServer::urlDecode (
const String & text
)
Protected Attributes Documentation
variable _chunked
bool WebServer::_chunked;
variable _contentLength
size_t WebServer::_contentLength;
variable _corsEnabled
boolean WebServer::_corsEnabled;
variable _currentArgCount
int WebServer::_currentArgCount;
variable _currentArgs
RequestArgument* WebServer::_currentArgs;
variable _currentClient
WiFiClient WebServer::_currentClient;
variable _currentHandler
RequestHandler* WebServer::_currentHandler;
RequestArgument* WebServer::_currentHeaders;
variable _currentMethod
HTTPMethod WebServer::_currentMethod;
variable _currentStatus
HTTPClientStatus WebServer::_currentStatus;
variable _currentUpload
std::unique_ptr<HTTPUpload> WebServer::_currentUpload;
variable _currentUri
String WebServer::_currentUri;
variable _currentVersion
uint8_t WebServer::_currentVersion;
variable _fileUploadHandler
THandlerFunction WebServer::_fileUploadHandler;
variable _firstHandler
RequestHandler* WebServer::_firstHandler;
int WebServer::_headerKeysCount;
String WebServer::_hostHeader;
variable _lastHandler
RequestHandler* WebServer::_lastHandler;
variable _notFoundHandler
THandlerFunction WebServer::_notFoundHandler;
variable _nullDelay
boolean WebServer::_nullDelay;
variable _postArgs
RequestArgument* WebServer::_postArgs;
variable _postArgsLen
int WebServer::_postArgsLen;
String WebServer::_responseHeaders;
variable _server
WiFiServer WebServer::_server;
variable _snonce
String WebServer::_snonce;
variable _sopaque
String WebServer::_sopaque;
variable _srealm
String WebServer::_srealm;
variable _statusChange
unsigned long WebServer::_statusChange;
Protected Functions Documentation
function _addRequestHandler
void WebServer::_addRequestHandler (
RequestHandler * handler
)
bool WebServer::_collectHeader (
const char * headerName,
const char * headerValue
)
function _currentClientWrite
inline virtual size_t WebServer::_currentClientWrite (
const char * b,
size_t l
)
function _currentClientWrite_P
inline virtual size_t WebServer::_currentClientWrite_P (
PGM_P b,
size_t l
)
String WebServer::_extractParam (
String & authReq,
const String & param,
const char delimit='"'
)
function _finalizeResponse
void WebServer::_finalizeResponse ()
function _getRandomHexString
String WebServer::_getRandomHexString ()
function _handleRequest
void WebServer::_handleRequest ()
function _parseArguments
void WebServer::_parseArguments (
String data
)
bool WebServer::_parseForm (
WiFiClient & client,
String boundary,
uint32_t len
)
bool WebServer::_parseFormUploadAborted ()
function _parseRequest
bool WebServer::_parseRequest (
WiFiClient & client
)
void WebServer::_prepareHeader (
String & response,
int code,
const char * content_type,
size_t contentLength
)
function _streamFileCore
void WebServer::_streamFileCore (
const size_t fileSize,
const String & fileName,
const String & contentType
)
function _uploadReadByte
int WebServer::_uploadReadByte (
WiFiClient & client
)
function _uploadWriteByte
void WebServer::_uploadWriteByte (
uint8_t b
)
Protected Static Functions Documentation
function _responseCodeToString
static String WebServer::_responseCodeToString (
int code
)
The documentation for this class was generated from the following file cores/common/arduino/libraries/ext/WebServer/WebServer.h