From 5c83b99e0c631a026d6d81648a5cd6410dc7986c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 3 Jul 2025 14:06:07 -0500 Subject: [PATCH] do not need to rename as we changed design to not need it --- esphome/components/web_server/web_server.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/esphome/components/web_server/web_server.cpp b/esphome/components/web_server/web_server.cpp index 88fb817f02..1242db57ff 100644 --- a/esphome/components/web_server/web_server.cpp +++ b/esphome/components/web_server/web_server.cpp @@ -46,8 +46,8 @@ static const char *const HEADER_CORS_REQ_PNA = "Access-Control-Request-Private-N static const char *const HEADER_CORS_ALLOW_PNA = "Access-Control-Allow-Private-Network"; #endif -// Helper function to handle the actual URL parsing logic -static UrlMatch parse_url(const char *url_ptr, size_t url_len, bool only_domain) { +// Parse URL and return match info +static UrlMatch match_url(const char *url_ptr, size_t url_len, bool only_domain) { UrlMatch match{}; // URL must start with '/' @@ -1749,9 +1749,9 @@ bool WebServer::canHandle(AsyncWebServerRequest *request) const { // Store the URL to prevent temporary string destruction // request->url() returns a reference to a String (on Arduino) or std::string (on ESP-IDF) - // UrlMatch stores pointers to the string's data, so we must ensure the string outlives parse_url() + // UrlMatch stores pointers to the string's data, so we must ensure the string outlives match_url() const auto &url = request->url(); - UrlMatch match = parse_url(url.c_str(), url.length(), true); + UrlMatch match = match_url(url.c_str(), url.length(), true); if (!match.valid) return false; #ifdef USE_SENSOR @@ -1892,7 +1892,7 @@ void WebServer::handleRequest(AsyncWebServerRequest *request) { // See comment in canHandle() for why we store the URL reference const auto &url = request->url(); - UrlMatch match = parse_url(url.c_str(), url.length(), false); + UrlMatch match = match_url(url.c_str(), url.length(), false); #ifdef USE_SENSOR if (match.domain_equals("sensor")) {