Commit graph

116 commits

Author SHA1 Message Date
Le Philousophe
d97cd3b775 ANDROID: Bundle cacert.pem and don't disable certificate checks 2023-04-02 12:36:10 +02:00
Le Philousophe
376f978f57 BACKENDS: NETWORKING: Set pointer to nullptr when it's deleted
This avoids a UAF when file failed to open.
2023-02-26 21:46:29 +02:00
Martin Gerhardy
f101941710 NETWORKING: fixed mixed malloc/delete/delete[]
==84284== Mismatched free() / delete / delete []
==84284==    at 0x484371B: operator delete(void*) (vg_replace_malloc.c:923)
==84284==    by 0x5BFBBF: Networking::CurlRequest::~CurlRequest() (curlrequest.cpp:38)
==84284==    by 0x5C0963: Networking::CurlJsonRequest::~CurlJsonRequest() (curljsonrequest.cpp:40)
==84284==    by 0x5ACF0B: Cloud::GoogleDrive::GoogleDriveTokenRefresher::~GoogleDriveTokenRefresher() (googledrivetokenrefresher.cpp:37)
==84284==    by 0x5ACF27: Cloud::GoogleDrive::GoogleDriveTokenRefresher::~GoogleDriveTokenRefresher() (googledrivetokenrefresher.cpp:37)
==84284==    by 0x5BC2FC: Networking::ConnectionManager::interateRequests() (connectionmanager.cpp:189)
==84284==    by 0x5BC0FA: Networking::ConnectionManager::handle() (connectionmanager.cpp:158)
==84284==    by 0x5BBF45: Networking::connectionsThread(void*) (connectionmanager.cpp:127)
==84284==    by 0x5E6932: DefaultTimerManager::handler() (default-timer.cpp:110)
==84284==    by 0x5D7F04: timer_handler(unsigned int, void*) (sdl-timer.cpp:32)
==84284==    by 0x49283D3: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.1)
==84284==    by 0x4927F64: ??? (in /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.2600.1)
2023-01-17 23:17:17 +01:00
Eugene Sandulenko
40c93bde64
BACKENDS: NETWORKING: Slightly speed up downloads 2023-01-08 16:32:25 +01:00
Orgad Shaneh
f937755c6c BACKENDS: Disable curl deprecation warnings
We still need to support older versions, so mute the warnings as long as
the old APIs can still be used.
2022-12-25 10:32:44 +02:00
Cameron Cawley
28d7b361ea COMMON: Move more file format code into common/formats 2022-12-11 22:33:23 +01:00
Eugene Sandulenko
a670a17480
NETWORKING: Properly process TLS errors.
Now, when HTTPS is not supported, we will indicate it to the user.
2022-10-10 22:37:22 +02:00
Donovan Watteau
5b1ec56f96 JANITORIAL: Fix some lost or outdated URLs in comments 2022-05-19 07:57:31 +03:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Eugene Sandulenko
92ec44b6ab
BACKENDS: NETWORKING: Preparations for aborting the request
Looks like we need API for removing DumpFile, but that must be done
in a safe way.
2021-11-20 00:55:44 +01:00
Eugene Sandulenko
1507559a66
BACKENDS: NETWORKING: Fix local file downloading when stream is reused 2021-11-18 22:38:44 +01:00
Eugene Sandulenko
5df691a3a6
BACKENDS: NETWORKING: Properly signal end of downloaded file 2021-11-18 22:38:43 +01:00
Eugene Sandulenko
db7cec6935
CLOUD: SessionRequest now can save downloaded files to disk 2021-11-18 22:38:43 +01:00
Eugene Sandulenko
768cac42f9
BACKENDS: NETWORKING: Make SessionRequest correctly process HTTP error codes 2021-11-18 22:38:42 +01:00
Eugene Sandulenko
a89cb7f85e
BACKENDS: NETWORKING: Added binary mode to SessionRequest 2021-11-18 22:38:42 +01:00
Orgad Shaneh
44219dfa1a BACKENDS: Use nullptr
Using clang-tidy modernize-use-nullptr
2021-11-14 15:51:59 +02:00
Orgad Shaneh
a05e54f00c JANITORIAL: Remove trailing whitespaces 2021-05-04 11:46:30 +03:00
rsn8887
68fad60eb6 PSP2: Fix cloud integration 2020-04-27 23:02:18 -05:00
Eugene Sandulenko
1584c36410 NETWORKING: Fix compilation for lower versions of libcurl 2019-11-05 21:42:53 +01:00
Alexander Tkachev
99e21f4320 NETWORKING: Enter Session
Session allows to reuse SessionRequests to the same host by making them
keeping alive connection. Turns out, though, that libcurl already does
that for us, and we didn't gain any speedup we thought we'd get.

