Nick Mathewson
4531fdbbff
Split consensus-request parsing into a separate function
...
This ought to make the control flow a tiny bit more readable.
2017-05-15 17:51:53 -04:00
Nick Mathewson
eb3c8d376d
Prop140, continued: accept "diff/<HASH>" in URLs, per proposal.
2017-05-15 17:42:17 -04:00
Nick Mathewson
afef059795
Merge remote-tracking branch 'public/prop140_aftermath_cfg'
2017-05-15 17:26:47 -04:00
Nick Mathewson
dae1242532
Merge branch 'ahf_bugs_21667_2_squashed'
2017-05-15 17:22:12 -04:00
Alexander Færøy
9e3f304113
Fix dir_handle_get/... test-cases for prop#278 support.
...
See: https://bugs.torproject.org/21667
2017-05-15 17:21:55 -04:00
Alexander Færøy
008194035f
Handle non-compressed requests gracefully.
...
This patch makes us use FALLBACK_COMPRESS_METHOD to try to fetch an
object from the consensus diff manager in case no mutually supported
result was found. This object, if found, is then decompressed using the
spooling system to the client.
See: https://bugs.torproject.org/21667
2017-05-15 17:21:55 -04:00
Alexander Færøy
8d730af0f7
Remove old consensus fetching code from handle_get_current_consensus().
...
This patch removes the calls to spooled_resource_new() when trying to
download the consensus. All calls should now be going through the
consdiff manager.
See: https://bugs.torproject.org/21667
2017-05-15 17:21:55 -04:00
Alexander Færøy
fade313ba3
Fix too wide line from make check-spaces
.
...
See: https://bugs.torproject.org/21667
2017-05-15 17:21:55 -04:00
Alexander Færøy
ae33deb91d
Check for best consensus when no consensusdiff was found.
...
This patch ensures that we use the current consensus in the case where
no consensus diff was found or a consensus diff wasn't requested.
See: https://bugs.torproject.org/21667
2017-05-15 17:21:55 -04:00
Nick Mathewson
7591518d16
Copy valid/fresh-until and signatories values into diffs.
2017-05-15 17:21:55 -04:00
Nick Mathewson
fd1190581d
Store fresh/valid-until and signatories values on all consensus objects.
2017-05-15 17:21:55 -04:00
Nick Mathewson
dcc533fb13
Implement functions to expose valid/fresh-until and voters
...
These still won't do anything till I get the values to be filled in.
Also, I changed the API a little (with corresponding changes in
directory.c) to match things that it's easier to store.
2017-05-15 17:21:55 -04:00
Nick Mathewson
2f06345db3
Move stub accessor functions a level higher, to consdiffmgr
2017-05-15 17:21:55 -04:00
Alexander Færøy
ef2a62b2ff
Fetch the current consensus from the conscache subsystem.
...
This patch changes handle_get_current_consensus() to make it read the
current consensus document from the consensus caching subsystem.
See: https://bugs.torproject.org/21667
2017-05-15 17:21:55 -04:00
Nick Mathewson
71a21256b0
Merge branch 'bug22245_024'
2017-05-15 11:46:55 -04:00
Nick Mathewson
a6514b8a20
Fix a logic error in hibernate.c
...
Closes bug 22245; bugfix on 0.0.9rc1, when bandwidth accounting was
first introduced.
Found by Andrey Karpov and reported at https://www.viva64.com/en/b/0507/
2017-05-15 11:43:18 -04:00
Nick Mathewson
0e348720fc
Fix assertion to actually have a chance of failing
...
This assertion can only fail if we mess up some of our other code,
but let's try to get it right.
Closes 22244.
2017-05-15 11:27:12 -04:00
Nick Mathewson
1ec45bb546
Merge branch 'bug18100_029'
2017-05-15 11:19:44 -04:00
Nick Mathewson
4473271c66
Fix the TRPOXY typo in connection_edge.c
...
Also add a get_options() call so it compiles.
Fixes bug 18100; bugfix on 0.2.6.3-alpha. Patch from "d4fq0fQAgoJ".
2017-05-15 11:16:50 -04:00
Nick Mathewson
d3a39cf8d0
Merge remote-tracking branch 'public/bug20270_029'
2017-05-15 10:45:20 -04:00
Alexander Færøy
363f4b8db5
Add stub functions for querying metadata about the consensus.
2017-05-13 01:05:15 +02:00
Alexander Færøy
64116ab97f
Fix tautological constant out-of-range comparison warnings.
2017-05-12 17:59:29 +02:00
Alexander Færøy
a1e8ef0076
Fix DoubleNL warning from make check-spaces
.
2017-05-12 17:57:11 +02:00
Nick Mathewson
077d3085ec
actually enable background compresion for consensuses
2017-05-12 17:45:55 +02:00
Nick Mathewson
db370bb8a8
Test fix: expect old consensuses to be deleted if not deflate-compressed
2017-05-12 17:45:44 +02:00
Nick Mathewson
30dfb36148
consdiffmgr: Reload latest consensus entries on start.
2017-05-12 17:45:33 +02:00
Nick Mathewson
8100305e71
consdiffmgr: expose cached consensuses
2017-05-12 17:45:24 +02:00
Nick Mathewson
7b0dcf5c4a
Cleanup logic: only retain zlib-compressed consensuses
...
Now that we're making a bunch of these with consdiffmgr, we should
throw out all but one when we get a newer consensus.
2017-05-12 17:45:15 +02:00
Nick Mathewson
151cd121a2
consdiffmgr: compress incoming consensuses in the background
...
Also, compress them in several ways.
This breaks the unit tests; subsequent commits will make them pass
again.
2017-05-12 17:45:07 +02:00
Nick Mathewson
6da31ec484
consdiffmgr: Extract the code for compressing and storing
...
We're going to use this for consensuses too.
2017-05-12 17:44:55 +02:00
Alexander Færøy
7a3efe25d9
Use different preferences for compression methods when streaming.
...
See: https://bugs.torproject.org/21667
2017-05-12 17:18:45 +02:00
Alexander Færøy
141f6e3211
Add client_meth_pref array to define client compression preference.
...
See: https://bugs.torproject.org/21667
2017-05-12 17:18:45 +02:00
Alexander Færøy
59d17ca2bb
Fix indentation when using the ternary operator in handle_get_status_vote().
...
See: https://bugs.torproject.org/21667
2017-05-12 17:18:45 +02:00
Alexander Færøy
ef187bc280
Use compression_method_get_human_name() in connection_dir_client_reached_eof()
...
This patch refactors connection_dir_client_reached_eof() to use
compression_method_get_human_name() to set description1 and
description2 variables.
See: https://bugs.torproject.org/21667
2017-05-12 17:18:45 +02:00
Alexander Færøy
f8218b5ada
Use compression_method_get_by_name() instead of explicit checks.
...
See: https://bugs.torproject.org/21667
2017-05-12 17:18:45 +02:00
Alexander Færøy
cf2f7a1bea
Decide compression method in the various handle_* functions().
...
See: https://bugs.torproject.org/21667
2017-05-12 17:18:45 +02:00
Alexander Færøy
a3a31fa120
Send "Accept-Encoding" to directory servers.
...
See: https://bugs.torproject.org/21667
2017-05-12 17:18:45 +02:00
Alexander Færøy
6305637197
Use tor_compress_supports_method() instead of constants.
...
See: https://bugs.torproject.org/21667
2017-05-12 17:18:45 +02:00
Alexander Færøy
61b6de5906
Handle Zstandard and LZMA in our check for correct guessed compression.
...
See: https://bugs.torproject.org/21667
2017-05-12 17:18:45 +02:00
Alexander Færøy
fbef257c43
Handle x-zstd and x-tor-lzma in parse_http_response().
...
See: https://bugs.torproject.org/21667
2017-05-12 17:18:45 +02:00
Alexander Færøy
ca632144e5
Use dir_compressed(_len) instead of dir_z(_len).
...
This patch renames `dir_z` to `dir_compressed` and `dir_z_len` to
`dir_compressed_len`.
See: https://bugs.torproject.org/21667
2017-05-12 17:18:45 +02:00
Nick Mathewson
4410271446
Merge branch 'ticket21953_029'
2017-05-12 08:40:30 -04:00
Nick Mathewson
503f101d2b
Enable some windows hardening features
...
One (HeapEnableTerminationOnCorruption) is on-by-default since win8;
the other (PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION) supposedly only
affects ATL, which (we think) we don't use. Still, these are good
hygiene. Closes ticket 21953.
2017-05-11 16:39:02 -04:00
Nick Mathewson
9905659573
Merge remote-tracking branch 'arma/cleanup22213'
2017-05-11 09:20:12 -04:00
Nick Mathewson
6390a0c3b6
Merge branch 'ticket21871_031_03_squashed'
2017-05-11 08:33:32 -04:00
David Goulet
ae1d4cfdad
prop224: Change encryption keys descriptor encoding
...
A descriptor only contains the curve25519 public key in the enc-key field so
the private key should not be in that data structure. The service data
structures will have access to the full keypair (#20657 ).
Furthermore, ticket #21871 has highlighted an issue in the proposal 224 about
the encryption key and legacy key being mutually exclusive. This is very wrong
and this commit fixes the code to follow the change to the proposal of that
ticket.
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-05-11 08:33:26 -04:00
Roger Dingledine
8f1ddf0cd2
Remove unused "ROUTER_ADDED_NOTIFY_GENERATOR" internal value
...
We already have a way to return a 400 response code along with a
personalized message response for the uploader.
Resolves ticket 22213.
2017-05-10 20:03:07 -04:00
Roger Dingledine
466e27feae
simplify functions now that they don't use options param
2017-05-10 17:57:35 -04:00
Roger Dingledine
2330a3713d
Merge branch 'maint-0.3.0'
2017-05-10 17:36:34 -04:00
Roger Dingledine
716d48581d
resolve now-unused parameter from #21642 fix
2017-05-10 17:35:36 -04:00