mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-06 05:21:22 +03:00
webserver: do not count "plain" in argument list (#6768)
* webserver: do not count "plain" in argument list (it is still available though)
This commit is contained in:
parent
1134194edc
commit
e58bb60f87
@ -54,6 +54,7 @@ ESP8266WebServerTemplate<ServerType>::ESP8266WebServerTemplate(IPAddress addr, i
|
||||
, _lastHandler(nullptr)
|
||||
, _currentArgCount(0)
|
||||
, _currentArgs(nullptr)
|
||||
, _currentArgsHavePlain(0)
|
||||
, _postArgsLen(0)
|
||||
, _postArgs(nullptr)
|
||||
, _headerKeysCount(0)
|
||||
@ -76,6 +77,7 @@ ESP8266WebServerTemplate<ServerType>::ESP8266WebServerTemplate(int port)
|
||||
, _lastHandler(nullptr)
|
||||
, _currentArgCount(0)
|
||||
, _currentArgs(nullptr)
|
||||
, _currentArgsHavePlain(0)
|
||||
, _postArgsLen(0)
|
||||
, _postArgs(nullptr)
|
||||
, _headerKeysCount(0)
|
||||
@ -565,7 +567,7 @@ const String& ESP8266WebServerTemplate<ServerType>::arg(const String& name) cons
|
||||
if ( _postArgs[j].key == name )
|
||||
return _postArgs[j].value;
|
||||
}
|
||||
for (int i = 0; i < _currentArgCount; ++i) {
|
||||
for (int i = 0; i < _currentArgCount + _currentArgsHavePlain; ++i) {
|
||||
if ( _currentArgs[i].key == name )
|
||||
return _currentArgs[i].value;
|
||||
}
|
||||
@ -574,14 +576,14 @@ const String& ESP8266WebServerTemplate<ServerType>::arg(const String& name) cons
|
||||
|
||||
template <typename ServerType>
|
||||
const String& ESP8266WebServerTemplate<ServerType>::arg(int i) const {
|
||||
if (i >= 0 && i < _currentArgCount)
|
||||
if (i >= 0 && i < _currentArgCount + _currentArgsHavePlain)
|
||||
return _currentArgs[i].value;
|
||||
return emptyString;
|
||||
}
|
||||
|
||||
template <typename ServerType>
|
||||
const String& ESP8266WebServerTemplate<ServerType>::argName(int i) const {
|
||||
if (i >= 0 && i < _currentArgCount)
|
||||
if (i >= 0 && i < _currentArgCount + _currentArgsHavePlain)
|
||||
return _currentArgs[i].key;
|
||||
return emptyString;
|
||||
}
|
||||
@ -597,7 +599,7 @@ bool ESP8266WebServerTemplate<ServerType>::hasArg(const String& name) const {
|
||||
if (_postArgs[j].key == name)
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < _currentArgCount; ++i) {
|
||||
for (int i = 0; i < _currentArgCount + _currentArgsHavePlain; ++i) {
|
||||
if (_currentArgs[i].key == name)
|
||||
return true;
|
||||
}
|
||||
|
@ -233,6 +233,7 @@ protected:
|
||||
|
||||
int _currentArgCount;
|
||||
RequestArgument* _currentArgs;
|
||||
int _currentArgsHavePlain;
|
||||
std::unique_ptr<HTTPUpload> _currentUpload;
|
||||
int _postArgsLen;
|
||||
RequestArgument* _postArgs;
|
||||
|
@ -208,6 +208,7 @@ bool ESP8266WebServerTemplate<ServerType>::_parseRequest(ClientType& client) {
|
||||
RequestArgument& arg = _currentArgs[_currentArgCount++];
|
||||
arg.key = F("plain");
|
||||
arg.value = plainBuf;
|
||||
_currentArgsHavePlain = 1;
|
||||
}
|
||||
} else { // isForm is true
|
||||
// here: content is not yet read (plainBuf is still empty)
|
||||
|
Loading…
x
Reference in New Issue
Block a user