Usage:
```
Networking::Session s;
Networking::SessionRequest *request = s.get(url);
request->startAndWait();
warning("HTTP GET: %s", request->text());
s.close();
```

You can still use SessionRequest without Session (but you can't put them
on stack!):
```
Networking::SessionRequest *request = new
Networking::SessionRequest(url);
request->startAndWait();
warning("HTTP GET: %s", request->text());
request->close();
```
2019-11-05 01:47:00 +01:00
Alexander Tkachev
f7d9156967 NETWORKING: Enter SessionRequest
It is to be used in a Session, though it might be used separately. It
must implement keep-alive, but it does not yet.

You must not put it to ConnMan by yourself (instead, use start()) and
you must call close() after you've finished using this request.

You can either work with it in callback, or wait() and simply use its
methods (check it's success() and then, for example, use text()). Like
this:
```
Networking::SessionRequest *rq = new Networking::SessionRequest(url);
rq->startAndWait();
if (rq->success())
warning("HTTP GET: %s", rq->text());
rq->close();
```
2019-11-05 01:47:00 +01:00
Alexander Tkachev
bc63abd3e1 NETWORKING: Add CurlRequest::wait() 2019-11-05 01:47:00 +01:00
Alexander Tkachev
2acb8e2215 JANITORIAL: Fix Networking::DataResponse typedef naming 2019-11-05 01:47:00 +01:00
Bastien Bouclet
6fa7322a6a NETWORKING: Try loading the CA bundle from DATA_PATH 2019-11-03 19:48:34 +02:00
Bastien Bouclet
47b67342d6 NETWORKING: Improve libcurl error handling
Error messages for failed requests are now printed as warnings.
2019-11-03 19:48:34 +02:00
Thanasis Antoniou
4eecfb8da9 ANDROID: Disable verification of certificates validity for cloud saving
Also added macros for the plain (non-SDL) Android port __ANDROID_PLAIN_PORT__ and ANDROID_PLAIN_PORT

The workaround of this commit uses the same logic as for the Nintendo Switch port and should suffice for testing purposes. It should be replaced by more elaborate code of installing and maintaining a certificates pem file.
2019-11-01 19:13:27 +02:00
Eugene Sandulenko
7533375b55 NETWORKING: Remove unnesessary check 2019-10-25 00:55:51 +02:00
Eugene Sandulenko
bbaebe594e NETWORKING: Reworked PostRequest to a more universal API 2019-10-24 17:41:28 +02:00
Eugene Sandulenko
a0c58a53b3 NETWORKING: Changed PostRequest to accept JSONValue 2019-10-24 00:15:33 +02:00
Eugene Sandulenko
0ad210a5a4 NETWORKING: Added simple request handler 2019-10-24 00:15:33 +02:00
rsn8887
cdbcb29609 SWITCH: Fix cloud integration 2019-10-13 14:19:05 -05:00
Alexander Tkachev
5b5a89e3e7 CLOUD: Make Network::ErrorResponse messages more verbose
This commit updates all usages of Network::ErrorResponse to specify at
least method name if not precise reason why operation failed.
2019-08-25 12:15:14 +03:00
Alexander Tkachev
24b1ec0ded CLOUD: Handle HTTP response headers case-insensitively
RFC 2616 states that HTTP headers are not case-sensitive and also allows
arbitrary number of whitespace characters around header value. Previous
implementation was dependant on headers to be in "Title-Case" and to
have only one space before header value. That has lead to cloud sync
failure on Debian x64 (user's network environment was probably the
reason though).

This commit adds a new method, which parses headers name-value pairs
into HashMap. To ensure case-insensitivity, all headers names are
converted to lowercase, and thus code that uses this method should
specify headers in lowercase. All usages of raw headers contents were
updated to use this method.
2019-08-25 12:15:14 +03:00
Alexander Tkachev
c1124c9cda CLOUD: Handle Cloud requests more frequently
ConnectionManager used to poll Cloud requests every second, while curl
requests were polled every 1/20th of a second. If curl request was over
at, say, frame #21, corresponding Cloud request would've only work with
that at frame #40 (950 ms later), which was making everything
cloud-related slower than it could be. This commit fixes it by making
Cloud polling period the same as curl polling period, and additionally
raises FPS to 25.
2019-07-30 14:51:41 -04:00
SupSuper
272d4105b2 WIN32: Fix libcurl redefining ARRAYSIZE
libcurl pulls in Windows headers, so let's include it first to avoid clashing with common headers
2018-12-17 12:28:33 +02:00
Bastien Bouclet
4890dd4466 NETWORKING: Fix mismatched curl callback declaration and definition 2017-09-24 08:24:40 +02:00
Bastien Bouclet
2832332e74 NETWORKING: Changed NetworkReadStream not to subclass MemoryReadWriteStream
Also fix the MemoryReadWriteStream managed buffer being leaked.
Fixes #9718.
2017-09-22 07:05:59 +02:00
Eugene Sandulenko
940b2a20f1 Revert "COMMON: Change way the Singleton instances are instantiated"
This reverts commit eefa72afa1.

With this patch ConfigManager is broken.
2017-07-10 21:17:41 +02:00
Thierry Crozat
eefa72afa1 COMMON: Change way the Singleton instances are instantiated
This fixes tons of warnings with clang from a recent xcode version on
macOS (and possibly other systems) complaining that an instantiation
of _singleton is required but no definition is available.
2017-07-10 21:11:20 +02:00
Thierry Crozat
9a8aea0585 CLOUD: Fix compilation with old curl vesions 2017-04-29 22:10:16 +01:00
D G Turner
1bdeff2d56 CLOUD: Fix Two Variable Shadowing Compiler Warnings. 2017-01-10 04:14:28 +00:00
Bastien Bouclet
1a1a5b5f69 CLOUD: Change the cloud icon to be updated by the main thread
The cloud manager registers itself as an event source as a mean to be polled
periodically by the GUI or engine code. The periodical polling is used to
update the OSD icon indicating background sync activity.

Also move the cloud icon from ConnectionManager to CloudManager,
allowing to decouple icon handling from network connections updates.
2016-09-18 17:54:12 +02:00
Bastien Bouclet
4d68b93aba CLOUD: Switch to the new OSD API 2016-09-13 20:29:09 +02:00
Thierry Crozat
d853240eee CLOUD: Do not error out when loading icon if OSD format is not 2 or 4 Bpp
Graphics::TransparentSurface::convertTo() errors out when the destination
format is not 2 or 4 Bpp. But in the case of the cloud icon we can recover
from it. So just print a warning and don't close the application.
2016-09-05 21:59:34 +01:00
Eugene Sandulenko
fab199d37e JANITORIAL: Make GPL headers uniform 2016-09-03 12:46:38 +02:00
Peter Bozsó
02a997e468 CLOUD: Remove unused includes 2016-08-24 16:07:55 +06:00
Alexander Tkachev
4f0c071e53 CLOUD: Add custom User-Agent
Full version is used like in Eugene's Google Analytics stub. Plus, on
PS3 that string contains "PlayStation", and that would be cool to know
that ScummVM+libcurl+PS3 work together.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
37859a9203 CLOUD: Fix Requests
Remove unnecessary JSON warnings, fix a few places.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
fc8e29d583 CLOUD: Update OneDrive
Added JSON checks.

New jsonContainsObject() method added to CurlJsonRequest.
2016-08-24 16:07:55 +06:00
Alexander Tkachev
46dda5fce0 CLOUD: Update NetworkReadStream
It now uses both CURLOPT_PROGRESSFUNCTION and CURLOPT_XFERINFOFUNCTION.
The latter is available in new libcurl (>= 7.32.0) only, thus the former
is added for older versions support.
2016-08-24 16:07:55 +06:00