merge master
This commit is contained in:
@@ -26,7 +26,9 @@
|
||||
#include <libb64/cencode.h>
|
||||
#include "WiFiClient.h"
|
||||
#include "WebServer.h"
|
||||
#include "FS.h"
|
||||
#ifdef WEBSERVER_ENABLE_STATIC_CONTENT
|
||||
#include "FS.h"
|
||||
#endif
|
||||
#include "detail/RequestHandlersImpl.h"
|
||||
#include "mbedtls/md5.h"
|
||||
|
||||
@@ -258,9 +260,11 @@ void WebServer::_addRequestHandler(RequestHandler* handler) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WEBSERVER_ENABLE_STATIC_CONTENT
|
||||
void WebServer::serveStatic(const char* uri, FS& fs, const char* path, const char* cache_header) {
|
||||
_addRequestHandler(new StaticRequestHandler(fs, path, uri, cache_header));
|
||||
}
|
||||
#endif
|
||||
|
||||
void WebServer::handleClient() {
|
||||
if (_currentStatus == HC_NONE) {
|
||||
|
||||
@@ -90,7 +90,9 @@ public:
|
||||
void on(const Uri &uri, HTTPMethod method, THandlerFunction fn);
|
||||
void on(const Uri &uri, HTTPMethod method, THandlerFunction fn, THandlerFunction ufn);
|
||||
void addHandler(RequestHandler* handler);
|
||||
#ifdef WEBSERVER_ENABLE_STATIC_CONTENT
|
||||
void serveStatic(const char* uri, fs::FS& fs, const char* path, const char* cache_header = NULL );
|
||||
#endif
|
||||
void onNotFound(THandlerFunction fn); //called when handler is not assigned
|
||||
void onFileUpload(THandlerFunction fn); //handle file uploads
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ protected:
|
||||
HTTPMethod _method;
|
||||
};
|
||||
|
||||
#ifdef WEBSERVER_ENABLE_STATIC_CONTENT
|
||||
class StaticRequestHandler : public RequestHandler {
|
||||
public:
|
||||
StaticRequestHandler(FS& fs, const char* path, const char* uri, const char* cache_header)
|
||||
@@ -146,6 +147,6 @@ protected:
|
||||
bool _isFile;
|
||||
size_t _baseUriLength;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif //REQUESTHANDLERSIMPL_H
|
||||
|
||||
@@ -11,9 +11,15 @@ the LICENSE file.
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
// Logging is en/disabled by Arduino framework macros
|
||||
#include <esp32-hal-log.h>
|
||||
#define emc_log_i(...) log_i(__VA_ARGS__)
|
||||
#define emc_log_e(...) log_e(__VA_ARGS__)
|
||||
#define emc_log_w(...) log_w(__VA_ARGS__)
|
||||
#if defined(DEBUG_ESP_MQTT_CLIENT)
|
||||
#define emc_log_i(...) log_i(__VA_ARGS__)
|
||||
#define emc_log_e(...) log_e(__VA_ARGS__)
|
||||
#define emc_log_w(...) log_w(__VA_ARGS__)
|
||||
#else
|
||||
#define emc_log_i(...)
|
||||
#define emc_log_e(...)
|
||||
#define emc_log_w(...)
|
||||
#endif
|
||||
#elif defined(ARDUINO_ARCH_ESP8266)
|
||||
#if defined(DEBUG_ESP_PORT) && defined(DEBUG_ESP_MQTT_CLIENT)
|
||||
#include <Arduino.h>
|
||||
|
||||
Reference in New Issue
Block a user