Updated code regarding to string 32 vs string 8.

This commit is contained in:
Jocelyn Fiat
2017-04-14 11:45:38 +02:00
parent a530bbebb4
commit 3b8261ff08
31 changed files with 163 additions and 147 deletions

View File

@@ -101,15 +101,15 @@ feature -- Basic operations
-- also if-range when we add support for range requests
if not l_if_match.same_string ("*") then
l_etags := l_if_match.split (',')
l_failed := not across l_etags as i_etags some a_handler.matching_etag (req, i_etags.item.to_string_32, True) end
l_failed := not across l_etags as i_etags some a_handler.matching_etag (req, i_etags.item, True) end
end
end
if l_failed then
handle_precondition_failed (req, res)
else
if attached req.http_if_unmodified_since as l_if_unmodified_since then
if l_if_unmodified_since.is_string_8 then
create l_date.make_from_string (l_if_unmodified_since.as_string_8)
if l_if_unmodified_since.is_valid_as_string_8 then
create l_date.make_from_string (l_if_unmodified_since.to_string_8)
if not l_date.has_error then
if a_handler.modified_since (req, l_date.date_time) then
handle_precondition_failed (req, res)
@@ -122,14 +122,14 @@ feature -- Basic operations
if attached req.http_if_none_match as l_if_none_match then
l_etags := l_if_none_match.split (',')
l_failed := l_if_none_match.same_string ("*") or
across l_etags as i_etags some a_handler.matching_etag (req, i_etags.item.to_string_32, False) end
across l_etags as i_etags some a_handler.matching_etag (req, i_etags.item, False) end
end
if l_failed then
handle_if_none_match_failed (req, res, a_handler)
else
if attached req.http_if_modified_since as l_if_modified_since then
if l_if_modified_since.is_string_8 then
create l_date.make_from_string (l_if_modified_since.as_string_8)
if l_if_modified_since.is_valid_as_string_8 then
create l_date.make_from_string (l_if_modified_since.to_string_8)
if not l_date.has_error then
if not a_handler.modified_since (req, l_date.date_time) then
handle_not_modified (req, res, a_handler)
@@ -408,7 +408,7 @@ feature -- Error reporting
if req.is_content_type_accepted ({HTTP_MIME_TYPES}.text_html) then
s := "<html lang=%"en%"><head>"
s.append ("<title>")
s.append (html_encoder.encoded_string (req.request_uri.to_string_32))
s.append (html_encoder.general_encoded_string (req.request_uri))
s.append ("Error " + a_status_code.out + " (" + l_msg + ")")
s.append ("</title>%N")
s.append ("[
@@ -434,7 +434,7 @@ feature -- Error reporting
s.append ("</div>")
s.append ("The current location for this resource is <a href=%"" + a_locations.first.string + "%">here</a>")
s.append ("Error " + a_status_code.out + " (" + l_msg + ")</div>")
s.append ("<div id=%"message%">Error " + a_status_code.out + " (" + l_msg + "): <code>" + html_encoder.encoded_string (req.request_uri.to_string_32) + "</code></div>")
s.append ("<div id=%"message%">Error " + a_status_code.out + " (" + l_msg + "): <code>" + html_encoder.general_encoded_string (req.request_uri) + "</code></div>")
s.append ("<div id=%"footer%"></div>")
s.append ("</body>%N")
s.append ("</html>%N")

View File

@@ -158,7 +158,7 @@ feature -- Access
deferred
end
matching_etag (req: WSF_REQUEST; a_etag: READABLE_STRING_32; a_strong: BOOLEAN): BOOLEAN
matching_etag (req: WSF_REQUEST; a_etag: READABLE_STRING_GENERAL; a_strong: BOOLEAN): BOOLEAN
-- Is `a_etag' a match for resource requested in `req'?
-- If `a_strong' then the strong comparison function must be used.
require