-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Open
Open
Copy link
Labels
area: HTTPHTTP client/server supportHTTP client/server supportbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bug
Description
Describe the bug
I have an issue using Zephyr RTOS's HTTP server:
static struct http_resource_detail_static_fs frontendFsDetail = {
.common =
{
.bitmask_of_supported_http_methods = BIT(HTTP_GET),
.type = HTTP_RESOURCE_TYPE_STATIC_FS,
},
.fs_path = "/lfs",
};
static struct http_resource_detail_dynamic statusJsonDetail = {
.common =
{
.bitmask_of_supported_http_methods = BIT(HTTP_GET),
.type = HTTP_RESOURCE_TYPE_DYNAMIC,
.content_type = "application/json",
},
.cb = httpHandlerStatusJson,
.user_data = nullptr,
};
HTTP_RESOURCE_DEFINE(frontendStatusResource, httpService, "/status", &frontendFsDetail);
HTTP_RESOURCE_DEFINE(statusJsonResource, httpService, "/status/json", &statusJsonDetail);I have a static filesystem resource at "/status" and a dynamic JSON resource at "/status/json".
However, when I try to access "/status/json", I receive an error net_http_server: fs_stat /lfs/status/json: -2 (expected) but my httpHandlerStatusJson handler is never invoked.
I believe this is a bug since I'm not using a wildcard resource and the static resource should not match "/status/json".
I have verified that the handler is not called using LOGs. I have also verified that my handler works properly by changing /status/json to /status2/json.
Zephyr v4.3.0
Regression
- This is a regression.
Steps to reproduce
- Set up the HTTP server with the above resource definitions.
- Attempt to access "/status/json" via a web client or curl.
- Observe the
net_http_server: fs_stat /lfs/status/json: -2error and that the handler is not triggered.
Relevant log output
net_http_server: fs_stat /lfs/status/json: -2Impact
Not sure
Environment
No response
Additional Context
No response
Metadata
Metadata
Labels
area: HTTPHTTP client/server supportHTTP client/server supportbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bug