ESP_IOT v2.5
IOT ESP Coding
|
#include <WebServer.h>
Classes | |
struct | RequestArgument |
Public Types | |
typedef std::function< void(void)> | THandlerFunction |
Public Member Functions | |
WebServer (IPAddress addr, int port=80) | |
WebServer (int port=80) | |
~WebServer () | |
void | begin () |
void | handleClient () |
void | close () |
void | stop () |
bool | authenticate (const char *username, const char *password) |
void | requestAuthentication () |
void | on (const String &uri, THandlerFunction handler) |
void | on (const String &uri, HTTPMethod method, THandlerFunction fn) |
void | on (const String &uri, HTTPMethod method, THandlerFunction fn, THandlerFunction ufn) |
void | addHandler (RequestHandler *handler) |
void | serveStatic (const char *uri, fs::FS &fs, const char *path, const char *cache_header=NULL) |
void | onNotFound (THandlerFunction fn) |
void | onFileUpload (THandlerFunction fn) |
String | uri () |
HTTPMethod | method () |
WiFiClient | client () |
HTTPUpload & | upload () |
String | arg (String name) |
String | arg (int i) |
String | argName (int i) |
int | args () |
bool | hasArg (String name) |
void | collectHeaders (const char *headerKeys[], const size_t headerKeysCount) |
String | header (String name) |
String | header (int i) |
String | headerName (int i) |
int | headers () |
bool | hasHeader (String name) |
String | hostHeader () |
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 | 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 | setContentLength (size_t contentLength) |
void | sendHeader (const String &name, const String &value, bool first=false) |
void | sendContent (const String &content) |
void | sendContent_P (PGM_P content) |
void | sendContent_P (PGM_P content, size_t size) |
template<typename T > | |
size_t | streamFile (T &file, const String &contentType) |
Static Public Member Functions | |
static String | urlDecode (const String &text) |
Protected Member Functions | |
void | _addRequestHandler (RequestHandler *handler) |
void | _handleRequest () |
bool | _parseRequest (WiFiClient &client) |
void | _parseArguments (String data) |
bool | _parseForm (WiFiClient &client, String boundary, uint32_t len) |
bool | _parseFormUploadAborted () |
void | _uploadWriteByte (uint8_t b) |
uint8_t | _uploadReadByte (WiFiClient &client) |
void | _prepareHeader (String &response, int code, const char *content_type, size_t contentLength) |
bool | _collectHeader (const char *headerName, const char *headerValue) |
Static Protected Member Functions | |
static String | _responseCodeToString (int code) |
Protected Attributes | |
WiFiServer | _server |
WiFiClient | _currentClient |
HTTPMethod | _currentMethod |
String | _currentUri |
uint8_t | _currentVersion |
HTTPClientStatus | _currentStatus |
unsigned long | _statusChange |
RequestHandler * | _currentHandler |
RequestHandler * | _firstHandler |
RequestHandler * | _lastHandler |
THandlerFunction | _notFoundHandler |
THandlerFunction | _fileUploadHandler |
int | _currentArgCount |
RequestArgument * | _currentArgs |
HTTPUpload | _currentUpload |
int | _headerKeysCount |
RequestArgument * | _currentHeaders |
size_t | _contentLength |
String | _responseHeaders |
String | _hostHeader |
bool | _chunked |
Definition at line 66 of file WebServer.h.
typedef std::function<void(void)> WebServer::THandlerFunction |
Definition at line 82 of file WebServer.h.
WebServer::WebServer | ( | IPAddress | addr, |
int | port = 80 |
||
) |
Definition at line 44 of file WebServer.cpp.
WebServer::WebServer | ( | int | port = 80 | ) |
Definition at line 62 of file WebServer.cpp.
WebServer::~WebServer | ( | ) |
|
protected |
Definition at line 154 of file WebServer.cpp.
|
protected |
Definition at line 259 of file Parsing.cpp.
|
protected |
Definition at line 456 of file WebServer.cpp.
|
protected |
|
protected |
|
protected |
Definition at line 603 of file Parsing.cpp.
|
protected |
Definition at line 67 of file Parsing.cpp.
|
protected |
Definition at line 259 of file WebServer.cpp.
|
staticprotected |
|
protected |
Definition at line 354 of file Parsing.cpp.
|
protected |
Definition at line 344 of file Parsing.cpp.
void WebServer::addHandler | ( | RequestHandler * | handler | ) |
String WebServer::arg | ( | int | i | ) |
Definition at line 376 of file WebServer.cpp.
String WebServer::arg | ( | String | name | ) |
String WebServer::argName | ( | int | i | ) |
int WebServer::args | ( | ) |
Definition at line 388 of file WebServer.cpp.
bool WebServer::authenticate | ( | const char * | username, |
const char * | password | ||
) |
void WebServer::begin | ( | ) |
Definition at line 93 of file WebServer.cpp.
|
inline |
void WebServer::close | ( | ) |
void WebServer::collectHeaders | ( | const char * | headerKeys[], |
const size_t | headerKeysCount | ||
) |
void WebServer::handleClient | ( | ) |
Definition at line 169 of file WebServer.cpp.
bool WebServer::hasArg | ( | String | name | ) |
bool WebServer::hasHeader | ( | String | name | ) |
String WebServer::header | ( | int | i | ) |
Definition at line 420 of file WebServer.cpp.
String WebServer::header | ( | String | name | ) |
String WebServer::headerName | ( | int | i | ) |
int WebServer::headers | ( | ) |
Definition at line 432 of file WebServer.cpp.
String WebServer::hostHeader | ( | ) |
Definition at line 444 of file WebServer.cpp.
|
inline |
void WebServer::on | ( | const String & | uri, |
HTTPMethod | method, | ||
WebServer::THandlerFunction | fn | ||
) |
void WebServer::on | ( | const String & | uri, |
HTTPMethod | method, | ||
WebServer::THandlerFunction | fn, | ||
WebServer::THandlerFunction | ufn | ||
) |
void WebServer::on | ( | const String & | uri, |
WebServer::THandlerFunction | handler | ||
) |
Definition at line 138 of file WebServer.cpp.
void WebServer::onFileUpload | ( | THandlerFunction | fn | ) |
Definition at line 448 of file WebServer.cpp.
void WebServer::onNotFound | ( | THandlerFunction | fn | ) |
void WebServer::requestAuthentication | ( | ) |
void WebServer::send | ( | int | code, |
char * | content_type, | ||
const String & | content | ||
) |
void WebServer::send | ( | int | code, |
const char * | content_type = NULL , |
||
const String & | content = String("") |
||
) |
Definition at line 287 of file WebServer.cpp.
void WebServer::send | ( | int | code, |
const String & | content_type, | ||
const String & | content | ||
) |
void WebServer::send_P | ( | int | code, |
PGM_P | content_type, | ||
PGM_P | content | ||
) |
void WebServer::send_P | ( | int | code, |
PGM_P | content_type, | ||
PGM_P | content, | ||
size_t | contentLength | ||
) |
void WebServer::sendContent | ( | const String & | content | ) |
void WebServer::sendContent_P | ( | PGM_P | content | ) |
Definition at line 347 of file WebServer.cpp.
void WebServer::sendContent_P | ( | PGM_P | content, |
size_t | size | ||
) |
Definition at line 351 of file WebServer.cpp.
void WebServer::sendHeader | ( | const String & | name, |
const String & | value, | ||
bool | first = false |
||
) |
void WebServer::serveStatic | ( | const char * | uri, |
fs::FS & | fs, | ||
const char * | path, | ||
const char * | cache_header = NULL |
||
) |
void WebServer::setContentLength | ( | size_t | contentLength | ) |
void WebServer::stop | ( | ) |
|
inline |
Definition at line 128 of file WebServer.h.
|
inline |
Definition at line 94 of file WebServer.h.
|
inline |
|
static |
|
protected |
Definition at line 182 of file WebServer.h.
|
protected |
Definition at line 178 of file WebServer.h.
|
protected |
Definition at line 172 of file WebServer.h.
|
protected |
Definition at line 173 of file WebServer.h.
|
protected |
Definition at line 159 of file WebServer.h.
|
protected |
Definition at line 166 of file WebServer.h.
|
protected |
Definition at line 177 of file WebServer.h.
|
protected |
Definition at line 160 of file WebServer.h.
|
protected |
Definition at line 163 of file WebServer.h.
|
protected |
Definition at line 174 of file WebServer.h.
|
protected |
Definition at line 161 of file WebServer.h.
|
protected |
Definition at line 162 of file WebServer.h.
|
protected |
Definition at line 170 of file WebServer.h.
|
protected |
Definition at line 167 of file WebServer.h.
|
protected |
Definition at line 176 of file WebServer.h.
|
protected |
Definition at line 181 of file WebServer.h.
|
protected |
Definition at line 168 of file WebServer.h.
|
protected |
Definition at line 169 of file WebServer.h.
|
protected |
Definition at line 179 of file WebServer.h.
|
protected |
Definition at line 157 of file WebServer.h.
|
protected |
Definition at line 164 of file WebServer.h.