[PATCH 0/4] Add support for HTTP HEAD request method to corelib and Suricatta

14 views
Skip to first unread message

Cirujano Cuesta, Silvano

unread,
Mar 27, 2026, 9:45:22 AM (5 days ago) Mar 27
to swup...@googlegroups.com, Storm, Christian, Zheng, Xiyue
From: xiyue...@siemens.com

The HTTP request method HEAD is widely used, but is currently not
supported, neither by corelib nor by Suricatta.

This patch series adds that missing support. We plan a future
contribution that would need it. Even if that future contribute is not
accepted, having support for HEAD is very low effort and adds support
for such a widely used HTTP request method.

This patch series is additionally adding consistent support for the
DELETE HTTP request method.

Best regards,
Silvano Cirujano Cuesta

Xiyue Zheng (4):
corelib: improve trace message
suricatta: add support for delete http requests
core: add support for head http requests
suricatta: add support for head http requests

corelib/channel_curl.c | 7 +++++--
include/channel_curl.h | 1 +
suricatta/server_lua.c | 2 ++
suricatta/suricatta.lua | 2 ++
4 files changed, 10 insertions(+), 2 deletions(-)

--
2.50.1 (Apple Git-155)

Cirujano Cuesta, Silvano

unread,
Mar 27, 2026, 9:47:40 AM (5 days ago) Mar 27
to swup...@googlegroups.com, Storm, Christian, Zheng, Xiyue
From: xiyue...@siemens.com

Add DELETE to trace message

Signed-off-by: Xiyue Zheng <xiyue...@siemens.com>
Signed-off-by: Silvano Cirujano Cuesta <silvano.cir...@siemens.com>
---
corelib/channel_curl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c
index 3f5db861..167cb7a6 100644
--- a/corelib/channel_curl.c
+++ b/corelib/channel_curl.c
@@ -1176,7 +1176,7 @@ channel_op_res_t channel_put(channel_t *this, void *data)
case CHANNEL_DELETE:
return channel_post_method(this, data, channel_data->method);
default:
- TRACE("Channel method (POST, PUT, PATCH) is not set !");
+ TRACE("Channel method (POST, PUT, PATCH, DELETE) is not set !");
return CHANNEL_EINIT;
}
}
--
2.50.1 (Apple Git-155)

Cirujano Cuesta, Silvano

unread,
Mar 27, 2026, 9:47:42 AM (5 days ago) Mar 27
to swup...@googlegroups.com, Storm, Christian, Zheng, Xiyue
From: xiyue...@siemens.com

Add DELETE HTTP request to the suricatta Lua domain.

Signed-off-by: Xiyue Zheng <xiyue...@siemens.com>
Signed-off-by: Silvano Cirujano Cuesta <silvano.cir...@siemens.com>
---
suricatta/server_lua.c | 1 +
suricatta/suricatta.lua | 1 +
2 files changed, 2 insertions(+)

diff --git a/suricatta/server_lua.c b/suricatta/server_lua.c
index 0495bc51..70a7d9e0 100644
--- a/suricatta/server_lua.c
+++ b/suricatta/server_lua.c
@@ -1662,6 +1662,7 @@ static int suricatta_lua_module(lua_State *L)
push_to_table(L, "POST", CHANNEL_POST);
push_to_table(L, "PUT", CHANNEL_PUT);
push_to_table(L, "PATCH", CHANNEL_PATCH);
+ push_to_table(L, "DELETE", CHANNEL_DELETE);
lua_settable(L, -3);

lua_settable(L, -3);
diff --git a/suricatta/suricatta.lua b/suricatta/suricatta.lua
index b8707a25..3879e9ca 100644
--- a/suricatta/suricatta.lua
+++ b/suricatta/suricatta.lua
@@ -218,6 +218,7 @@ suricatta.channel = {
POST = 1,
PUT = 2,
PATCH = 3,
+ DELETE = 4,
},

--- Channel options as in `include/channel_curl.h`.
--
2.50.1 (Apple Git-155)

Cirujano Cuesta, Silvano

unread,
Mar 27, 2026, 9:48:20 AM (5 days ago) Mar 27
to swup...@googlegroups.com, Storm, Christian, Zheng, Xiyue
From: xiyue...@siemens.com

Add support for HEAD HTTP requests to the channel.
This is a frequently used HTTP method that was missing and should pave
the way for other server implementations that might need it.

Signed-off-by: Xiyue Zheng <xiyue...@siemens.com>
Signed-off-by: Silvano Cirujano Cuesta <silvano.cir...@siemens.com>
---
corelib/channel_curl.c | 7 +++++--
include/channel_curl.h | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c
index 167cb7a6..e15f5699 100644
--- a/corelib/channel_curl.c
+++ b/corelib/channel_curl.c
@@ -66,6 +66,7 @@ static const char *method_desc[] = {
[CHANNEL_PUT] = "PUT",
[CHANNEL_PATCH] = "PATCH",
[CHANNEL_DELETE] = "DELETE"
+ [CHANNEL_HEAD] = "HEAD",
};

