Commit Graph

51 Commits

Author SHA1 Message Date
Nick Mathewson 302653977d Bump dependencies with "cargo upgrade" 2021-03-06 08:55:13 -05:00
Nick Mathewson 29311b72f6 Remove an unwrap in dirclient. 2021-03-04 14:20:54 -05:00
Nick Mathewson 57682f5ec1 Move content-encoding handling to decompress
This way tor-dirclient doesn't need to link to the compression crates.
2021-03-04 13:59:12 -05:00
Kushal Das bfb652e73d
Moves decompress related code into tor-decompress crate
The related data structures are marked as public in the
tor-decompress crate so that tor-dirclient can access them.
2021-03-04 22:01:42 +05:30
Nick Mathewson 8c31418500 Port to work with tokio or async-std.
This is fairly ugly and I think I'll need to mess around with the
feature configuration a while until we get something that's pleasant
to develop with.  This still seems like a good idea, though, since
we _will_ need to be executor-agnostic in the end, or we'll have no
way to handle wasm or embedded environments.

Later down the road, we'll probably want to use futures::Executor or
futures::Spawn more than having global entry points in
tor_rtcompat.  That would probably make our feature story simpler.

Tokio is the default now, since tokio seems to be more heavily used
for performance-critical stuff.

This patch breaks tests; the next one will fix them, albeit
questionably.
2021-03-02 11:55:09 -05:00
Nick Mathewson 568567c5e0 Update to latest futures, once_cell 2021-02-23 15:54:29 -05:00
Nick Mathewson ab9d4a2229 Update some dependencies. 2021-02-19 09:39:23 -05:00
Nick Mathewson e1c3f550d8 upgrade a few dependencies 2021-02-10 18:23:38 -05:00
Nick Mathewson 243880473f bump serde and log 2021-02-01 16:39:07 -05:00
Nick Mathewson 50da094373 Merge remote-tracking branch 'origin/mr/12' into main 2021-01-27 07:39:36 -05:00
Nick Mathewson a36fadefae A few more tests in request.rs 2021-01-26 12:45:09 -05:00
hiro d363ae0f73 Add an error type check in test_get_decompressor_err in tor-dirclient 2021-01-25 18:59:04 +01:00
hiro 5cd977c752 Add a test for consensus requests in tor-dirclient. 2021-01-22 21:46:18 +01:00
Nick Mathewson 789640ed53 Fix a test in tor-dirclient 2021-01-21 12:10:17 -05:00
Nick Mathewson 34bf6f0658 Merge remote-tracking branch 'origin/mr/10' into main 2021-01-21 11:59:14 -05:00
Kushal Das e95c88f984
Reformats the code and removes extra return
Based rust nightly cargo fmt.
2021-01-21 22:14:21 +05:30
Kushal Das 63a1ad9655
Adds decompress_in_parts_zstd test
Now we are testing decompression of the input via calling
the process method 3 times. We get the final decompressed output
only after the third call.
2021-01-21 22:04:54 +05:30
Kushal Das d8184e7610
Adds decompression test for zstd
Tests the decompression of the whole input in one go.
2021-01-21 21:52:29 +05:30
Kushal Das 55f5d2aa6a
Adds zstd decompression implementation for dirclient
Adds dependency to zstd crate.
2021-01-21 21:03:45 +05:30
Nick Mathewson 8e2cc78a45 Add a test for encoding authcert requests 2021-01-21 09:42:58 -05:00
Nick Mathewson b1770603bb Add a little testing in tor-dirclient 2021-01-21 09:22:31 -05:00
Nick Mathewson 3f455e6f30 require latest futures crate 2021-01-15 17:05:05 -05:00
Nick Mathewson fa57fb4995 Upgrade a few more dependencies. 2021-01-13 08:17:14 -05:00
Nick Mathewson 7e843de2c8 Upgrade a few dependencies. 2021-01-13 08:14:28 -05:00
Nick Mathewson f01d641ec8 cargo upgrade. 2020-12-30 15:59:33 -05:00
Nick Mathewson 87cb44a4e5 Basic test for tor-dirclient::util 2020-12-21 11:57:10 -05:00
Nick Mathewson ccd6cbf627 upgrade to latest anyhow 2020-12-21 10:21:24 -05:00
Nick Mathewson 5057cbc12f Cargo-upgrade a few dependencies 2020-12-21 10:18:41 -05:00
Nick Mathewson 0222477cf8 Run cargo fmt 2020-12-17 16:04:37 -05:00
Nick Mathewson 8b5630e6b1 Merge branch 'mr_1_squashed' into main 2020-12-17 16:04:27 -05:00
owen66 18915e84d4 Fixup! issue #34: adding support for xz2 2020-12-10 20:17:04 +00:00
George Kadianakis cc91b3ce2b Use anyhow crate to add extra context for various dirclient errors. 2020-12-10 17:36:18 +02:00
Nick Mathewson 90fc798646 Fix some rustdoc warnings. 2020-12-09 09:46:39 -05:00
Nick Mathewson 17c84fd59e upgrade to require latest anyhow. 2020-12-08 17:26:19 -05:00
Nick Mathewson 8d6087426e De-parameterize ChanMgr and everything that wraps it.
This makes a whole lot of our code simpler, and makes it so that
CircMgr and DirMgr no longer need to have anything parameterized
over transports, either.

