mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-18 17:42:23 +03:00
Add Uri with support for regexUri and globUri (#6696)
* Add path args * Add example * Update code format * Add missing include * Fix codestyle and unsigned int * fix unsigned int * Remove tabs * use vector<>.resize * rename j to requestUriIndex * using assert checking the path argument index * Add missing include "assert.h" * The order no longer matters. Path arguments may not contain the value '/' Updated the example * make pathArg return a const * Update PathArgServer.ino fix trailing space * const String& * Add regex support * Fix to match templating * Add Uri with support for staticUri, regexUri and globUri * Update example * Add deconstructor to remove _uri pointer * Add newline to end of files * Suppress gcc warnings (unused params) * Replace regex with regex.h * Use the standard STASSID/PSK settings for example Make the example match the existing examples which allow setting the SSID/PSK in the local platform.txt file. * Use 115.2Kbaud for example, match others Co-authored-by: david gauchard <gauchard@laas.fr> Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
This commit is contained in:
@@ -263,17 +263,17 @@ void ESP8266WebServerTemplate<ServerType>::requestAuthentication(HTTPAuthMethod
|
||||
}
|
||||
|
||||
template <typename ServerType>
|
||||
void ESP8266WebServerTemplate<ServerType>::on(const String &uri, ESP8266WebServerTemplate<ServerType>::THandlerFunction handler) {
|
||||
void ESP8266WebServerTemplate<ServerType>::on(const Uri &uri, ESP8266WebServerTemplate<ServerType>::THandlerFunction handler) {
|
||||
on(uri, HTTP_ANY, handler);
|
||||
}
|
||||
|
||||
template <typename ServerType>
|
||||
void ESP8266WebServerTemplate<ServerType>::on(const String &uri, HTTPMethod method, ESP8266WebServerTemplate<ServerType>::THandlerFunction fn) {
|
||||
void ESP8266WebServerTemplate<ServerType>::on(const Uri &uri, HTTPMethod method, ESP8266WebServerTemplate<ServerType>::THandlerFunction fn) {
|
||||
on(uri, method, fn, _fileUploadHandler);
|
||||
}
|
||||
|
||||
template <typename ServerType>
|
||||
void ESP8266WebServerTemplate<ServerType>::on(const String &uri, HTTPMethod method, ESP8266WebServerTemplate<ServerType>::THandlerFunction fn, ESP8266WebServerTemplate<ServerType>::THandlerFunction ufn) {
|
||||
void ESP8266WebServerTemplate<ServerType>::on(const Uri &uri, HTTPMethod method, ESP8266WebServerTemplate<ServerType>::THandlerFunction fn, ESP8266WebServerTemplate<ServerType>::THandlerFunction ufn) {
|
||||
_addRequestHandler(new FunctionRequestHandler<ServerType>(fn, ufn, uri, method));
|
||||
}
|
||||
|
||||
@@ -544,6 +544,12 @@ void ESP8266WebServerTemplate<ServerType>::_streamFileCore(const size_t fileSize
|
||||
send(200, contentType, emptyString);
|
||||
}
|
||||
|
||||
template <typename ServerType>
|
||||
const String& ESP8266WebServerTemplate<ServerType>::pathArg(unsigned int i) const {
|
||||
if (_currentHandler != nullptr)
|
||||
return _currentHandler->pathArg(i);
|
||||
return emptyString;
|
||||
}
|
||||
|
||||
template <typename ServerType>
|
||||
const String& ESP8266WebServerTemplate<ServerType>::arg(const String& name) const {
|
||||
|
Reference in New Issue
Block a user