aboutsummaryrefslogtreecommitdiff
path: root/backends/networking/sdl_net/client.h
diff options
context:
space:
mode:
authorAlexander Tkachev2016-07-09 15:49:18 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commite4bb7c4e750d53434140a8d1a401e7fa6ee221ab (patch)
tree4b6d555163353d71b51e64308e5a4dccc85f2216 /backends/networking/sdl_net/client.h
parenta424ebbc28549c0e06b9a8ca4985bf799179c404 (diff)
downloadscummvm-rg350-e4bb7c4e750d53434140a8d1a401e7fa6ee221ab.tar.gz
scummvm-rg350-e4bb7c4e750d53434140a8d1a401e7fa6ee221ab.tar.bz2
scummvm-rg350-e4bb7c4e750d53434140a8d1a401e7fa6ee221ab.zip
CLOUD: Add UploadFileClientHandler
Now Client reads the first headers block, then LocalWebserver decides which Handler to use. In case of "/upload", UploadFileHandler is used. But now it only knows the "path" parameter. If that's valid, actual UploadFileClientHandler is created, which reads the contents of the request and, when finds there an "upload_file" field, starts saving it in the directory specified by "path". With that we don't need temp files approach from Reader class.
Diffstat (limited to 'backends/networking/sdl_net/client.h')
-rw-r--r--backends/networking/sdl_net/client.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/backends/networking/sdl_net/client.h b/backends/networking/sdl_net/client.h
index cd10adc780..6a0dea32fe 100644
--- a/backends/networking/sdl_net/client.h
+++ b/backends/networking/sdl_net/client.h
@@ -27,6 +27,10 @@
#include "common/str.h"
#include "reader.h"
+namespace Common {
+class MemoryReadWriteStream;
+}
+
typedef struct _SDLNet_SocketSet *SDLNet_SocketSet;
typedef struct _TCPsocket *TCPsocket;
@@ -53,7 +57,10 @@ class Client {
SDLNet_SocketSet _set;
TCPsocket _socket;
Reader _reader;
- ClientHandler *_handler;
+ ClientHandler *_handler, *_previousHandler;
+ Common::MemoryReadWriteStream *_stream;
+
+ bool readMoreIfNeeded();
public:
Client();
@@ -62,7 +69,11 @@ public:
void open(SDLNet_SocketSet set, TCPsocket socket);
void readHeaders();
+ bool readContent(Common::WriteStream *stream);
+ bool readBlockHeaders(Common::WriteStream *stream);
+ bool readBlockContent(Common::WriteStream *stream);
void setHandler(ClientHandler *handler);
+ void dropHandler();
void handle();
void close();