/* Prototypes for "internal" functions */
@@ -1108,7 +1109,8 @@ static channel_op_res_t channel_post_method(channel_t *this, void *data, int met
break;

case CHANNEL_DELETE:
- curl_result = curl_easy_setopt(channel_curl->handle, CURLOPT_CUSTOMREQUEST, "DELETE");
+ case CHANNEL_HEAD:
+ curl_result = curl_easy_setopt(channel_curl->handle, CURLOPT_CUSTOMREQUEST, method_desc[method]);
break;

case CHANNEL_PUT:
@@ -1174,9 +1176,10 @@ channel_op_res_t channel_put(channel_t *this, void *data)
case CHANNEL_POST:
case CHANNEL_PATCH:
case CHANNEL_DELETE:
+ case CHANNEL_HEAD:
return channel_post_method(this, data, channel_data->method);
default:
- TRACE("Channel method (POST, PUT, PATCH, DELETE) is not set !");
+ TRACE("Channel method (POST, PUT, PATCH, DELETE, HEAD) is not set !");
return CHANNEL_EINIT;
}
}
diff --git a/include/channel_curl.h b/include/channel_curl.h
index ccd4158f..f4855ce2 100644
--- a/include/channel_curl.h
+++ b/include/channel_curl.h
@@ -23,6 +23,7 @@ typedef enum {
CHANNEL_PUT,
CHANNEL_PATCH,
CHANNEL_DELETE,
+ CHANNEL_HEAD,
} channel_method_t;

/*
--
2.50.1 (Apple Git-155)

Cirujano Cuesta, Silvano

unread,
Mar 27, 2026, 9:49:05 AM (5 days ago) Mar 27
to swup...@googlegroups.com, Storm, Christian, Zheng, Xiyue
From: xiyue...@siemens.com

Add HEAD HTTP request to the suricatta Lua domain.

Signed-off-by: Xiyue Zheng <xiyue...@siemens.com>
Signed-off-by: Silvano Cirujano Cuesta <silvano.cir...@siemens.com>
---
suricatta/server_lua.c | 1 +
suricatta/suricatta.lua | 1 +
2 files changed, 2 insertions(+)

diff --git a/suricatta/server_lua.c b/suricatta/server_lua.c
index 70a7d9e0..b1e559c9 100644
--- a/suricatta/server_lua.c
+++ b/suricatta/server_lua.c
@@ -1663,6 +1663,7 @@ static int suricatta_lua_module(lua_State *L)
push_to_table(L, "PUT", CHANNEL_PUT);
push_to_table(L, "PATCH", CHANNEL_PATCH);
push_to_table(L, "DELETE", CHANNEL_DELETE);
+ push_to_table(L, "HEAD", CHANNEL_HEAD);
lua_settable(L, -3);

lua_settable(L, -3);
diff --git a/suricatta/suricatta.lua b/suricatta/suricatta.lua
index 3879e9ca..1ffac879 100644
--- a/suricatta/suricatta.lua
+++ b/suricatta/suricatta.lua
@@ -219,6 +219,7 @@ suricatta.channel = {
PUT = 2,
PATCH = 3,
DELETE = 4,
+ HEAD = 5,

Stefano Babic

unread,
Mar 27, 2026, 10:20:46 AM (5 days ago) Mar 27
to Cirujano Cuesta, Silvano, swup...@googlegroups.com, Storm, Christian, Zheng, Xiyue
Hola Cirujano, Zheng,

On 3/27/26 14:45, 'Cirujano Cuesta, Silvano' via swupdate wrote:
> From: xiyue...@siemens.com
>
> The HTTP request method HEAD is widely used, but is currently not
> supported, neither by corelib nor by Suricatta.
>
> This patch series adds that missing support. We plan a future
> contribution that would need it. Even if that future contribute is not
> accepted, having support for HEAD is very low effort and adds support
> for such a widely used HTTP request method.
>
> This patch series is additionally adding consistent support for the
> DELETE HTTP request method.
>

Patches are ok IMO, I will merge them soon.

Best regards,
Stefano

> Best regards,
> Silvano Cirujano Cuesta
>
> Xiyue Zheng (4):
> corelib: improve trace message
> suricatta: add support for delete http requests
> core: add support for head http requests
> suricatta: add support for head http requests
>
> corelib/channel_curl.c | 7 +++++--
> include/channel_curl.h | 1 +
> suricatta/server_lua.c | 2 ++
> suricatta/suricatta.lua | 2 ++
> 4 files changed, 10 insertions(+), 2 deletions(-)
>

--
_______________________________________________________________________
Nabla Software Engineering GmbH
Hirschstr. 111A | 86156 Augsburg | Tel: +49 821 45592596
Geschäftsführer : Stefano Babic | HRB 40522 Augsburg
E-Mail: sba...@nabladev.com

Reply all
Reply to author
Forward
0 new messages