oxen-core/contrib/epee/include
Jason Rhinelander fb0aff57f6 Replace epee http client with curl-based client
In short: epee's http client is garbage, standard violating, and
unreliable.

This completely removes the epee http client support and replaces it
with cpr, a curl-based C++ wrapper.  rpc/http_client.h wraps cpr for RPC
requests specifically, but it is also usable directly.

This replacement has a number of advantages:

- requests are considerably more reliable.  The epee http client code
  assumes that a connection will be kept alive forever, and returns a
  failure if a connection is ever closed.  This results in some very
  annoying things: for example, preparing a transaction and then waiting
  a long tim before confirming it will usually result in an error
  communication with the daemon.  This is just terribly behaviour: the
  right thing to do on a connection failure is to resubmit the request.

- epee's http client is broken in lots of other ways: for example, it
  tries throwing SSL at the port to see if it is HTTPS, but this is
  protocol violating and just breaks (with a several second timeout) on
  anything that *isn't* epee http server (for example, when lokid is
  behind a proxying server).

- even when it isn't doing the above, the client breaks in other ways:
  for example, there is a comment (replaced in this PR) in the Trezor PR
  code that forces a connection close after every request because epee's
  http client doesn't do proper keep-alive request handling.

- it seems noticeably faster to me in practical use in this PR; both
  simple requests (for example, when running `lokid status`) and
  wallet<->daemon connections are faster, probably because of crappy
  code in epee.  (I think this is also related to the throw-ssl-at-it
  junk above: the epee client always generates an ssl certificate during
  static initialization because it might need one at some point).

- significantly reduces the amount of code we have to maintain.

- removes all the epee ssl option code: curl can handle all of that just
  fine.

- removes the epee socks proxy code; curl can handle that just fine.
  (And can do more: it also supports using HTTP/HTTPS proxies).

- When a cli wallet connection fails we know show why it failed (which
  now is an error message from curl), which could have all sorts of
  reasons like hostname resolution failure, bad ssl certificate, etc.
  Previously you just got a useless generic error that tells you
  nothing.

Other related changes in this PR:

- Drops the check-for-update and download-update code.  To the best of
my knowledge these have never been supported in loki-core and so it
didn't seem worth the trouble to convert them to use cpr for the
requests.

- Cleaned up node_rpc_proxy return values: there was an inconsistent mix
  of ways to return errors and how the returned strings were handled.
  Instead this cleans it up to return a pair<bool, val>, which (with
  C++17) can be transparently captured as:

    auto [success, val] = node.whatever(req);

  This drops the failure message string, but it was almost always set to
  something fairly useless (if we want to resurrect it we could easily
  change the first element to be a custom type with a bool operator for
  success, and a `.error` attribute containing some error string, but
  for the most part the current code wasn't doing much useful with the
  failure string).

- changed local detection (for automatic trusted daemon determination)
  to just look for localhost, and to not try to resolve anything.
  Trusting non-public IPs does not work well (e.g. with lokinet where
  all .loki addresses resolve to a local IP).

- ssl fingerprint option is removed; this isn't supported by curl
  (because it is essentially just duplicating what a custom cainfo
  bundle does)

- --daemon-ssl-allow-chained is removed; it wasn't a useful option (if
  you don't want chaining, don't specify a cainfo chain).

- --daemon-address is now a URL instead of just host:port.  (If you omit
  the protocol, http:// is prepended).

- --daemon-host and --daemon-port are now deprecated and produce a
  warning (in simplewallet) if used; the replacement is to use
  --daemon-address.

- --daemon-ssl is deprecated; specify --daemon-address=https://whatever
  instead.

- the above three are now hidden from --help

- reordered the wallet connection options to make more logical sense.
2020-08-07 17:14:03 -03:00
..
net Replace epee http client with curl-based client 2020-08-07 17:14:03 -03:00
serialization Make sure we don't blob serialize padded types 2020-07-02 12:52:13 -03:00
storages Miscellaneous fixes 2020-07-02 12:52:13 -03:00
console_handler.h Make daemon interactive commands ordered again 2020-08-01 12:37:25 -03:00
copyable_atomic.h copyable_atomic: add a ctor with initial value 2017-09-27 11:43:08 +01:00
file_io_utils.h epee.string_tools: add conversion between UTF-8 and UTF-16 2018-06-28 09:40:26 +09:00
fnv1.h wallet: wipe seed from memory where appropriate 2018-08-16 09:17:52 +00:00
gzip_encoding.h Remove stupid OUT macro 2020-07-02 12:52:12 -03:00
hex.h Miscellaneous header updates via iwyu 2020-07-02 12:52:13 -03:00
hmac-md5.h moved all stuff to github 2014-03-03 22:07:58 +00:00
include_base_utils.h move modified epee code to new classes, revert license 2014-07-25 18:29:08 +02:00
int-util.h Merge commit '48d8475b6ea77c6cc9670c9c312f3b7684b12a2c' into MergeUpstream3 2020-05-21 13:37:57 +10:00
md5_l.h Replace memset with memwipe. 2019-11-13 18:00:50 +01:00
md5_l.inl Removed boost/asio.hpp include from epee/string_tools.h 2017-03-18 22:05:14 -04:00
md5global.h moved all stuff to github 2014-03-03 22:07:58 +00:00
memwipe.h Post-merge updates: epee::is_byte_spannable 2020-07-02 12:52:13 -03:00
misc_language.h Miscellaneous header updates via iwyu 2020-07-02 12:52:13 -03:00
misc_log_ex.h Remove horrible logging macros 2020-07-02 12:52:13 -03:00
misc_os_dependent.h Remove unused call_sys_cmd function 2020-07-02 12:52:13 -03:00
mlocker.h Post-merge updates: epee::is_byte_spannable 2020-07-02 12:52:13 -03:00
pragma_comp_defs.h move modified epee code to new classes, revert license 2014-07-25 18:29:08 +02:00
profile_tools.h Miscellaneous fixes 2020-07-02 12:52:13 -03:00
readline_buffer.h Miscellaneous header updates via iwyu 2020-07-02 12:52:13 -03:00
readline_suspend.h Make suspend_readline a (usable) no-op when readline not available 2020-05-20 00:48:59 -03:00
rolling_median.h Split up common/util.h 2020-07-02 12:52:12 -03:00
shared_sv.h Replace epee::byte_slice with much simpler shared_sv 2020-07-02 12:52:13 -03:00
span.h Post-merge updates: epee::is_byte_spannable 2020-07-02 12:52:13 -03:00
stats.h performance_tests: better stats, and keep track of timing history 2019-01-28 15:45:37 +00:00
stats.inl performance_tests: better stats, and keep track of timing history 2019-01-28 15:45:37 +00:00
string_coding.h Removed some unused epee functions 2017-04-25 16:07:32 -04:00
string_tools.h Miscellaneous header updates via iwyu 2020-07-02 12:52:13 -03:00
time_helper.h epee time helper: remove cruft, move to src/ 2020-07-02 12:52:13 -03:00
to_nonconst_iterator.h move modified epee code to new classes, revert license 2014-07-25 18:29:08 +02:00
warnings.h year updated in license 2015-01-02 18:52:46 +02:00
wipeable_string.h More string_view (mostly in wallet code) 2020-07-02 12:55:28 -03:00