Commit Graph

31 Commits

Author SHA1 Message Date
Alexander Tkachev
bb67b81d04 CLOUD: Update Reader to support pausing
That means that if current buffer is over, reader will stop reading and
it's safe to call readResponse() again, so it would continue from the
place it left.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
79b39bf0d0 CLOUD: Add Reader sketch
That should be part of the Client, I guess. Reader is not ready to
continue reading from place it stopped, but it already works as it
should for the case when whole content is available.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
4d88f51de9 CLOUD: Add query parameters URL encoding
In local webserver's links.

Fixed URL decoding to understand '+', by the way. Firefox sends these
instead of spaces and "%2B" instead of '+'.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
89a1a54982 CLOUD: Update GetClientHandler's buffer
It's not static now and it's increased to 1 MB.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
b40bfaa046 CLOUD: Add "/download" handler
Now one can download files from the device through browser!
2016-08-24 16:07:55 +06:00
Alexander Tkachev
8a9d126152 CLOUD: Move "/create" to separate Handler
It does redirect to "/files" on success, so user doesn't even see the
strange "/create" URL at all.

This commit is for keeping these handlers small, not making one
(FilesPageHandler in this case) do everything.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
ab4361a76b CLOUD: Make "/create" work
One can now create directories through browser.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
48e3fff6bc CLOUD: Refactor LocalWebserver
Its handlers are now more compact. This commit moves Handler classes in
handlers\ directory.

ResourceHandler ignores "hidden" files in the archive, and these are
used as markup templates in IndexPageHandler and FilesPageHandler.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
627bda9d82 COMMON: Add replace(String, String, String)
Searches for a substring in the string and replaces it with the other
string.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
e47b6c04b3 CLOUD: Make "/files" list directories
Including both virtual "/root" and "/saves" ones.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
c409d29f66 CLOUD: Add "/files" handler
Shows the page with controls, but doesn't actually list the directories,
create the specified ones or allows to upload files yet.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
eae57728d1 CLOUD: Resolve local machine's IP 2016-08-24 16:07:55 +06:00
Alexander Tkachev
e601c39802 CLOUD: Make "Run server" button active
It should show the real server's IP over there, but that doesn't work
yet.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
fa3ea83165 CLOUD: Fix some warnings
Mostly on format string
2016-08-24 16:07:55 +06:00
Alexander Tkachev
caa53d9f6c CLOUD: Fix "-Wconversion-null"
That `false` came from TranslationManager's function, which was
returning bool, not a pointer. Somehow missed that line.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
04cef8928c CLOUD: Fix "type qualifiers ignored" warning 2016-08-24 16:07:55 +06:00
Alexander Tkachev
6ac69729d5 CLOUD: Add some mutexes in LocalWebserver 2016-08-24 16:07:55 +06:00
Alexander Tkachev
a56c7a3bd6 CLOUD: Update IndexPageHandler to search wwwroot.zip
Now it also searches for that in themepath, not with SearchMan only.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
c2c2ba908f GUI: Hide StorageWizardDialog fields if server present 2016-08-24 16:07:55 +06:00
Alexander Tkachev
5176eaba81 CLOUD: Add wwwroot
wwwroot.zip contains ScummVM local webserver's resources, such as
template html pages, styles and images.

One can make it from wwwroot directory contents by running
make_archive.py script.

It's added to scummvm.rc, so it's included in the executable (it works
with MinGW, but I was unable to do that in VS yet).

IndexPageHandler is the one who returns these resources. It uses
index.html for "/". I'm replacing "{message}" with translated message,
so that's the way I thought the templates should work.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
43071c0972 CLOUD: Update LocalWebserver
* fix handling connections;
* fix idling strategy;
* add setClientGetHandler() for SeekableReadStream;
* add determineMimeType().
2016-08-24 16:07:55 +06:00
Alexander Tkachev
0def9c50a7 CLOUD: Fix Client
Cleanup in open()
2016-08-24 16:07:55 +06:00
Alexander Tkachev
5ac3adbd4f CLOUD: Add IndexPageHandler
This commit also adds LocalWebserver's stopOnIdle().
That means server is not stopped immediately, but only when all clients
are served.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
733d998e6a CLOUD: Minor Client fix 2016-08-24 16:07:55 +06:00
Alexander Tkachev
3946f23d17 CLOUD: Prepare code for path handlers
LocalWebserver would storage the handlers.

Client now has methods like path() or query() to access different parts
of the request.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
892c1bf84c CLOUD: Add HTTP response codes in GetClientHandler 2016-08-24 16:07:55 +06:00
Alexander Tkachev
6e1b667dd6 CLOUD: Minor Client fix 2016-08-24 16:07:55 +06:00
Alexander Tkachev
13c54f6685 CLOUD: Add GetClientHandler
That ClientHandler is made for responding GET requests. It calculates
stream's length, it allows to specify response code and headers, it can
be used to transfer any ReadStream.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
99c51380fd CLOUD: Add ClientState::BAD_REQUEST 2016-08-24 16:07:55 +06:00
Alexander Tkachev
6126435b64 CLOUD: Add Networking::Client
Keeps current client's state
2016-08-24 16:07:55 +06:00
Alexander Tkachev
0af97e59bc CLOUD: Add LocalWebserver
Available as LocalServer singleton. It's being started and stopped by
StorageWizardDialog. It doesn't handle clients yet, though.
2016-08-24 16:07:55 +06:00