32
32
33
33
enum HTTPUploadStatus { UPLOAD_FILE_START, UPLOAD_FILE_WRITE, UPLOAD_FILE_END,
34
34
UPLOAD_FILE_ABORTED };
35
+ enum HTTPRawStatus { RAW_START, RAW_WRITE, RAW_END, RAW_ABORTED };
35
36
enum HTTPClientStatus { HC_NONE, HC_WAIT_READ, HC_WAIT_CLOSE };
36
37
enum HTTPAuthMethod { BASIC_AUTH, DIGEST_AUTH };
37
38
@@ -41,6 +42,10 @@ enum HTTPAuthMethod { BASIC_AUTH, DIGEST_AUTH };
41
42
#define HTTP_UPLOAD_BUFLEN 1436
42
43
#endif
43
44
45
+ #ifndef HTTP_RAW_BUFLEN
46
+ #define HTTP_RAW_BUFLEN 1436
47
+ #endif
48
+
44
49
#define HTTP_MAX_DATA_WAIT 5000 // ms to wait for the client to send the request
45
50
#define HTTP_MAX_POST_WAIT 5000 // ms to wait for POST data to arrive
46
51
#define HTTP_MAX_SEND_WAIT 5000 // ms to wait for data chunk to be ACKed
@@ -61,6 +66,15 @@ typedef struct {
61
66
uint8_t buf[HTTP_UPLOAD_BUFLEN];
62
67
} HTTPUpload;
63
68
69
+ typedef struct
70
+ {
71
+ HTTPRawStatus status;
72
+ size_t totalSize; // content size
73
+ size_t currentSize; // size of data currently in buf
74
+ uint8_t buf[HTTP_UPLOAD_BUFLEN];
75
+ void *data; // additional data
76
+ } HTTPRaw;
77
+
64
78
#include " detail/RequestHandler.h"
65
79
66
80
namespace fs {
@@ -97,6 +111,7 @@ class WebServer
97
111
HTTPMethod method () { return _currentMethod; }
98
112
virtual WiFiClient client () { return _currentClient; }
99
113
HTTPUpload& upload () { return *_currentUpload; }
114
+ HTTPRaw& raw () { return *_currentRaw; }
100
115
101
116
String pathArg (unsigned int i); // get request path argument by number
102
117
String arg (String name); // get request argument value by name
@@ -196,6 +211,7 @@ class WebServer
196
211
RequestArgument* _postArgs;
197
212
198
213
std::unique_ptr<HTTPUpload> _currentUpload;
214
+ std::unique_ptr<HTTPRaw> _currentRaw;
199
215
200
216
int _headerKeysCount;
201
217
RequestArgument* _currentHeaders;
0 commit comments