mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2025-09-27 23:00:55 +02:00
Replace one use of LinkedList<T> with std::vector for web request path params
Fraction of commit 9b98550f64000b937db9567b69e1275feccf1f0f of dumbfixes branch of 0xFEEDC0DE64 fork of ESPAsyncWebServer. Split off for clarity.
This commit is contained in:
@@ -184,7 +184,7 @@ class AsyncWebServerRequest {
|
|||||||
|
|
||||||
std::list<AsyncWebHeader> _headers;
|
std::list<AsyncWebHeader> _headers;
|
||||||
LinkedList<AsyncWebParameter *> _params;
|
LinkedList<AsyncWebParameter *> _params;
|
||||||
LinkedList<String *> _pathParams;
|
std::vector<String> _pathParams;
|
||||||
|
|
||||||
uint8_t _multiParseState;
|
uint8_t _multiParseState;
|
||||||
uint8_t _boundaryPosition;
|
uint8_t _boundaryPosition;
|
||||||
|
@@ -52,7 +52,6 @@ AsyncWebServerRequest::AsyncWebServerRequest(AsyncWebServer* s, AsyncClient* c)
|
|||||||
, _contentLength(0)
|
, _contentLength(0)
|
||||||
, _parsedLength(0)
|
, _parsedLength(0)
|
||||||
, _params(LinkedList<AsyncWebParameter *>([](AsyncWebParameter *p){ delete p; }))
|
, _params(LinkedList<AsyncWebParameter *>([](AsyncWebParameter *p){ delete p; }))
|
||||||
, _pathParams(LinkedList<String *>([](String *p){ delete p; }))
|
|
||||||
, _multiParseState(0)
|
, _multiParseState(0)
|
||||||
, _boundaryPosition(0)
|
, _boundaryPosition(0)
|
||||||
, _itemStartIndex(0)
|
, _itemStartIndex(0)
|
||||||
@@ -78,7 +77,7 @@ AsyncWebServerRequest::~AsyncWebServerRequest(){
|
|||||||
_headers.clear();
|
_headers.clear();
|
||||||
|
|
||||||
_params.free();
|
_params.free();
|
||||||
_pathParams.free();
|
_pathParams.clear();
|
||||||
|
|
||||||
_interestingHeaders.clear();
|
_interestingHeaders.clear();
|
||||||
|
|
||||||
@@ -254,7 +253,7 @@ void AsyncWebServerRequest::_addParam(AsyncWebParameter *p){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AsyncWebServerRequest::_addPathParam(const char *p){
|
void AsyncWebServerRequest::_addPathParam(const char *p){
|
||||||
_pathParams.add(new String(p));
|
_pathParams.emplace_back(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncWebServerRequest::_addGetParams(const String& params){
|
void AsyncWebServerRequest::_addGetParams(const String& params){
|
||||||
@@ -915,8 +914,7 @@ const String& AsyncWebServerRequest::argName(size_t i) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const String& AsyncWebServerRequest::pathArg(size_t i) const {
|
const String& AsyncWebServerRequest::pathArg(size_t i) const {
|
||||||
auto param = _pathParams.nth(i);
|
return i < _pathParams.size() ? _pathParams[i] : emptyString;
|
||||||
return param ? **param : emptyString;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const String& AsyncWebServerRequest::header(const char* name) const {
|
const String& AsyncWebServerRequest::header(const char* name) const {
|
||||||
|
Reference in New Issue
Block a user