Commit Graph

20 Commits

Author SHA1 Message Date
Silent
9eab3feddf
Fix out of bounds read in HttpRequest::Impl::Fetch logging 2019-06-23 21:44:51 +02:00
spycrab
ba4c1c5947 Common/HttpRequest: Use CURLOPT_ERRORBUFFER for error messages 2019-06-20 19:44:51 +02:00
Lioncash
ab2adfb0a7 Common/HttpRequest: Simplify cURL initialization
std::call_once is guaranteed to execute the given callable object
exactly once. This guarantee holds even if the function is called
concurrently from several threads.

Given that, we can replace the mutex and boolean flag with
std::call_once and a std::once_flag to perform the same behavior.
2019-05-27 09:46:57 -04:00
Lioncash
b15f595130 Common/HttpRequest: Avoid unnecessary copies in loop in Fetch()
Previously, every entry pair within the map would be copied. The reason
for this is subtle.

A std::map's internal entry type is defined as:

std::pair<const Key, Value>

but the loop was declaring it as:

std::pair<Key, Value>

These two types aren't synonymous with one another and so the compiler
is required to always perform a copy.

Using structured bindings avoids this (as would plain auto or correcting
the explicit type), while also allowing the use of more appropriate
names compared to first and second.
2019-05-27 09:36:31 -04:00
Lioncash
8dc8cf8019 Common/HttpRequest: std::move callback in constructor
std::function is allowed to heap allocate in order to hold any necessary
bound data in order to execute properly (e.g. lambdas with captures), so
this avoids unnecessary reallocating.
2019-05-27 09:26:28 -04:00
spycrab
eddcb70b84 Common/HttpRequest: Add option to allow non 200 response codes 2019-04-13 12:58:23 +02:00
spycrab
ca5eac0c63 Common/HttpRequest: Fix EscapeComponent leaking memory 2019-04-06 13:27:49 +02:00
spycrab
094bf0d2ff Qt/NetPlay: Integrate NetPlayIndex 2019-04-06 12:27:30 +02:00
spycrab
3dbf44417a Common/HttpRequest: Implement EscapeComponent 2019-03-30 17:13:57 +01:00
Tillmann Karras
3ff0e7dbd4 Common/HttpRequest: optionally follow redirects 2019-02-01 13:44:58 +00:00
Sleepy Flower Girl
158c0d54b1 Force IPv4 on external IP addresses 2018-08-13 21:17:38 -04:00
spycrab
44784cf363 Common/HttpRequest: Add option to set cookies 2018-05-29 03:56:28 +02:00
spycrab
11f83c1e36 HttpRequest/Curl: Use a more intelligent timeout method 2018-05-04 13:30:49 +02:00
spycrab
f700fcae2e HttpRequest: Add callback option 2018-03-28 17:33:34 +02:00
Pierre Bourdon
bc9deb7be3 HttpRequest: make curl initialization thread-safe 2018-03-20 00:36:43 +01:00
Lioncash
251de89b5c HttpRequest: Use std::chrono for indicating time periods
Allows the use of chrono time points, on top of being more indicative of
time periods used at call sites, if custom timeouts are specified.
2017-06-18 15:48:37 -04:00
Léo Lam
0d58a0bfe2 HttpRequest: Add support for custom timeouts 2017-06-13 19:17:11 +02:00
Léo Lam
ba3f16edbf HttpRequest: Add support for sending custom headers 2017-06-13 12:52:31 +02:00
Léo Lam
8f87433719 HttpRequest: Log response body on failure 2017-06-13 12:52:31 +02:00
Léo Lam
18678afa6d Common: Add HttpRequest to simplify HTTP requests
Too much boilerplate that is duplicated if we use curl directly.
Let's add a simple wrapper class that hides the implementation details
and just allows to simply make HTTP requests and get responses.
2017-06-13 12:52:31 +02:00