From d1b5a640205af29af9785846d2e6153e67241f2c Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Sat, 9 Jul 2016 16:37:56 +0600 Subject: CLOUD: Cleanup in Reader and Client --- backends/networking/sdl_net/reader.h | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'backends/networking/sdl_net/reader.h') diff --git a/backends/networking/sdl_net/reader.h b/backends/networking/sdl_net/reader.h index 0ed0d8c91e..d234a82782 100644 --- a/backends/networking/sdl_net/reader.h +++ b/backends/networking/sdl_net/reader.h @@ -23,11 +23,9 @@ #ifndef BACKENDS_NETWORKING_SDL_NET_READER_H #define BACKENDS_NETWORKING_SDL_NET_READER_H -#include "common/scummsys.h" #include "common/str.h" #include "common/hashmap.h" #include "common/hash-str.h" -#include "common/random.h" namespace Common { class MemoryReadWriteStream; @@ -43,8 +41,6 @@ enum ReaderState { }; class Reader { - Common::RandomSource _randomSource; //for temp file names - ReaderState _state; Common::MemoryReadWriteStream *_content; uint32 _bytesLeft; @@ -53,31 +49,22 @@ class Reader { uint32 _windowUsed, _windowSize; Common::String _headers; - Common::WriteStream *_stream; - bool _firstBlock; - - ///Common::String _headers; Common::String _method, _path, _query, _anchor; Common::HashMap _queryParameters; - Common::HashMap _attachedFiles; uint32 _contentLength; Common::String _boundary; uint32 _availableBytes; - Common::String _currentFieldName, _currentFileName, _currentTempFileName; - bool _isFileField; + bool _firstBlock; bool _isBadRequest; bool _allContentRead; void cleanup(); - bool readWholeHeaders(); //true when ended reading - bool readWholeContent(); //true when ended reading - bool readWholeHeadersIntoStream(Common::WriteStream *stream); //true when ended reading - bool readWholeContentIntoStream(Common::WriteStream *stream); //true when ended reading - void handleHeaders(Common::String headers); - void handleFileContent(Common::String filename); - void handleValueContent(Common::String value); + bool readAndHandleFirstHeaders(); //true when ended reading + bool readBlockHeadersIntoStream(Common::WriteStream *stream); //true when ended reading + bool readContentIntoStream(Common::WriteStream *stream); //true when ended reading + void handleFirstHeaders(Common::String headers); void parseFirstLine(const Common::String &headers); void parsePathQueryAndAnchor(Common::String path); void parseQueryParameters(); @@ -96,20 +83,21 @@ public: Reader &operator=(Reader &r); - bool readWholeRequest(); //true when ended reading bool readFirstHeaders(); //true when ended reading bool readFirstContent(Common::WriteStream *stream); //true when ended reading bool readBlockHeaders(Common::WriteStream *stream); //true when ended reading bool readBlockContent(Common::WriteStream *stream); //true when ended reading + void setContent(Common::MemoryReadWriteStream *stream); + bool badRequest() const; bool noMoreContent() const; + Common::String headers() const; Common::String method() const; Common::String path() const; Common::String query() const; Common::String queryParameter(Common::String name) const; - Common::String attachedFile(Common::String name) const; Common::String anchor() const; }; -- cgit v1.2.3