1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

Make RequestHandler handle uploads

This commit is contained in:
Me No Dev
2015-11-19 22:52:52 +02:00
parent 20f372aefe
commit 50eb6d9ff2
5 changed files with 77 additions and 28 deletions

View File

@ -40,12 +40,6 @@ enum HTTPUploadStatus { UPLOAD_FILE_START, UPLOAD_FILE_WRITE, UPLOAD_FILE_END,
class ESP8266WebServer;
#include "detail/RequestHandler.h"
namespace fs {
class FS;
}
typedef struct {
HTTPUploadStatus status;
String filename;
@ -56,6 +50,12 @@ typedef struct {
uint8_t buf[HTTP_UPLOAD_BUFLEN];
} HTTPUpload;
#include "detail/RequestHandler.h"
namespace fs {
class FS;
}
class ESP8266WebServer
{
public:
@ -69,6 +69,7 @@ public:
typedef std::function<void(void)> THandlerFunction;
void on(const char* uri, THandlerFunction handler);
void on(const char* uri, HTTPMethod method, THandlerFunction fn);
void on(const char* 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); //called when handler is not assigned
@ -155,6 +156,7 @@ protected:
String _hostHeader;
RequestHandler* _currentHandler;
RequestHandler* _firstHandler;
RequestHandler* _lastHandler;
THandlerFunction _notFoundHandler;