diff --git a/patches/base/0025-uhttpd-backport-2-fixes.patch b/patches/base/0025-uhttpd-backport-2-fixes.patch deleted file mode 100644 index 5b4039e4e..000000000 --- a/patches/base/0025-uhttpd-backport-2-fixes.patch +++ /dev/null @@ -1,207 +0,0 @@ -From 2238d38eca53468d8a52209478f801580a54c1ed Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Wed, 17 Aug 2022 16:31:37 +0200 -Subject: [PATCH] uhttpd: backport 2 fixes - -Signed-off-by: John Crispin ---- - .../services/uhttpd/patches/error.patch | 165 ++++++++++++++++++ - .../services/uhttpd/patches/path.patch | 14 ++ - 2 files changed, 179 insertions(+) - create mode 100644 package/network/services/uhttpd/patches/error.patch - create mode 100644 package/network/services/uhttpd/patches/path.patch - -diff --git a/package/network/services/uhttpd/patches/error.patch b/package/network/services/uhttpd/patches/error.patch -new file mode 100644 -index 0000000000..374aca0a51 ---- /dev/null -+++ b/package/network/services/uhttpd/patches/error.patch -@@ -0,0 +1,165 @@ -+From c5eac5d27fb3967d796fe3c75f4cc1bdcd18ed01 Mon Sep 17 00:00:00 2001 -+From: Jo-Philipp Wich -+Date: Wed, 10 Aug 2022 21:00:32 +0200 -+Subject: [PATCH] file: support using dynamic script handlers as error pages -+ -+Rework the current request handler code to not require an error page path -+to be an actual file system entity. -+ -+Signed-off-by: Jo-Philipp Wich -+--- -+ file.c | 42 ++++++++++++++++++++++++++---------------- -+ 1 file changed, 26 insertions(+), 16 deletions(-) -+ -+diff --git a/file.c b/file.c -+index 1548900..ac781c1 100644 -+--- a/file.c -++++ b/file.c -+@@ -49,6 +49,7 @@ struct deferred_request { -+ struct dispatch_handler *d; -+ struct client *cl; -+ struct path_info pi; -++ char *url; -+ bool called, path; -+ }; -+ -+@@ -631,7 +632,7 @@ static void uh_file_data(struct client *cl, struct path_info *pi, int fd) -+ file_write_cb(cl); -+ } -+ -+-static bool __handle_file_request(struct client *cl, char *url); -++static bool __handle_file_request(struct client *cl, char *url, bool is_error_handler); -+ -+ static void uh_file_request(struct client *cl, const char *url, -+ struct path_info *pi, struct blob_attr **tb) -+@@ -684,7 +685,7 @@ error: -+ req->redirect_status = 403; -+ error_handler = alloca(strlen(conf.error_handler) + 1); -+ strcpy(error_handler, conf.error_handler); -+- if (__handle_file_request(cl, error_handler)) -++ if (__handle_file_request(cl, error_handler, true)) -+ return; -+ } -+ -+@@ -728,10 +729,8 @@ dispatch_find(const char *url, struct path_info *pi) -+ } -+ -+ static void -+-uh_invoke_script(struct client *cl, struct dispatch_handler *d, struct path_info *pi) -++uh_invoke_script(struct client *cl, struct dispatch_handler *d, char *url, struct path_info *pi) -+ { -+- char *url = blobmsg_data(blob_data(cl->hdr.head)); -+- -+ n_requests++; -+ d->handle_request(cl, url, pi); -+ } -+@@ -752,7 +751,7 @@ static void uh_complete_request(struct client *cl) -+ cl = dr->cl; -+ dr->called = true; -+ cl->dispatch.data_blocked = false; -+- uh_invoke_script(cl, dr->d, dr->path ? &dr->pi : NULL); -++ uh_invoke_script(cl, dr->d, dr->url, dr->path ? &dr->pi : NULL); -+ client_poll_post_data(cl); -+ ustream_poll(cl->us); -+ } -+@@ -787,10 +786,10 @@ static int field_len(const char *ptr) -+ _field(query) -+ -+ static void -+-uh_defer_script(struct client *cl, struct dispatch_handler *d, struct path_info *pi) -++uh_defer_script(struct client *cl, struct dispatch_handler *d, char *url, struct path_info *pi) -+ { -+ struct deferred_request *dr; -+- char *_root, *_phys, *_name, *_info, *_query; -++ char *_url, *_root, *_phys, *_name, *_info, *_query; -+ -+ cl->dispatch.req_free = uh_free_pending_request; -+ -+@@ -798,7 +797,7 @@ uh_defer_script(struct client *cl, struct dispatch_handler *d, struct path_info -+ /* allocate enough memory to duplicate all path_info strings in one block */ -+ #undef _field -+ #define _field(_name) &_##_name, field_len(pi->_name), -+- dr = calloc_a(sizeof(*dr), path_info_fields NULL); -++ dr = calloc_a(sizeof(*dr), &_url, strlen(url), path_info_fields NULL); -+ -+ memcpy(&dr->pi, pi, sizeof(*pi)); -+ dr->path = true; -+@@ -808,11 +807,12 @@ uh_defer_script(struct client *cl, struct dispatch_handler *d, struct path_info -+ #define _field(_name) if (pi->_name) dr->pi._name = strcpy(_##_name, pi->_name); -+ path_info_fields -+ } else { -+- dr = calloc(1, sizeof(*dr)); -++ dr = calloc_a(sizeof(*dr), &_url, strlen(url), NULL); -+ } -+ -+ cl->dispatch.req_data = dr; -+ cl->dispatch.data_blocked = true; -++ dr->url = strcpy(_url, url); -+ dr->cl = cl; -+ dr->d = d; -+ list_add(&dr->list, &pending_requests); -+@@ -825,13 +825,13 @@ uh_invoke_handler(struct client *cl, struct dispatch_handler *d, char *url, stru -+ return d->handle_request(cl, url, pi); -+ -+ if (n_requests >= conf.max_script_requests) -+- return uh_defer_script(cl, d, pi); -++ return uh_defer_script(cl, d, url, pi); -+ -+ cl->dispatch.req_free = uh_complete_request; -+- uh_invoke_script(cl, d, pi); -++ uh_invoke_script(cl, d, url, pi); -+ } -+ -+-static bool __handle_file_request(struct client *cl, char *url) -++static bool __handle_file_request(struct client *cl, char *url, bool is_error_handler) -+ { -+ static const struct blobmsg_policy hdr_policy[__HDR_MAX] = { -+ [HDR_AUTHORIZATION] = { "authorization", BLOBMSG_TYPE_STRING }, -+@@ -846,6 +846,16 @@ static bool __handle_file_request(struct client *cl, char *url) -+ struct path_info *pi; -+ char *user, *pass, *auth; -+ -++ if (is_error_handler) { -++ d = dispatch_find(url, NULL); -++ -++ if (d) { -++ uh_invoke_handler(cl, d, url, NULL); -++ -++ return true; -++ } -++ } -++ -+ pi = uh_path_lookup(cl, url); -+ if (!pi) -+ return false; -+@@ -931,7 +941,7 @@ void uh_handle_request(struct client *cl) -+ if (d) -+ return uh_invoke_handler(cl, d, url, NULL); -+ -+- if (__handle_file_request(cl, url)) -++ if (__handle_file_request(cl, url, false)) -+ return; -+ -+ if (uh_handler_run(cl, &url, true)) { -+@@ -939,7 +949,7 @@ void uh_handle_request(struct client *cl) -+ return; -+ -+ uh_handler_run(cl, &url, false); -+- if (__handle_file_request(cl, url)) -++ if (__handle_file_request(cl, url, false)) -+ return; -+ } -+ -+@@ -947,7 +957,7 @@ void uh_handle_request(struct client *cl) -+ if (conf.error_handler) { -+ error_handler = alloca(strlen(conf.error_handler) + 1); -+ strcpy(error_handler, conf.error_handler); -+- if (__handle_file_request(cl, error_handler)) -++ if (__handle_file_request(cl, error_handler, true)) -+ return; -+ } -+ -+-- -+2.35.1 -+ -+ -diff --git a/package/network/services/uhttpd/patches/path.patch b/package/network/services/uhttpd/patches/path.patch -new file mode 100644 -index 0000000000..27eebb56d8 ---- /dev/null -+++ b/package/network/services/uhttpd/patches/path.patch -@@ -0,0 +1,14 @@ -+diff --git a/utils.c b/utils.c -+index 142a410..6502d94 100644 -+--- a/utils.c -++++ b/utils.c -+@@ -215,7 +215,7 @@ bool uh_path_match(const char *prefix, const char *url) -+ if (strncmp(url, prefix, len) != 0) -+ return false; -+ -+- return url[len] == '/' || url[len] == 0; -++ return url[len] == '/' || url[len] == '?' || url[len] == 0; -+ } -+ -+ char *uh_split_header(char *str) -+ --- -2.25.1 - diff --git a/patches/base/0025-uhttpd-update-to-latest-HEAD.patch b/patches/base/0025-uhttpd-update-to-latest-HEAD.patch index 30a8f8777..96f3a377e 100644 --- a/patches/base/0025-uhttpd-update-to-latest-HEAD.patch +++ b/patches/base/0025-uhttpd-update-to-latest-HEAD.patch @@ -1,20 +1,24 @@ -From 3cd6c3dc3cb38799bce6e728d3794d50b829678b Mon Sep 17 00:00:00 2001 +From 3a4a31f26f1699b9a4a7d6684a380a990bb9ac86 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 10 Aug 2022 09:50:13 +0200 -Subject: [PATCH] uhttpd: update to latest HEAD +Subject: [PATCH 85/85] uhttpd: update to latest HEAD Signed-off-by: John Crispin --- - package/network/services/uhttpd/Makefile | 44 ++++++++++++++----- - .../services/uhttpd/files/uhttpd.config | 8 ++++ - .../network/services/uhttpd/files/uhttpd.init | 15 +++++++ - 3 files changed, 57 insertions(+), 10 deletions(-) + package/network/services/uhttpd/Makefile | 43 +++-- + .../services/uhttpd/files/uhttpd.config | 8 + + .../network/services/uhttpd/files/uhttpd.init | 15 ++ + .../services/uhttpd/patches/error.patch | 165 ------------------ + .../services/uhttpd/patches/path.patch | 14 -- + 5 files changed, 56 insertions(+), 189 deletions(-) + delete mode 100644 package/network/services/uhttpd/patches/error.patch + delete mode 100644 package/network/services/uhttpd/patches/path.patch diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile -index de666a480d..860b41f1a4 100644 +index de666a480d..0ae076ca8b 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile -@@ -8,19 +8,19 @@ +@@ -8,19 +8,18 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uhttpd @@ -27,8 +31,7 @@ index de666a480d..860b41f1a4 100644 -PKG_SOURCE_VERSION:=15346de8d3ba422002496526ee24c62a3601ab8c -PKG_MIRROR_HASH:=819424d071ed7c8888f9ca66f679907831becc59a67dd4a5ec521d5fba0a3171 +PKG_SOURCE_DATE:=2022-06-01 -+PKG_SOURCE_VERSION:=d59d732a10a4a2b9f18af6dfc3facf696108f31e -+PKG_MIRROR_HASH:=31caa46ca025a1a7657bd5252d59d4a67d0f1c4b87c15a1bc94663ba3cc899ee ++PKG_SOURCE_VERSION:=e3395cd90bed9b7b9fc319e79528fedcc0d947fe PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=ISC @@ -39,7 +42,7 @@ index de666a480d..860b41f1a4 100644 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk -@@ -49,8 +49,20 @@ define Package/uhttpd/config +@@ -49,8 +48,20 @@ define Package/uhttpd/config depends on PACKAGE_uhttpd-mod-lua bool "Enable Integrated Lua interpreter" default y @@ -60,7 +63,7 @@ index de666a480d..860b41f1a4 100644 define Package/uhttpd-mod-lua $(Package/uhttpd/default) TITLE+= (Lua plugin) -@@ -73,19 +85,25 @@ define Package/uhttpd-mod-ubus/description +@@ -73,19 +84,25 @@ define Package/uhttpd-mod-ubus/description session.* namespace and procedures. endef @@ -91,7 +94,7 @@ index de666a480d..860b41f1a4 100644 define Package/uhttpd/install $(INSTALL_DIR) $(1)/etc/init.d -@@ -108,7 +126,13 @@ define Package/uhttpd-mod-ubus/install +@@ -108,7 +125,13 @@ define Package/uhttpd-mod-ubus/install $(INSTALL_DATA) ./files/ubus.default $(1)/etc/uci-defaults/00_uhttpd_ubus endef @@ -157,6 +160,4 @@ index 30fd7b4259..8dbc23f59c 100755 append_arg "$cfg" script_timeout "-t" append_arg "$cfg" network_timeout "-T" append_arg "$cfg" http_keepalive "-k" --- -2.25.1