This commit is contained in:
Pavel Brychta 2020-08-26 07:22:56 +02:00
parent 3e624dc304
commit fe274c7e5e
2 changed files with 45 additions and 11 deletions

View File

@ -59,14 +59,22 @@ class AsyncResponseStream;
#ifndef WEBSERVER_H
typedef enum {
HTTP_GET = 0b00000001,
HTTP_POST = 0b00000010,
HTTP_DELETE = 0b00000100,
HTTP_PUT = 0b00001000,
HTTP_PATCH = 0b00010000,
HTTP_HEAD = 0b00100000,
HTTP_OPTIONS = 0b01000000,
HTTP_ANY = 0b01111111,
HTTP_GET = 0b0000000000000001,
HTTP_POST = 0b0000000000000010,
HTTP_DELETE = 0b0000000000000100,
HTTP_PUT = 0b0000000000001000,
HTTP_PATCH = 0b0000000000010000,
HTTP_HEAD = 0b0000000000100000,
HTTP_OPTIONS = 0b0000000001000000,
HTTP_PROPFIND = 0b0000000010000000,
HTTP_LOCK = 0b0000000100000000,
HTTP_UNLOCK = 0b0000001000000000,
HTTP_PROPPATCH = 0b0000010000000000,
HTTP_MKCOL = 0b0000100000000000,
HTTP_MOVE = 0b0001000000000000,
HTTP_COPY = 0b0010000000000000,
HTTP_RESERVED = 0b0100000000000000,
HTTP_ANY = 0b0111111111111111,
} WebRequestMethod;
#endif
@ -86,7 +94,7 @@ namespace fs {
//if this value is returned when asked for data, packet will not be sent and you will be asked for data again
#define RESPONSE_TRY_AGAIN 0xFFFFFFFF
typedef uint8_t WebRequestMethodComposite;
typedef uint16_t WebRequestMethodComposite;
typedef std::function<void(void)> ArDisconnectHandler;
/*

View File

@ -276,6 +276,24 @@ bool AsyncWebServerRequest::_parseReqHead(){
_method = HTTP_HEAD;
} else if(m == F("OPTIONS")){
_method = HTTP_OPTIONS;
} else if(m == F("PROPFIND")){
_method = HTTP_PROPFIND;
} else if(m == F("LOCK")){
_method = HTTP_LOCK;
} else if(m == F("UNLOCK")){
_method = HTTP_UNLOCK;
} else if(m == F("PROPPATCH")){
_method = HTTP_PROPPATCH;
} else if(m == F("MKCOL")){
_method = HTTP_MKCOL;
} else if(m == F("MOVE")){
_method = HTTP_MOVE;
} else if(m == F("COPY")){
_method = HTTP_COPY;
} else if(m == F("RESERVED")){
_method = HTTP_RESERVED;
} else if(m == F("ANY")){
_method = HTTP_ANY;
}
String g;
@ -912,6 +930,14 @@ const __FlashStringHelper *AsyncWebServerRequest::methodToString() const {
else if(_method & HTTP_PATCH) return F("PATCH");
else if(_method & HTTP_HEAD) return F("HEAD");
else if(_method & HTTP_OPTIONS) return F("OPTIONS");
else if(_method & HTTP_PROPFIND) return F("PROPFIND");
else if(_method & HTTP_LOCK) return F("LOCK");
else if(_method & HTTP_UNLOCK) return F("UNLOCK");
else if(_method & HTTP_PROPPATCH) return F("PROPPATCH");
else if(_method & HTTP_MKCOL) return F("MKCOL");
else if(_method & HTTP_MOVE) return F("MOVE");
else if(_method & HTTP_COPY) return F("COPY");
else if(_method & HTTP_RESERVED) return F("RESERVED");
return F("UNKNOWN");
}