Merge branch 'contrib/github_pr_17799' into 'master'

feat(esp_http_server): Make HTTP(S)_SERVER_EVENT events optional (GitHub PR)

Closes IDFGH-16707

See merge request espressif/esp-idf!43637
This commit is contained in:
Mahavir Jain
2025-12-11 18:10:52 +05:30
8 changed files with 52 additions and 2 deletions

View File

@@ -31,6 +31,7 @@
static const char *TAG = "example";
#ifdef CONFIG_ESP_HTTPS_SERVER_EVENTS
/* Event handler for catching system events */
static void event_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data)
@@ -42,6 +43,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
}
}
}
#endif // CONFIG_ESP_HTTPS_SERVER_EVENTS
/* An HTTP GET handler */
static esp_err_t root_get_handler(httpd_req_t *req)
@@ -257,7 +259,9 @@ void app_main(void)
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_ETH_GOT_IP, &connect_handler, &server));
ESP_ERROR_CHECK(esp_event_handler_register(ETH_EVENT, ETHERNET_EVENT_DISCONNECTED, &disconnect_handler, &server));
#endif // CONFIG_EXAMPLE_CONNECT_ETHERNET
#ifdef CONFIG_ESP_HTTPS_SERVER_EVENTS
ESP_ERROR_CHECK(esp_event_handler_register(ESP_HTTPS_SERVER_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL));
#endif // CONFIG_ESP_HTTPS_SERVER_EVENTS
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
* Read "Establishing Wi-Fi or Ethernet Connection" section in