-
Notifications
You must be signed in to change notification settings - Fork 8k
feat(esp_http_server): Make HTTP(S)_SERVER_EVENT events optional (IDFGH-16707) #17799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -23,6 +23,7 @@ extern "C" { | |||||
|
|
||||||
| #define ESP_HTTPD_DEF_CTRL_PORT (32768) /*!< HTTP Server control socket port*/ | ||||||
|
|
||||||
| #ifdef CONFIG_HTTPD_ENABLE_EVENTS | ||||||
| ESP_EVENT_DECLARE_BASE(ESP_HTTP_SERVER_EVENT); | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -45,6 +46,7 @@ typedef struct { | |||||
| int fd; /*!< Session socket file descriptor */ | ||||||
| int data_len; /*!< Data length */ | ||||||
| } esp_http_server_event_data; | ||||||
| #endif | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| /* | ||||||
| note: esp_https_server.h includes a customized copy of this | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |||||
| extern "C" { | ||||||
| #endif | ||||||
|
|
||||||
| #ifdef CONFIG_ESP_HTTPS_SERVER_EVENTS | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ESP_EVENT_DECLARE_BASE(ESP_HTTPS_SERVER_EVENT); | ||||||
|
|
||||||
| typedef enum { | ||||||
|
|
@@ -29,6 +30,7 @@ typedef enum { | |||||
| HTTPS_SERVER_EVENT_DISCONNECTED, /*!< The connection has been disconnected */ | ||||||
| HTTPS_SERVER_EVENT_STOP, /*!< This event occurs when HTTPS Server is stopped */ | ||||||
| } esp_https_server_event_id_t; | ||||||
| #endif | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| typedef enum { | ||||||
| HTTPD_SSL_TRANSPORT_SECURE, // SSL Enabled | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD | ||
| * SPDX-FileCopyrightText: 2018-2025 Espressif Systems (Shanghai) CO LTD | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
@@ -23,7 +23,9 @@ typedef struct httpd_ssl_transport_ctx { | |
| httpd_ssl_ctx_t *global_ctx; | ||
| } httpd_ssl_transport_ctx_t; | ||
|
|
||
| #ifdef CONFIG_ESP_HTTPS_SERVER_EVENTS | ||
| ESP_EVENT_DEFINE_BASE(ESP_HTTPS_SERVER_EVENT); | ||
| #endif | ||
|
|
||
| #if CONFIG_ESP_HTTPS_SERVER_EVENT_POST_TIMEOUT == -1 | ||
| #define ESP_HTTPS_SERVER_EVENT_POST_TIMEOUT portMAX_DELAY | ||
|
|
@@ -32,13 +34,17 @@ ESP_EVENT_DEFINE_BASE(ESP_HTTPS_SERVER_EVENT); | |
| #endif | ||
|
|
||
|
|
||
| #ifdef CONFIG_ESP_HTTPS_SERVER_EVENTS | ||
| static void http_dispatch_event_to_event_loop(int32_t event_id, const void* event_data, size_t event_data_size) | ||
| { | ||
| esp_err_t err = esp_event_post(ESP_HTTPS_SERVER_EVENT, event_id, event_data, event_data_size, ESP_HTTPS_SERVER_EVENT_POST_TIMEOUT); | ||
| if (err != ESP_OK) { | ||
| ESP_LOGE(TAG, "Failed to post http_client event: %"PRId32", error: %s", event_id, esp_err_to_name(err)); | ||
| } | ||
| } | ||
| #else | ||
| #define http_dispatch_event_to_event_loop(event_id, event_data, event_data_size) do {} while (0) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we use similar approach (stub out the implementation) in HTTP server component as well? |
||
| #endif | ||
|
|
||
| /** | ||
| * SSL socket close handler | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.