oxen-core/tests/unit_tests
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
..
CMakeLists.txt Replace boost chrono & posix_time with stl chrono 2020-07-02 12:52:13 -03:00
account.cpp Update 2019 copyright 2019-03-05 22:05:34 +01:00
address_from_url.cpp Fix test broken by Monero donation address change 2020-06-09 23:06:54 -03:00
aligned.cpp unit_tests: add unit test for alloc alignment being a power of 2 2018-10-08 11:36:42 +00:00
apply_permutation.cpp Update 2019 copyright 2019-03-05 22:05:34 +01:00
base58.cpp Remove ancient hex wallet address support 2020-07-02 12:52:13 -03:00
block_queue.cpp Replace boost chrono & posix_time with stl chrono 2020-07-02 12:52:13 -03:00
block_reward.cpp Add core test for service node reward dervied from unpenalized reward 2019-09-20 09:32:59 +10:00
blockchain_db.cpp Merge commit 'dc64fcb8a6c046c6e30665a6217b8fb6ec2471bc' into MergeUpstream3 2020-05-22 11:25:15 +10:00
bulletproofs.cpp Merge commit '8606b1a' into MergeUpstream3 2020-05-27 17:01:12 +10:00
chacha.cpp Update 2019 copyright 2019-03-05 22:05:34 +01:00
checkpoints.cpp Replace loki::clamp_u64 backport with std::clamp 2020-07-02 12:52:13 -03:00
command_line.cpp Update 2019 copyright 2019-03-05 22:05:34 +01:00
crypto.cpp Test suite compilation updates 2019-11-27 14:09:30 -04:00
device.cpp ringct: remove unused senderPk from ecdhTuple 2019-01-22 23:17:42 +00:00
difficulty.cpp difficulty: fix check_hash on big endian 2019-09-04 14:53:53 +00:00
dns_resolver.cpp More string_view niceties 2020-07-02 12:52:13 -03:00
epee_boosted_tcp_server.cpp Replace (most) boost::thread with std::thread 2020-07-02 12:52:13 -03:00
epee_levin_protocol_handler_async.cpp Replace epee::byte_slice with much simpler shared_sv 2020-07-02 12:52:13 -03:00
epee_utils.cpp Miscellaneous fixes 2020-07-02 12:52:13 -03:00
expect.cpp Replace boost::string_ref with std::string_view 2020-07-02 12:52:12 -03:00
get_xtype_from_string.cpp Reduce namespace pollution 2020-07-02 12:52:12 -03:00
hardfork.cpp Merge commit 'e9464eb' into LokiMergeUpstream 2019-05-02 13:33:13 +10:00
hashchain.cpp Update 2019 copyright 2019-03-05 22:05:34 +01:00
hmac_keccak.cpp unit_tests: fix missing test names 2020-02-18 23:56:21 +00:00
http.cpp Fix epee spelling: mime_tipe -> mime_type 2020-05-11 18:45:15 -03:00
is_hdd.cpp Split up common/util.h 2020-07-02 12:52:12 -03:00
json_serialization.cpp boost::variant -> std::variant 2020-07-02 12:52:12 -03:00
keccak.cpp Merge commit '309f2def9e3357174904d29040883a70ff0cbd68' into MergeUpstream 2020-04-07 14:24:36 +10:00
levin.cpp Replace epee http client with curl-based client 2020-08-07 17:14:03 -03:00
lmdb.cpp Adding classes, functions, and utilities for common LMDB operations. 2019-03-19 17:52:26 +00:00
logging.cpp Properly format multiline logs 2019-09-16 16:58:01 +00:00
loki_name_system.cpp LNS: Disable localhost.loki, disallow '_'s in lokinet 2020-03-13 09:24:47 +11:00
long_term_block_weight.cpp Add support for Loki Name Service on the backend 2020-02-13 11:07:46 +11:00
main.cpp Provide --log-level for unit tests 2019-03-22 15:27:09 +11:00
memwipe.cpp Update 2019 copyright 2019-03-05 22:05:34 +01:00
mlocker.cpp Merge pull request #4459 2018-09-29 22:20:38 +02:00
mnemonics.cpp Merge commit '7fc76451a5bc3b9f6a08eaa3f9bb31d450ee79a3' into MergeUpstream 2020-04-09 15:38:24 +10:00
mul_div.cpp Merge commit 'c4f75fe' into MergeUpstream3 2020-05-28 15:29:00 +10:00
multiexp.cpp Fix unit tests ODR violation 2020-06-15 12:49:33 -03:00
multisig.cpp Replace epee http client with curl-based client 2020-08-07 17:14:03 -03:00
net.cpp Replace epee http client with curl-based client 2020-08-07 17:14:03 -03:00
node_server.cpp Fix NULL being passed as bool 2020-06-15 12:49:33 -03:00
notify.cpp unit_tests: remove leftover debug print 2019-02-01 19:14:55 +00:00
output_distribution.cpp boost::optional -> std::optional 2020-07-02 12:52:12 -03:00
output_selection.cpp Merge commit 'c5e9266' into MergeUpstream2 2020-04-20 17:07:14 +10:00
parse_amount.cpp More string_view (mostly in wallet code) 2020-07-02 12:55:28 -03:00
pruning.cpp Pruning 2019-01-22 20:30:51 +00:00
random.cpp Merge batch upstream changes from monero 2018-09-19 19:21:56 +10:00
ringct.cpp Reduce namespace pollution 2020-07-02 12:52:12 -03:00
ringdb.cpp Fix unit tests ODR violation 2020-06-15 12:49:33 -03:00
rolling_median.cpp Replace std::random_shuffle with std::shuffle 2019-08-15 16:33:15 +02:00
serialization.cpp Overhaul binary serialization code (part 1) 2020-07-02 12:52:12 -03:00
service_nodes.cpp Another test fix 2019-11-27 14:09:30 -04:00
service_nodes_swarm.cpp Bufferless swarm assignment logic (#518) 2019-04-08 12:03:47 +10:00
sha256.cpp Miscellaneous header updates via iwyu 2020-07-02 12:52:13 -03:00
string_util.cpp Fix hex_to_type and add a unit test for it 2020-07-02 12:56:37 -03:00
subaddress.cpp Update 2019 copyright 2019-03-05 22:05:34 +01:00
test_notifier.cpp unit_tests: add a notifier test 2018-10-01 09:14:20 +00:00
test_peerlist.cpp boost::optional -> std::optional 2020-07-02 12:52:12 -03:00
test_protocol_pack.cpp Merge commit 'e3de4aa' into MergeUpstream 2020-04-07 15:21:50 +10:00
test_tx_utils.cpp Fix wrong field name in tx padding tests 2020-07-02 12:52:13 -03:00
testdb.h Purge epee::critical_crap and CRITICAL_CRAP 2020-07-02 12:52:13 -03:00
threadpool.cpp unit_tests: add threadpool unit test 2018-08-21 12:59:04 +10:00
unbound.cpp Update 2019 copyright 2019-03-05 22:05:34 +01:00
unit_tests_utils.h Update 2019 copyright 2019-03-05 22:05:34 +01:00
uri.cpp wallet2: reject standalone short payment IDs in monero: URI API 2019-05-01 18:41:39 +00:00
varint.cpp Overhaul binary serialization code (part 1) 2020-07-02 12:52:12 -03:00
vercmp.cpp Update 2019 copyright 2019-03-05 22:05:34 +01:00
wipeable_string.cpp boost::optional -> std::optional 2020-07-02 12:52:12 -03:00