HTTP_HEADER: - added put_last_modified

- added RFC1123 http date format helper
             - added put_cookie_with_expiration_date as DATE_TIME
REQUEST: added `execution_variable' to provide a way to keep object attached to the request
         and indexed by a string. A typical usage is a SESSION object
This commit is contained in:
Jocelyn Fiat
2012-01-06 18:27:52 +01:00
parent 83346c92a7
commit 20281bc922
5 changed files with 84 additions and 77 deletions

View File

@@ -282,7 +282,13 @@ feature -- Date
put_utc_date (dt: DATE_TIME)
-- Put UTC date time `dt' with "Date" header
do
put_date (dt.formatted_out ("ddd,[0]dd mmm yyyy [0]hh:[0]mi:[0]ss.ff2") + " GMT")
put_date (date_to_rfc1123_http_date_format (dt))
end
put_last_modified (dt: DATE_TIME)
-- Put UTC date time `dt' with "Date" header
do
put_header_key_value ({HTTP_HEADER_NAMES}.header_last_modified, date_to_rfc1123_http_date_format (dt))
end
feature -- Others
@@ -352,6 +358,15 @@ feature -- Cookie
add_header (s)
end
put_cookie_with_expiration_date (key, value: READABLE_STRING_8; expiration: DATE_TIME; path, domain, secure: detachable READABLE_STRING_8)
-- Set a cookie on the client's machine
-- with key 'key' and value 'value'.
require
make_sense: (key /= Void and value /= Void) and then (not key.is_empty and not value.is_empty)
do
put_cookie (key, value, date_to_rfc1123_http_date_format (expiration), path, domain, secure)
end
feature -- Status report
header_named_value (a_name: READABLE_STRING_8): detachable STRING_8
@@ -498,6 +513,12 @@ feature {NONE} -- Implementation
h.append_character ('%N')
end
date_to_rfc1123_http_date_format (dt: DATE_TIME): READABLE_STRING_8
-- String representation of `dt' using the RFC 1123
do
Result := dt.formatted_out ("ddd,[0]dd mmm yyyy [0]hh:[0]mi:[0]ss.ff2") + " GMT"
end
feature {NONE} -- Constants
str_binary: STRING = "binary"
@@ -507,7 +528,7 @@ feature {NONE} -- Constants
semi_colon_space: STRING = "; "
note
copyright: "2011-2011, Eiffel Software and others"
copyright: "2011-2012, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software