1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-28 05:01:28 +03:00

Improvements to the existing ETag implementation (#8227)

* WebServer eTag implementation improvements
This commit is contained in:
Matthias Hertel
2021-09-29 11:58:40 +02:00
committed by GitHub
parent 193043d19b
commit 3f4bcbe483
10 changed files with 708 additions and 15 deletions

View File

@ -114,6 +114,8 @@ public:
void requestAuthentication(HTTPAuthMethod mode = BASIC_AUTH, const char* realm = NULL, const String& authFailMsg = String("") );
typedef std::function<void(void)> THandlerFunction;
typedef std::function<String(FS &fs, const String &fName)> ETagFunction;
void on(const Uri &uri, THandlerFunction handler);
void on(const Uri &uri, HTTPMethod method, THandlerFunction fn);
void on(const Uri &uri, HTTPMethod method, THandlerFunction fn, THandlerFunction ufn);
@ -122,6 +124,7 @@ public:
void onNotFound(THandlerFunction fn); //called when handler is not assigned
void onFileUpload(THandlerFunction fn); //handle file uploads
void enableCORS(bool enable);
void enableETag(bool enable, ETagFunction fn = nullptr);
const String& uri() const { return _currentUri; }
HTTPMethod method() const { return _currentMethod; }
@ -271,6 +274,9 @@ public:
}
}
bool _eTagEnabled = false;
ETagFunction _eTagFunction = nullptr;
protected:
void _addRequestHandler(RequestHandlerType* handler);
void _handleRequest();