diff options
author | Alexander Tkachev | 2016-07-07 18:32:12 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | 83957c9666fce2e4b536c0974f22fc70f57b119c (patch) | |
tree | d92391ff501a8687641e53e9219027bf8803c40c /backends/networking/sdl_net/reader.cpp | |
parent | c82ed40fdd95761310855355c7c2a032512afd84 (diff) | |
download | scummvm-rg350-83957c9666fce2e4b536c0974f22fc70f57b119c.tar.gz scummvm-rg350-83957c9666fce2e4b536c0974f22fc70f57b119c.tar.bz2 scummvm-rg350-83957c9666fce2e4b536c0974f22fc70f57b119c.zip |
CLOUD: Determine file's name in POST
Diffstat (limited to 'backends/networking/sdl_net/reader.cpp')
-rw-r--r-- | backends/networking/sdl_net/reader.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/backends/networking/sdl_net/reader.cpp b/backends/networking/sdl_net/reader.cpp index 452520abfe..025f53492a 100644 --- a/backends/networking/sdl_net/reader.cpp +++ b/backends/networking/sdl_net/reader.cpp @@ -42,6 +42,7 @@ Reader::Reader() { _contentLength = 0; _availableBytes = 0; + _isFileField = false; _isBadRequest = false; } @@ -143,7 +144,21 @@ void Reader::handleHeaders(Common::String headers) { debug("FIELD NAME: >>%s<<", _currentFieldName.c_str()); //find out field type - //_fieldIsFile = true; + _currentFileName = ""; + readFromThatUntilLineEnd(headers.c_str(), "filename=\"", _currentFileName); + for (uint32 i = 0; i < _currentFileName.size(); ++i) + if (_currentFileName[i] == '\"') { + _currentFileName.erase(i); + break; + } + + if (!_currentFileName.empty()) { + _isFileField = true; + _queryParameters[_currentFieldName] = _currentFileName; + debug("FILE NAME: >>%s<<", _currentFileName.c_str()); + } else { + _isFileField = false; + } } } @@ -270,7 +285,7 @@ bool Reader::readContent() { } void Reader::handleFileContent(Common::String filename) { - _attachedFiles[_currentFieldName] = filename; + _attachedFiles[_currentFileName] = filename; } void Reader::handleValueContent(Common::String value) { |