From 6c0b53af59b417d34e39cf9261bc4dfb4e3eac64 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Tue, 28 Jan 2020 15:32:36 -0500 Subject: [PATCH] Add regression test --- actix-http/src/config.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/actix-http/src/config.rs b/actix-http/src/config.rs index f2bd8ecba..e41628424 100644 --- a/actix-http/src/config.rs +++ b/actix-http/src/config.rs @@ -282,6 +282,19 @@ impl DateService { mod tests { use super::*; + + // Test modifying the date from within the closure + // passed to `set_date` + #[test] + fn test_evil_date() { + let service = DateService::new(); + // Make sure that `check_date` doesn't try to spawn a task + service.0.update(); + service.set_date(|_| { + service.0.reset() + }); + } + #[test] fn test_date_len() { assert_eq!(DATE_VALUE_LENGTH, "Sun, 06 Nov 1994 08:49:37 GMT".len());