From 1dc7434913b203f991f4a8a8fc183c3e7a90a8c1 Mon Sep 17 00:00:00 2001 From: Pablo2048 Date: Sat, 27 Feb 2021 19:05:03 +0100 Subject: [PATCH] Upravy pro praci WebDAV --- src/ESPAsyncWebServer.h | 26 +++++++++++++++++--------- src/WebRequest.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/ESPAsyncWebServer.h b/src/ESPAsyncWebServer.h index 3aff61b..498ae62 100644 --- a/src/ESPAsyncWebServer.h +++ b/src/ESPAsyncWebServer.h @@ -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 ArDisconnectHandler; /* diff --git a/src/WebRequest.cpp b/src/WebRequest.cpp index 0200ce9..025bc3b 100644 --- a/src/WebRequest.cpp +++ b/src/WebRequest.cpp @@ -286,6 +286,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; @@ -922,6 +940,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"); }