1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-04 01:23:50 +03:00

Expose post args during upload (#4935)

Currently post args are only available at the end of upload but they are already listed - this PR just expose them with minimal changes
It also set a define for post args array size originaly set to 32
This commit is contained in:
Luc
2018-11-29 22:52:55 +01:00
committed by Earle F. Philhower, III
parent 9ec03ed3f6
commit 440a3aae7f
3 changed files with 35 additions and 12 deletions

View File

@ -53,6 +53,8 @@ ESP8266WebServer::ESP8266WebServer(IPAddress addr, int port)
, _lastHandler(nullptr)
, _currentArgCount(0)
, _currentArgs(nullptr)
, _postArgsLen(0)
, _postArgs(nullptr)
, _headerKeysCount(0)
, _currentHeaders(nullptr)
, _contentLength(0)
@ -71,6 +73,8 @@ ESP8266WebServer::ESP8266WebServer(int port)
, _lastHandler(nullptr)
, _currentArgCount(0)
, _currentArgs(nullptr)
, _postArgsLen(0)
, _postArgs(nullptr)
, _headerKeysCount(0)
, _currentHeaders(nullptr)
, _contentLength(0)
@ -486,6 +490,10 @@ void ESP8266WebServer::_streamFileCore(const size_t fileSize, const String & fil
const String& ESP8266WebServer::arg(String name) const {
for (int j = 0; j < _postArgsLen; ++j) {
if ( _postArgs[j].key == name )
return _postArgs[j].value;
}
for (int i = 0; i < _currentArgCount; ++i) {
if ( _currentArgs[i].key == name )
return _currentArgs[i].value;
@ -510,6 +518,10 @@ int ESP8266WebServer::args() const {
}
bool ESP8266WebServer::hasArg(const String& name) const {
for (int j = 0; j < _postArgsLen; ++j) {
if (_postArgs[j].key == name)
return true;
}
for (int i = 0; i < _currentArgCount; ++i) {
if (_currentArgs[i].key == name)
return true;