[PATCH 3/3] uclient-fetch: Support for WebDAV methods

Sergey Ponomarev stokito at gmail.com
Thu Apr 6 14:39:09 PDT 2023


The WebDAV is an extension for HTTP for shared folders.
In order to make wget working with it we have to declare the missing constants with methods.
They don't take part in a logic except of OPTIONS methods that can't have a body.

Signed-off-by: Sergey Ponomarev <stokito at gmail.com>
---
 uclient-http.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/uclient-http.c b/uclient-http.c
index 02bb7c2..b4e6d70 100644
--- a/uclient-http.c
+++ b/uclient-http.c
@@ -40,11 +40,19 @@ enum auth_type {
 };
 
 enum request_type {
+	REQ_COPY,
 	REQ_DELETE,
 	REQ_GET,
 	REQ_HEAD,
+	REQ_LOCK,
+	REQ_MKCOL,
+	REQ_MOVE,
+	REQ_OPTIONS,
 	REQ_POST,
+	REQ_PROPFIND,
+	REQ_PROPPATCH,
 	REQ_PUT,
+	REQ_UNLOCK,
 	__REQ_MAX
 };
 
@@ -59,11 +67,19 @@ enum http_state {
 
 // Must be sorted aplhabeticaly
 static const char * const request_types[__REQ_MAX] = {
+	[REQ_COPY] = "COPY",
 	[REQ_DELETE] = "DELETE",
 	[REQ_GET] = "GET",
 	[REQ_HEAD] = "HEAD",
+	[REQ_LOCK] = "LOCK",
+	[REQ_MKCOL] = "MKCOL",
+	[REQ_MOVE] = "MOVE",
+	[REQ_OPTIONS] = "OPTIONS",
 	[REQ_POST] = "POST",
+	[REQ_PROPFIND] = "PROPFIND",
+	[REQ_PROPPATCH] = "PROPPATCH",
 	[REQ_PUT] = "PUT",
+	[REQ_UNLOCK] = "UNLOCK",
 };
 
 struct uclient_http {
@@ -292,7 +308,7 @@ static void uclient_http_process_headers(struct uclient_http *uh)
 
 static bool uclient_request_supports_body(enum request_type req_type)
 {
-	return !(req_type == REQ_GET || req_type == REQ_HEAD);
+	return !(req_type == REQ_GET || req_type == REQ_HEAD || req_type == REQ_OPTIONS);
 }
 
 static int
-- 
2.37.2




More information about the openwrt-devel mailing list