Skip to content

Commit

Permalink
net:http: Add #ifdef guard file system in HTTP server
Browse files Browse the repository at this point in the history
  http_server_http2.c does not guard check if file system is available
  or not before using file system api. This PR will add guard for that

Signed-off-by: bac phan <[email protected]>
  • Loading branch information
phb98 authored Feb 28, 2025
1 parent 210adaf commit 9a97153
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion subsys/net/lib/http/http_server_http2.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ static int handle_http2_static_resource(
out:
return ret;
}
#if defined(CONFIG_FILE_SYSTEM)

static int handle_http2_static_fs_resource(struct http_resource_detail_static_fs *static_fs_detail,
struct http2_frame *frame,
Expand Down Expand Up @@ -547,7 +548,7 @@ static int handle_http2_static_fs_resource(struct http_resource_detail_static_fs

return ret;
}

#endif /* CONFIG_FILE_SYSTEM */
static int http2_dynamic_response(struct http_client_ctx *client, struct http2_frame *frame,
struct http_response_ctx *rsp, enum http_data_status data_status,
struct http_resource_detail_dynamic *dynamic_detail)
Expand Down Expand Up @@ -1094,12 +1095,14 @@ int handle_http1_to_http2_upgrade(struct http_client_ctx *client)
if (ret < 0) {
goto error;
}
#if defined(CONFIG_FILE_SYSTEM)
} else if (detail->type == HTTP_RESOURCE_TYPE_STATIC_FS) {
ret = handle_http2_static_fs_resource(
(struct http_resource_detail_static_fs *)detail, frame, client);
if (ret < 0) {
goto error;
}
#endif
} else if (detail->type == HTTP_RESOURCE_TYPE_DYNAMIC) {
ret = handle_http2_dynamic_resource(
(struct http_resource_detail_dynamic *)detail,
Expand Down Expand Up @@ -1594,12 +1597,14 @@ int handle_http_frame_headers(struct http_client_ctx *client)
if (ret < 0) {
goto error;
}
#if defined(CONFIG_FILE_SYSTEM)
} else if (detail->type == HTTP_RESOURCE_TYPE_STATIC_FS) {
ret = handle_http2_static_fs_resource(
(struct http_resource_detail_static_fs *)detail, frame, client);
if (ret < 0) {
goto error;
}
#endif
} else if (detail->type == HTTP_RESOURCE_TYPE_DYNAMIC) {
ret = handle_http2_dynamic_resource(
(struct http_resource_detail_dynamic *)detail,
Expand Down

0 comments on commit 9a97153

Please sign in to comment.