Instead of boxing Transport inside of ChanMgr, I've made a new
Connection trait that goes from a ChanTarget* straight to a Channel.
This lets us avoid having to box the intermediate TLS object.

[*] Actually, a copy of the information from a ChanTarget. Ick, but
I had to make a copy to avoid parameterizing
Connecter::build_channel.
2020-12-08 16:29:18 -05:00
Nick Mathewson 5fc116ad7a Tolerate attempt to write a non-UTF-8 HTTP header.
previously, we would panic.
2020-12-07 21:22:12 -05:00
Nick Mathewson a52585d9d6 Mark some XXXX issues as XXXX-A1. 2020-12-07 16:07:59 -05:00
Nick Mathewson 58869194f6 tor-dirclient: tweak so that its future is Send. 2020-12-04 13:16:52 -05:00
Nick Mathewson 4aa61322be Fix a couple of clippy warnings in tor-dirclient. 2020-12-02 13:43:45 -05:00
Nick Mathewson a72437a1c7 Abandon directory circuits on most kinds of directory failure.
(There are more cases that this _doesn't_ handle, but it's a start
for now.)
2020-12-02 09:46:35 -05:00
owen66 c9a202c7ac issue #34: adding support for xz2 2020-12-02 01:20:24 +00:00
Nick Mathewson f5f2a648a3 tor-dirclient: add timeouts
This adds two timeouts in total: one for sending begin, and getting
headers, and one for getting the rest of the data.

These timeouts are way too long right now, but at least the code is
there.
2020-12-01 08:56:25 -05:00
Nick Mathewson 483fb1f7c4 Implement a maximum length for directory responses 2020-11-25 11:45:00 -05:00
Nick Mathewson 679104a516 Extract another function in tor-dirclient 2020-11-25 11:23:51 -05:00
Nick Mathewson 995f136ec1 Better error types for tor-dirclient 2020-11-25 11:11:40 -05:00
Nick Mathewson aee76da70f tor-dirclient: add support for partial documents.
Some requests are still useful when we get only a partial response
-- like those where we're asking for a bunch of documents at once.
For those, we should return any nonempty partial result.
2020-11-25 10:53:01 -05:00
Nick Mathewson 8a9654ee90 missing docs in tor-dirclient 2020-11-23 08:51:18 -05:00
Nick Mathewson 5d32d69011 Require (and write) docs in tor-dirclient. 2020-11-20 19:11:28 -05:00
Nick Mathewson 9f4230fb1b Initial pass on directory-manager code.
This code can now bootstrap from the network, cache the results, and
reload from cache.

There's lots more work to do here, including a big pile of tidying
and refactoring and testing and documentation.
2020-11-19 19:11:10 -05:00
Nick Mathewson 02bac5f04e Add support for using fallback directories in path construction
This is mainly a refactoring commit, with a little new code.

It also adds #[derive(Copy,Clone)] for a few types.
2020-11-19 10:06:48 -05:00