[web_server] Conditionally compile authentication code to save flash memory (#10022)

This commit is contained in:
J. Nick Koston
2025-08-03 16:09:12 -10:00
committed by GitHub
parent a75f73dbf0
commit 494a1a216c
7 changed files with 21 additions and 0 deletions

View File

@@ -14,9 +14,11 @@ WebServerBase *global_web_server_base = nullptr; // NOLINT(cppcoreguidelines-av
void WebServerBase::add_handler(AsyncWebHandler *handler) {
// remove all handlers
#ifdef USE_WEBSERVER_AUTH
if (!credentials_.username.empty()) {
handler = new internal::AuthMiddlewareHandler(handler, &credentials_);
}
#endif
this->handlers_.push_back(handler);
if (this->server_ != nullptr) {
this->server_->addHandler(handler);