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();
```
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();
```
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.
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.
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.
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.
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.
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.
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.
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.
The passed buffer is not changed, so could be `const`.
You might see that `postFields.c_str()` is `buffer`. Yet, as it's
`postFields`, it's used for POST in curl_easy_setopt(), which copies the
passed buffer. When `buffer` is used for upload, it's an actual bytes
buffer, kept in CurlRequest.