ESPHome 2025.9.0-dev
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1#pragma once
2#ifdef USE_ESP_IDF
3
4#include <esp_http_server.h>
5#include <string>
7
8namespace esphome {
9namespace web_server_idf {
10
11bool request_has_header(httpd_req_t *req, const char *name);
12optional<std::string> request_get_header(httpd_req_t *req, const char *name);
13optional<std::string> request_get_url_query(httpd_req_t *req);
14optional<std::string> query_key_value(const std::string &query_url, const std::string &key);
15
16// Helper function for case-insensitive character comparison
17inline bool char_equals_ci(char a, char b) { return ::tolower(a) == ::tolower(b); }
18
19// Helper function for case-insensitive string region comparison
20bool str_ncmp_ci(const char *s1, const char *s2, size_t n);
21
22// Case-insensitive string search (like strstr but case-insensitive)
23const char *stristr(const char *haystack, const char *needle);
24
25} // namespace web_server_idf
26} // namespace esphome
27#endif // USE_ESP_IDF
bool char_equals_ci(char a, char b)
Definition utils.h:17
optional< std::string > request_get_url_query(httpd_req_t *req)
Definition utils.cpp:56
optional< std::string > request_get_header(httpd_req_t *req, const char *name)
Definition utils.cpp:39
bool str_ncmp_ci(const char *s1, const char *s2, size_t n)
Definition utils.cpp:94
optional< std::string > query_key_value(const std::string &query_url, const std::string &key)
Definition utils.cpp:74
const char * stristr(const char *haystack, const char *needle)
Definition utils.cpp:104
bool request_has_header(httpd_req_t *req, const char *name)
Definition utils.cpp:37
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7