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
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
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
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
Nick Mathewson
8266d193a6
Restore wget behavior when fetching compressed objects
...
We do this by treating the presence of .z as meaning ZLIB_METHOD,
even if Accept-Encoding does not include deflate.
This fixes bug 22206; bug not in any released tor.
2017-05-10 11:09:52 -04:00
Alexander Færøy
60e97953ef
Fix memory leak found in CID #1405876 .
2017-05-05 11:35:12 +02:00
Nick Mathewson
c6fe65fcaf
Grammar fix in a log message
2017-05-04 08:58:06 -04:00
Nick Mathewson
baf489fc08
Fix: our directory.c code expects header constants to end with a :
2017-05-04 08:57:34 -04:00
Nick Mathewson
e1d31f2a2f
Update the consdiff directory code based on #22143 fixes
...
These are mostly just identifier renames, except for one place in
routerparse.c where we switch to using a correct hash.
2017-05-04 08:49:02 -04:00
Nick Mathewson
a8eccb6363
Turn DEFAULT_IF_MODIFIED_SINCE_DELAY into a const
2017-05-04 08:37:41 -04:00
Nick Mathewson
c12d2cb2dc
Request (and try to use) consensus diffs.
2017-05-04 08:37:41 -04:00
Nick Mathewson
912b0641e9
Generate X-Or-Diff-From-Consensus headers correctly.
2017-05-04 08:37:41 -04:00
Nick Mathewson
94ae99067f
Remove excess indentation from previous commit.
...
Review this with 'diff -b' to confirm
2017-05-04 08:37:41 -04:00
Nick Mathewson
afa39cef6c
Extract the consensus-only part of directory_get_from_dirserver
...
Right now it just sets an if-modified-since header, but it's about
to get even bigger.
This patch avoids changing indentation; the next patch will be
whitespace fixes.
2017-05-04 08:37:41 -04:00
Nick Mathewson
57710c1587
New function to add additional headers to a directory request
2017-05-04 08:37:41 -04:00
Nick Mathewson
0418357ffd
Serve consensus diffs on request.
2017-05-04 08:37:41 -04:00
Nick Mathewson
e5f82969ca
Support writing Content-Encoding headers other than deflate
...
Right now this only sends "deflate" or "identity", but there's more
to come.
2017-05-04 08:37:41 -04:00
Nick Mathewson
e051c47e98
Remove old unused indentation from handle_get_current_consensus
...
This commit removes a pair of meaningless braces, and changes
whitespace only.
2017-05-04 08:37:41 -04:00
Nick Mathewson
e0c937f316
Reindent the just-extracted directory response handler functions
2017-05-02 13:11:44 -04:00
Nick Mathewson
db86b9194d
Break connection_dir_client_reached_eof() into smaller functions
...
This was a >630-line function, which doesn't make anybody happy. It
was also mostly composed of a bunch of if-statements that handled
different directory responses differently depending on the original
purpose of the directory connection. The logical refactoring here
is to move the body of each switch statement into a separate handler
function, and to invoke those functions from a separate switch
statement.
This commit leaves whitespace mostly untouched, for ease of review.
I'll reindent in the next commit.
2017-05-02 13:06:25 -04:00
Nick Mathewson
480dab4f2f
Use a cast to try to avoid a tautalogical comparison warning
2017-04-27 11:58:26 -04:00
Nick Mathewson
10a4f9cd07
Merge branch 'parse_accept_encoding'
2017-04-27 11:31:31 -04:00
Nick Mathewson
2903c329aa
Move the "supported compression bitmask" into compress.[ch]
2017-04-27 11:30:51 -04:00
Nick Mathewson
33a2fd065d
Merge branch 'dirreq'
2017-04-27 10:08:32 -04:00
Nick Mathewson
52316f9969
Include UPLOAD_RENDDESC_V2 in PURPOSE_IS_UPLOAD
...
This was only used in one place before, and it's safe to update it.
2017-04-27 09:27:00 -04:00
Nick Mathewson
65ff0f8267
Bitmask out the compression methods that we do not support
2017-04-25 19:07:17 -04:00
Nick Mathewson
fec3050ea9
Tests for parse_accept_encoding
2017-04-25 19:01:05 -04:00
Nick Mathewson
fd48b757d3
Parse recognized entries from the Accept-Encoding header.
2017-04-25 19:01:05 -04:00
Nick Mathewson
d8ff01b2b4
Refactor directory_command_should_use_begindir to use directory_request_t
2017-04-21 15:55:23 -04:00
Nick Mathewson
2a99bf008d
move the definition of directory_command_should_use_begindir
2017-04-21 15:54:50 -04:00
Nick Mathewson
cc677e88d4
Refactor directory_send_command to take a directory_request_t
2017-04-21 15:49:10 -04:00
Nick Mathewson
900d36e3b1
Rename, revise, and document directory_request_is_dir_specified.
2017-04-21 15:42:09 -04:00
Nick Mathewson
d7fab36037
Make directory_request_set_guard_state static.
2017-04-21 15:42:09 -04:00
Nick Mathewson
81045e19eb
Document the new directory_request_t API and add some assertions
2017-04-21 15:42:03 -04:00
Nick Mathewson
3327e675fd
Remove old directory_initiate_command_*() functions.
2017-04-21 15:14:52 -04:00
Nick Mathewson
4ae65bb5d3
Refactor directory_get_from_dirserver to use request API.
2017-04-21 14:40:48 -04:00
Nick Mathewson
eee733be33
Refactor directory_post_to_dirservers to use requests
2017-04-21 14:35:42 -04:00
Nick Mathewson
c300fd7e65
Have directory_get_from_all_authorities use requests.
2017-04-21 14:31:35 -04:00
Nick Mathewson
a55bd00b0f
continue refactoring directory API: remove initiate_command_rend
...
This commit mainly moves the responsibility for directory request
construction one level higher. It also allows a directory request
to contain a pointer to a routerstatus, which will get turned into
the correct contact information at the last minute.
2017-04-21 14:18:06 -04:00
Alexander Færøy
b8c9f229d7
Rename write_to_buf_zlib()
to write_to_buf_compress()
.
...
See https://bugs.torproject.org/21663
2017-04-18 01:23:39 +02:00