diff options
-rw-r--r-- | changes/bug30001 | 4 | ||||
-rw-r--r-- | src/feature/dircache/dircache.c | 2 | ||||
-rw-r--r-- | src/test/test_dir_handle_get.c | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/changes/bug30001 b/changes/bug30001 new file mode 100644 index 0000000000..e3304701e7 --- /dev/null +++ b/changes/bug30001 @@ -0,0 +1,4 @@ + o Minor features (testing): + - Use the approx_time() function when setting the "Expires" header + in directory replies, to make them more testable. Needed for + ticket 30001. diff --git a/src/feature/dircache/dircache.c b/src/feature/dircache/dircache.c index caa085dd63..1123d034e0 100644 --- a/src/feature/dircache/dircache.c +++ b/src/feature/dircache/dircache.c @@ -124,7 +124,7 @@ write_http_response_header_impl(dir_connection_t *conn, ssize_t length, long cache_lifetime) { char date[RFC1123_TIME_LEN+1]; - time_t now = time(NULL); + time_t now = approx_time(); buf_t *buf = buf_new_with_capacity(1024); tor_assert(conn); diff --git a/src/test/test_dir_handle_get.c b/src/test/test_dir_handle_get.c index c3a17e7309..e57bd02584 100644 --- a/src/test/test_dir_handle_get.c +++ b/src/test/test_dir_handle_get.c @@ -2526,7 +2526,7 @@ test_dir_handle_get_status_vote_next_bandwidth(void* data) /* Check cache lifetime */ char expbuf[RFC1123_TIME_LEN+1]; - time_t now = time(NULL); + time_t now = approx_time(); /* BANDWIDTH_CACHE_LIFETIME is defined in dircache.c. */ format_rfc1123_time(expbuf, (time_t)(now + 30*60)); char *expires = NULL; |