From b25b62ceb9e8ab0e4c43d0f4f01f4b1b50fd52c8 Mon Sep 17 00:00:00 2001 From: Pablo2048 Date: Fri, 20 Oct 2023 08:06:57 +0200 Subject: [PATCH] Aplikace opravy odstraneni headeru z https://github.com/blackhack/ESPAsyncWebServer/commit/139a97a72121f6d79ac2320afaf1d6121facb31a --- src/WebRequest.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/WebRequest.cpp b/src/WebRequest.cpp index bbce5ca..7c1dac9 100644 --- a/src/WebRequest.cpp +++ b/src/WebRequest.cpp @@ -180,10 +180,15 @@ void AsyncWebServerRequest::_onData(void *buf, size_t len){ void AsyncWebServerRequest::_removeNotInterestingHeaders(){ if (_interestingHeaders.containsIgnoreCase("ANY")) return; // nothing to do - for(const auto& header: _headers){ - if(!_interestingHeaders.containsIgnoreCase(header->name().c_str())){ + + auto itr = _headers.begin(); + while (itr != _headers.end()) + { + const auto header = *itr; + ++itr; // ++operator before remove(), otherwise itr becomes invalid + + if (!_interestingHeaders.containsIgnoreCase(header->name().c_str())) _headers.remove(header); - } } }