mirror of
https://github.com/esphome/esphome.git
synced 2025-08-06 18:37:47 +00:00
do not need to rename as we changed design to not need it
This commit is contained in:
parent
35ff850894
commit
5c83b99e0c
@ -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")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user