From 7c6fe5a04a5de941cb27082d5b2aebd77417c6cf Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Mon, 29 Oct 2018 13:15:14 +0100 Subject: [PATCH] Added `HTTP_COOKIE.set_expiration_from_max_age`, to add the "Expiration:" based on the max-age value. --- .../network/protocol/http/src/http_cookie.e | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/library/network/protocol/http/src/http_cookie.e b/library/network/protocol/http/src/http_cookie.e index bd53d5cb..72527755 100644 --- a/library/network/protocol/http/src/http_cookie.e +++ b/library/network/protocol/http/src/http_cookie.e @@ -197,6 +197,24 @@ feature -- Change Element expiration_set: attached expiration as l_expiration and then l_expiration.same_string (date_to_rfc1123_http_date_format (a_date)) end + set_expiration_from_max_age + -- Set `expiration` value from `max_age`. + local + dt: DATE_TIME + do + if max_age < 0 then + unset_expiration + else + if max_age = 0 then + create dt.make_from_epoch (0) + else + create dt.make_now_utc + dt.second_add (max_age) + end + set_expiration_date (dt) + end + end + set_path (a_path: READABLE_STRING_8) -- Set `path' to `a_path'. do