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:
@ -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();
|
||||
|
Reference in New Issue
Block a user