From e8d96b35214fb6b39798d4be729916c9138784bc Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Mon, 22 Apr 2013 21:06:29 +0200 Subject: [PATCH] send the file date for download file response. --- .../wsf/src/response/wsf_download_response.e | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/library/server/wsf/src/response/wsf_download_response.e b/library/server/wsf/src/response/wsf_download_response.e index fada53f8..cedc8a2a 100644 --- a/library/server/wsf/src/response/wsf_download_response.e +++ b/library/server/wsf/src/response/wsf_download_response.e @@ -45,6 +45,7 @@ feature {NONE} -- Initialization initialize local h: like header + d: HTTP_DATE do create h.make header := h @@ -52,6 +53,9 @@ feature {NONE} -- Initialization h.put_transfer_encoding_binary h.put_content_length (filesize (file_name)) h.put_content_disposition ("attachment", "filename=%""+ base_name +"%"") + if attached filedate (file_name) as dt then + h.put_last_modified (dt) + end end feature -- Element change @@ -138,6 +142,19 @@ feature {NONE} -- Implementation: file system helper end end + filedate (fn: STRING): detachable DATE_TIME + -- Size of the file `fn'. + local + f: RAW_FILE + d: HTTP_DATE + do + create f.make (fn) + if f.exists then + create d.make_from_timestamp (f.date) + Result := d.date_time + end + end + file_extension (fn: STRING): STRING -- Extension of file `fn'. local