commit 948158df33c4cbfa03f2aa4990097b4e9de664a1 Merge: 8e8abbb 527c073 Author: Nick Mathewson nickm@torproject.org Date: Fri Jul 7 13:28:22 2017 -0400
Merge branch 'bug17750_029_squashed'
changes/bug17750 | 4 ++ src/or/directory.c | 54 +++++++++++++++----- src/or/directory.h | 22 ++++++-- src/or/or.h | 4 +- src/test/test_dir.c | 142 ++++++++++++++++++++++++++++++++++++++++++++++------ 5 files changed, 195 insertions(+), 31 deletions(-)
diff --cc src/or/directory.c index 69479ad,fc21078..13daea3 --- a/src/or/directory.c +++ b/src/or/directory.c @@@ -13,12 -10,8 +13,11 @@@ #include "config.h" #include "connection.h" #include "connection_edge.h" +#include "conscache.h" +#include "consdiff.h" +#include "consdiffmgr.h" #include "control.h" -#define DIRECTORY_PRIVATE +#include "compat.h" - #define DIRECTORY_PRIVATE #include "directory.h" #include "dirserv.h" #include "dirvote.h" diff --cc src/or/directory.h index 14d5ae9,0b54943..3e574cc --- a/src/or/directory.h +++ b/src/or/directory.h @@@ -151,25 -143,14 +158,24 @@@ download_status_mark_impossible(downloa
int download_status_get_n_failures(const download_status_t *dls); int download_status_get_n_attempts(const download_status_t *dls); - time_t download_status_get_next_attempt_at(const download_status_t *dls);
-/* Yes, these two functions are confusingly similar. - * Let's sort that out in #20077. */ -int purpose_needs_anonymity(uint8_t dir_purpose, uint8_t router_purpose); -int is_sensitive_dir_purpose(uint8_t dir_purpose); +int purpose_needs_anonymity(uint8_t dir_purpose, uint8_t router_purpose, + const char *resource); + +#ifdef DIRECTORY_PRIVATE + +struct get_handler_args_t; +STATIC int handle_get_hs_descriptor_v3(dir_connection_t *conn, + const struct get_handler_args_t *args); +STATIC int directory_handle_command(dir_connection_t *conn); +STATIC char *accept_encoding_header(void); +STATIC int allowed_anonymous_connection_compression_method(compress_method_t); +STATIC void warn_disallowed_anonymous_compression_method(compress_method_t); + +#endif
#ifdef TOR_UNIT_TESTS -/* Used only by directory.c and test_dir.c */ +/* Used only by test_dir.c */
STATIC int parse_http_url(const char *headers, char **url); STATIC dirinfo_type_t dir_fetch_type(int dir_purpose, int router_purpose, @@@ -192,19 -167,25 +198,29 @@@ STATIC int handle_post_hs_descriptor(co STATIC char* authdir_type_to_string(dirinfo_type_t auth); STATIC const char * dir_conn_purpose_to_string(int purpose); STATIC int should_use_directory_guards(const or_options_t *options); -STATIC zlib_compression_level_t choose_compression_level(ssize_t n_bytes); +STATIC compression_level_t choose_compression_level(ssize_t n_bytes); - STATIC const smartlist_t *find_dl_schedule(download_status_t *dls, + STATIC const smartlist_t *find_dl_schedule(const download_status_t *dls, const or_options_t *options); STATIC void find_dl_min_and_max_delay(download_status_t *dls, const or_options_t *options, int *min, int *max); STATIC int next_random_exponential_delay(int delay, int max_delay);
+STATIC int parse_hs_version_from_post(const char *url, const char *prefix, + const char **end_pos); + +STATIC unsigned parse_accept_encoding_header(const char *h); #endif
+ #if defined(TOR_UNIT_TESTS) || defined(DIRECTORY_PRIVATE) + /* Used only by directory.c and test_dir.c */ + + /* no more than quadruple the previous delay (multiplier + 1) */ + #define DIR_DEFAULT_RANDOM_MULTIPLIER (3) + /* no more than triple the previous delay */ + #define DIR_TEST_NET_RANDOM_MULTIPLIER (2) + + #endif + #endif
tor-commits@lists.torproject.org