Web form:

- Improvement about web form manipulation (remove a field, set a text value to input fields by name, ...)
 - Improved web form html generation, especially for select and type checkbox
 - Updated the date input field interface with a new set_date_value .

File response:
 - "application/force-download" is not a standard MIME content type, so use "application_octet_stream" instead as default.

Standalone connector:
 - Added expected creation procedure for the service launcher.
 - Added new "secure_port" configuration variable, for SSL standalone service.
   This way, if `is_secure` is True, the server will use `secure_port` (overrides `port` value).

Date:
 - Improved support for RFC 3339 (a profile of ISO 8601)

Removed obsolete and warnings:
 - removed usage of FILE_NAME
 - updated code to avoid implicit conversion from STRING_32 to STRING_8
 - avoid uneed conversion to STRING_8 (when possible)
This commit is contained in:
2020-10-02 15:02:06 +02:00
parent 75380a27fe
commit 30a5e087ae
80 changed files with 444 additions and 260 deletions

View File

@@ -1,6 +1,4 @@
note
description: "Summary description for {HTTP_CLIENT_CONSTANTS}."
author: ""
date: "$Date$"
revision: "$Revision$"
@@ -10,23 +8,19 @@ class
feature -- Auth type
auth_type_id (a_auth_type_string: READABLE_STRING_8): INTEGER
local
s: STRING_8
do
create s.make_from_string (a_auth_type_string)
s.to_lower
if s.same_string_general ("basic") then
if a_auth_type_string.is_case_insensitive_equal ("basic") then
Result := Auth_type_basic
elseif s.same_string_general ("digest") then
elseif a_auth_type_string.is_case_insensitive_equal ("digest") then
Result := Auth_type_digest
elseif s.same_string_general ("any") then
elseif a_auth_type_string.is_case_insensitive_equal ("any") then
Result := Auth_type_any
elseif s.same_string_general ("anysafe") then
elseif a_auth_type_string.is_case_insensitive_equal ("anysafe") then
Result := Auth_type_anysafe
elseif s.same_string_general ("none") then
elseif a_auth_type_string.is_case_insensitive_equal ("none") then
Result := Auth_type_none
end
end
end
Auth_type_none: INTEGER = 0
Auth_type_basic: INTEGER = 1
@@ -35,7 +29,7 @@ feature -- Auth type
Auth_type_anysafe: INTEGER = 4
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -108,7 +108,7 @@ feature {HTTP_CLIENT_SESSION} -- Execution
feature -- Authentication
auth_type: STRING
auth_type: READABLE_STRING_8
-- Set the authentication type for the request.
-- Types: "basic", "digest", "any"
do

View File

@@ -18,7 +18,7 @@ feature {NONE} -- Initialization
do
--| Default values
status := 200
url := a_url
create url.make_from_string (a_url)
create {STRING_8} raw_header.make_empty
end
@@ -46,7 +46,7 @@ feature {HTTP_CLIENT_REQUEST} -- Status setting
feature -- Access
url: STRING_8
url: IMMUTABLE_STRING_8
-- URL associated with Current response
status: INTEGER assign set_status
@@ -163,7 +163,7 @@ feature -- Access
end
c := h.index_of (':', l_start)
if c > 0 then
k := h.substring (l_start, c - 1)
k := h.substring (l_start, c - 1).to_string_8
k.right_adjust
c := c + 1
from until c <= n and not h[c].is_space loop
@@ -290,7 +290,7 @@ feature -- Change
l_has_location: BOOLEAN
l_content_length: INTEGER
s: READABLE_STRING_8
l_status_line,h: detachable STRING_8
l_status_line,h: detachable READABLE_STRING_8
do
from
i := 1
@@ -363,6 +363,7 @@ feature -- Change
-- Set http header `raw_header' to `h'
local
i: INTEGER
rs: READABLE_STRING_8
s: STRING_8
do
raw_header := h
@@ -372,8 +373,9 @@ feature -- Change
--| Set status line, right away.
i := h.index_of ('%N', 1)
if i > 0 then
s := h.substring (1, i - 1)
if s.starts_with ("HTTP/") then
rs := h.substring (1, i - 1)
if rs.starts_with ("HTTP/") then
s := rs.to_string_8
s.right_adjust
set_status_line (s)
end
@@ -405,7 +407,7 @@ feature {NONE} -- Implementation
-- Internal cached value for the headers
;note
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -63,10 +63,11 @@ feature -- Access
do
if is_absolute_url (a_path) then
-- Is Absolute url
Result := a_path
Result := a_path.to_string_8
else
Result := base_url + a_path
end
create Result.make_from_string (base_url)
Result.append (a_path)
end
if ctx /= Void then
ctx.append_query_parameters_to_url (Result)
end
@@ -287,7 +288,7 @@ feature -- Access
feature -- Authentication
auth_type: STRING
auth_type: READABLE_STRING_8
-- Set the authentication type for the request.
-- Types: "basic", "digest", "any"

View File

@@ -31,7 +31,7 @@ feature -- Status report
is_available: BOOLEAN
-- Is interface usable?
do
Result := curl.is_dynamic_library_exists
Result := curl.is_api_available
end
feature -- Custom
@@ -139,12 +139,17 @@ feature {NONE} -- Implementation
l_data := ctx.upload_data
if l_data /= Void and a_method.is_case_insensitive_equal_general ("PUT") then
--| Quick and dirty hack using real file, for PUT uploaded data
--| FIXME [2012-05-23]: better use libcurl for that purpose
--| FIXME [2012-05-23]: find better solution with libcurl for that need
if ctx.has_upload_filename then
check put_conflict_file_and_data: False end
end
create f.make_open_write (create {FILE_NAME}.make_temporary_name)
if attached {EXECUTION_ENVIRONMENT}.temporary_directory_path as tmp then
create f.make_open_temporary_with_prefix (tmp.extended ("tmp-libcurl-").name)
else
create f.make_open_temporary_with_prefix ("tmp-libcurl-")
end
f.put_string (l_data)
f.close
check ctx /= Void then
@@ -176,7 +181,7 @@ feature {LIBCURL_HTTP_CLIENT_REQUEST} -- Curl implementation
;note
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -125,7 +125,7 @@ feature -- Access
if attached l_uri.host as h then
l_host := h
else
create l_url.make (url)
create l_url.make (url.to_string_8)
l_host := l_url.host
end
@@ -887,7 +887,7 @@ feature {NONE} -- Helpers
invariant
note
copyright: "2011-2018, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -112,7 +112,6 @@ feature -- Test routines
-- New test routine
local
sess: like new_session
h: STRING_8
config: HTTP_CLIENT_SECURE_CONFIG
do
--| Set secure configuration
@@ -160,7 +159,6 @@ feature -- Test routines
test_abs_url
local
sess: like new_session
h: STRING_8
l_url: STRING
do
sess := new_session ("https://www.eiffel.org")

View File

@@ -61,7 +61,7 @@ feature -- Requestbin
j := l_content.index_of ('}', i + 1)
end
if j > 0 then
Result := l_content.substring (i + 7, j - 1)
Result := l_content.substring (i + 7, j - 1).to_string_8
Result.adjust
if Result.starts_with ("%"") then
Result.remove_head (1)

View File

@@ -168,7 +168,7 @@ feature {NONE} -- Implementation
l_target_type: READABLE_STRING_8
l_range: HTTP_ACCEPT_LANGUAGE
l_param_matches: INTEGER
l_element: detachable READABLE_STRING_8
l_element: detachable READABLE_STRING_GENERAL
l_fitness: INTEGER
do
l_best_fitness := -1

View File

@@ -190,7 +190,7 @@ feature {NONE} -- Implementation
target: HTTP_MEDIA_TYPE
range: HTTP_MEDIA_TYPE
param_matches: INTEGER
element: detachable READABLE_STRING_8
element: detachable READABLE_STRING_GENERAL
l_fitness: INTEGER
do
best_fitness := -1

View File

@@ -172,7 +172,7 @@ feature -- Element change
feature -- Parameters: Access
parameter (a_key: READABLE_STRING_8): detachable READABLE_STRING_8
parameter (a_key: READABLE_STRING_GENERAL): detachable READABLE_STRING_8
-- Parameter associated with `a_key', if present
-- otherwise default value of type `STRING'
do
@@ -186,7 +186,7 @@ feature -- Parameters: Access
feature -- Parameters: Status report
has_parameter (a_key: READABLE_STRING_8): BOOLEAN
has_parameter (a_key: READABLE_STRING_GENERAL): BOOLEAN
-- Is there an parameter in the parameters table with key `a_key'?
do
if attached parameters as l_params then
@@ -196,7 +196,7 @@ feature -- Parameters: Status report
feature -- Parameters: Change
put_parameter (a_value: READABLE_STRING_8; a_key: READABLE_STRING_8)
put_parameter (a_value: READABLE_STRING_8; a_key: READABLE_STRING_GENERAL)
-- Insert `a_value' with `a_key' if there is no other item
-- associated with the same key. If present, replace
-- the old value with `a_value'

View File

@@ -35,7 +35,7 @@ feature -- Helpers
across
l_parameters as ic
loop
Result.append ("'" + ic.key + "':'" + ic.item + "',");
Result.append ("'" + {UTF_CONVERTER}.utf_32_string_to_utf_8_string_8 (ic.key) + "':'" + ic.item + "',");
end
end
Result.append ("})")

View File

@@ -38,7 +38,7 @@ feature -- Helpers
across
l_params as ic
loop
Result.append ("'" + ic.key + "':'"+ ic.item + "',");
Result.append ("'" + {UTF_CONVERTER}.utf_32_string_to_utf_8_string_8 (ic.key) + "':'"+ ic.item + "',");
end
end
Result.append ("})")

View File

@@ -41,7 +41,7 @@ feature -- Helper
across
l_params as ic
loop
Result.append ("'" + ic.key + "':'" + ic.item + "',");
Result.append ("'" + {UTF_CONVERTER}.utf_32_string_to_utf_8_string_8 (ic.key) + "':'" + ic.item + "',");
end
end
Result.append ("})")

View File

@@ -47,21 +47,21 @@ feature {NONE} -- Initialization
feature -- Access
name: STRING_8
name: READABLE_STRING_8
-- name of the cookie.
value: STRING_8
value: READABLE_STRING_8
-- value of the cookie.
expiration: detachable STRING_8
expiration: detachable READABLE_STRING_8
-- Value of the Expires attribute.
path: detachable STRING_8
path: detachable READABLE_STRING_8
-- Value of the Path attribute.
-- Path to which the cookie applies.
--| The path "/", specify a cookie that apply to all URLs in your site.
domain: detachable STRING_8
domain: detachable READABLE_STRING_8
-- Value of the Domain attribute.
-- Domain to which the cookies apply.

View File

@@ -42,6 +42,7 @@ create
make_now_utc,
make_from_timestamp,
make_from_string,
make_from_rfc3339_string,
make_from_date_time
feature {NONE} -- Initialization
@@ -65,6 +66,18 @@ feature {NONE} -- Initialization
date_time := dt
elseif attached ansi_c_string_to_date_time (s) as dt then
date_time := dt
elseif attached rfc3339_string_to_date_time (s) as dt then
date_time := dt
else
has_error := True
date_time := epoch
end
end
make_from_rfc3339_string (s: READABLE_STRING_GENERAL)
do
if attached rfc3339_string_to_date_time (s) as dt then
date_time := dt
else
has_error := True
date_time := epoch
@@ -153,10 +166,13 @@ feature -- Conversion to string
append_date_time_to_rfc850_string (date_time, Result)
end
iso8601_string,
rfc3339_string: STRING
-- String representation following RFC 3339.
-- format: [yyyy-mm-ddThh:mi:ssZ]
-- https://www.rfc-editor.org/rfc/rfc3339.txt
-- note: RFC 3339 is a profile of ISO 8601.
-- https://en.wikipedia.org/wiki/ISO_8601
do
create Result.make (25)
append_date_time_to_rfc3339_string (date_time, Result)
@@ -241,6 +257,7 @@ feature -- Conversion into string
s.append (" GMT") -- SPace + GMT
end
append_date_time_to_iso8601_string,
append_date_time_to_rfc3339_string (dt: DATE_TIME; s: STRING_GENERAL)
-- Append `dt' as [yyyy-mm-ddThh:mi:ssZ] format to `s'.
do
@@ -316,7 +333,7 @@ feature -- Helper routines.
create fd.make (2, 2)
fd.show_trailing_zeros
fd.show_zero
r64 := t.fine_second
r64 := t.second + t.fractional_second * 0.01
f := fd.formatted (r64)
if f.ends_with_general (".00") then
append_2_digits_integer_to (t.second, s) -- ss
@@ -670,7 +687,7 @@ feature {NONE} -- Implementation
end
ansi_c_string_to_date_time (s: READABLE_STRING_GENERAL): detachable DATE_TIME
-- String representation of `dt' using the RFC 1123
-- ANSI C date from `s` string representation using the RFC 1123
-- asctime-date = wkday SP date3 SP time SP 4DIGIT
-- date3 = month SP ( 2DIGIT | ( SP 1DIGIT ))
-- ; month day (e.g., Jun 2)
@@ -919,10 +936,114 @@ feature {NONE} -- Implementation
end
end
rfc3339_string_to_date_time (s: READABLE_STRING_GENERAL): detachable DATE_TIME
--| 1985-04-12T23:20:50.52Z
--| 1996-12-19T16:39:57-08:00 = 1996-12-20T00:39:57Z
--|
note
EIS: "name=RFC3339", "protocol=URI", "src=https://tools.ietf.org/html/rfc3339"
local
y,mo,d,h,mi,sec, frac_sec: INTEGER
l_off_h, l_off_mi: INTEGER
tmp: READABLE_STRING_GENERAL
i, j, k, pos: INTEGER
err: BOOLEAN
do
if s /= Void then
pos := s.index_of ('T', 1)
if pos > 0 then
i := 1
j := s.index_of ('-', i)
if j > i and j < pos then
y := s.substring (i, j - 1).to_integer
i := j + 1
j := s.index_of ('-', i)
if j > i and j < pos then
mo := s.substring (i, j - 1).to_integer
d := s.substring (j + 1, pos - 1).to_integer
else
err := True
end
else
err := True
end
i := pos + 1
j := s.index_of (':', i)
if j > i then
h := s.substring (i, j - 1).to_integer
i := j + 1
j := s.index_of (':', i)
if j > i then
mi := s.substring (i, j - 1).to_integer
from
k := j + 1
until
k > s.count
or s[k].is_alpha
or s[k] = '+'
or s[k] = '-'
loop
k := k + 1
end
tmp := s.substring (j + 1, k - 1)
j := tmp.index_of ('.', 1)
if j > 0 then
sec := tmp.head (j - 1).to_integer
frac_sec := tmp.substring (j + 1, tmp.count).to_integer
else
sec := tmp.to_integer
end
if k <= s.count then
if s[k] = '+' then
tmp := s.substring (k + 1, s.count)
j := tmp.index_of (':', 1)
if j > 0 then
l_off_h := - tmp.head (j - 1).to_integer
l_off_mi := - tmp.substring (j + 1, tmp.count).to_integer
else
l_off_h := - tmp.to_integer
end
elseif s[k] = '-' then
tmp := s.substring (k + 1, s.count)
j := tmp.index_of (':', 1)
if j > 0 then
l_off_h := + tmp.head (j - 1).to_integer
l_off_mi := + tmp.substring (j + 1, tmp.count).to_integer
else
l_off_h := + tmp.to_integer
end
elseif s[k] = 'Z' then
-- Done
else
end
end
else
err := True
end
else
err := True
end
if not err then
create Result.make (y, mo, d, h, mi, sec)
if frac_sec /= 0 then
Result.set_fractionals (frac_sec)
Result.time.set_fractionals (frac_sec)
end
if l_off_h /= 0 then
Result.hour_add (l_off_h)
end
if l_off_mi /= 0 then
Result.minute_add (l_off_mi)
end
end
end
end
end
invariant
note
copyright: "2011-2019, Jocelyn Fiat, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -40,9 +40,9 @@ feature -- Query
format_id (a_id: READABLE_STRING_GENERAL): INTEGER
local
s: STRING
s: READABLE_STRING_GENERAL
do
s := a_id.as_string_8.as_lower
s := a_id.as_lower
if s.same_string (json_name) then
Result := json
elseif s.same_string (xml_name) then
@@ -74,7 +74,7 @@ feature -- Query
end
note
copyright: "2011-2011, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -175,7 +175,7 @@ feature -- Header: adding
across
lines as c
loop
line := c.item
line := c.item.to_string_8
if not line.is_empty then
if line [line.count] = '%R' then
line.remove_tail (1)
@@ -223,7 +223,7 @@ feature -- Header: merging
across
lines as c
loop
line := c.item
line := c.item.to_string_8
if not line.is_empty then
if line [line.count] = '%R' then
line.remove_tail (1)
@@ -416,7 +416,7 @@ feature {NONE} -- Implementation: Header queries
end
note
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -106,7 +106,7 @@ feature -- Access
loop
l_line := ic.item
if has_same_header_name (l_line, a_header_name) then
res := l_line.substring (n + 2, l_line.count)
res := l_line.substring (n + 2, l_line.count).to_string_8
res.left_adjust
res.right_adjust
Result := res
@@ -271,25 +271,25 @@ feature -- Content related header
put_content_type_with_charset (a_content_type: READABLE_STRING_8; a_charset: READABLE_STRING_8)
-- Put content type `a_content_type' with `a_charset' as "charset" parameter.
do
put_content_type_with_parameters (a_content_type, <<["charset", a_charset]>>)
put_content_type_with_parameters (a_content_type, {ARRAY [TUPLE [READABLE_STRING_8, READABLE_STRING_8]]} <<["charset", a_charset]>>)
end
add_content_type_with_charset (a_content_type: READABLE_STRING_8; a_charset: READABLE_STRING_8)
-- Same as `put_content_type_with_charset', but allow multiple definition of "Content-Type".
do
add_content_type_with_parameters (a_content_type, <<["charset", a_charset]>>)
add_content_type_with_parameters (a_content_type, {ARRAY [TUPLE [READABLE_STRING_8, READABLE_STRING_8]]} <<["charset", a_charset]>>)
end
put_content_type_with_name (a_content_type: READABLE_STRING_8; a_name: READABLE_STRING_8)
-- Put content type `a_content_type' with `a_name' as "name" parameter.
do
put_content_type_with_parameters (a_content_type, <<["name", a_name]>>)
put_content_type_with_parameters (a_content_type, {ARRAY [TUPLE [READABLE_STRING_8, READABLE_STRING_8]]} <<["name", a_name]>>)
end
add_content_type_with_name (a_content_type: READABLE_STRING_8; a_name: READABLE_STRING_8)
-- same as `put_content_type_with_name', but allow multiple definition of "Content-Type"
do
add_content_type_with_parameters (a_content_type, <<["name", a_name]>>)
add_content_type_with_parameters (a_content_type, {ARRAY [TUPLE [READABLE_STRING_8, READABLE_STRING_8]]} <<["name", a_name]>>)
end
put_content_length (a_length: INTEGER)

View File

@@ -77,10 +77,10 @@ feature {NONE} -- Initialization
-- Look for semi colon as parameter separation
p := s.index_of (';', i)
if p > 0 then
t := s.substring (i, p - 1)
t := s.substring (i, p - 1).to_string_8
create parameters.make_from_substring (s, p + 1, s.count)
else
t := s.substring (i, n)
t := s.substring (i, n).to_string_8
end
-- Remove eventual trailing space
t.right_adjust
@@ -124,7 +124,7 @@ feature -- Access
subtype: READABLE_STRING_8
-- Sub type
has_parameter (a_name: READABLE_STRING_8): BOOLEAN
has_parameter (a_name: READABLE_STRING_GENERAL): BOOLEAN
-- Has Current a parameter?
do
if attached parameters as plst then
@@ -132,7 +132,7 @@ feature -- Access
end
end
parameter (a_name: READABLE_STRING_8): detachable READABLE_STRING_8
parameter (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_8
-- Value for eventual parameter named `a_name'.
do
if attached parameters as plst then
@@ -159,7 +159,7 @@ feature -- Conversion
loop
res.append_character (';')
res.append_character (' ')
res.append (p.key)
res.append ({UTF_CONVERTER}.utf_32_string_to_utf_8_string_8 (p.key))
res.append_character ('=')
res.append_character ('%"')
res.append (p.item)
@@ -272,13 +272,19 @@ feature -- Status report
debug_output: STRING
-- String that should be displayed in debugger to represent `Current'.
do
if type /= Void and subtype /= Void then
Result := type + "/" + subtype
if attached type as l_type and attached subtype as l_subtype then
create Result.make_from_string (l_type)
Result.append_character ('/')
Result.append (l_subtype)
if attached parameters as plst then
across
plst as p
loop
Result.append ("; " + p.key + "=" + "%"" + p.item + "%"")
Result.append ("; ")
Result.append ({UTF_CONVERTER}.utf_32_string_to_utf_8_string_8 (p.key))
Result.append ("=%"")
Result.append (p.item)
Result.append_character ('%"')
end
end
else
@@ -290,7 +296,7 @@ invariant
type_and_subtype_not_empty: not has_error implies not type.is_empty and not subtype.is_empty
note
copyright: "2011-2013, Jocelyn Fiat, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -20,6 +20,8 @@ feature -- Content type : application
-- atom application content-type header
application_force_download: STRING = "application/force-download"
-- Warning: this is not a standard MIME content type.
-- Prefer application_octet_stream as default.
application_javascript: STRING = "application/javascript"
-- JavaScript application content-type header

View File

@@ -9,7 +9,7 @@ class
HTTP_PARAMETER_TABLE
inherit
HASH_TABLE [READABLE_STRING_8, STRING_8]
STRING_TABLE [READABLE_STRING_8]
redefine
empty_duplicate
end
@@ -58,7 +58,8 @@ feature {NONE} -- Implementation
-- and put in `out_end_index' the index after found parameter.
local
n: INTEGER
pn,pv: STRING_8
pn: READABLE_STRING_8
pv: STRING_8
i: INTEGER
p, q: INTEGER
err: BOOLEAN
@@ -86,7 +87,7 @@ feature {NONE} -- Implementation
if s[p+1] = '%"' then
q := s.index_of ('%"', p + 2)
if q > 0 then
pv := s.substring (p + 2, q - 1)
pv := s.substring (p + 2, q - 1).to_string_8
from
i := q + 1
until
@@ -108,7 +109,7 @@ feature {NONE} -- Implementation
if q = 0 then
q := n + 1
end
pv := s.substring (p + 1, q - 1)
pv := s.substring (p + 1, q - 1).to_string_8
out_end_index.replace (q + 1)
end
pv.right_adjust
@@ -138,7 +139,7 @@ feature {NONE} -- Duplication
end
note
copyright: "2011-2013, Jocelyn Fiat, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -74,4 +74,29 @@ feature -- Test routines
end
test_http_date_rfc3339
local
s: STRING
d: HTTP_DATE
dt: DATE_TIME
do
create dt.make_now_utc
create dt.make (1985, 04, 12, 23, 20, 50)
dt.set_fractionals (52)
dt.time.set_fractionals (52)
create d.make_from_date_time (dt)
s := "1985-04-12T23:20:50.52Z"
assert ("RFC 3339 to string", d.rfc3339_string.same_string (s))
create d.make_from_rfc3339_string (s)
assert ("RFC 3339 from string", not d.has_error and then d.date_time.is_equal (dt))
create d.make_from_rfc3339_string ("1996-12-19T16:39:57-08:00")
assert ("-8hours", d.rfc3339_string.same_string ("1996-12-20T00:39:57Z"))
create d.make_from_rfc3339_string ("1937-01-01T12:00:27.87+00:20")
assert ("-8hours", d.rfc3339_string.same_string ("1937-01-01T11:40:27.87Z"))
end
end

View File

@@ -14,6 +14,7 @@
<concurrency support="none" use="none"/>
</capability>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
<library name="http" location="..\http.ecf" readonly="false">
<option>
<assertions precondition="true" postcondition="true" check="true"/>

View File

@@ -47,6 +47,9 @@ feature -- Status
Result := (create {RAW_FILE}.make_with_path (executable_path)).exists
end
last_succeed: BOOLEAN
-- Last notification succeed?
feature -- Change
set_parameters (cmd: READABLE_STRING_GENERAL; args: detachable ITERABLE [READABLE_STRING_GENERAL])
@@ -84,7 +87,9 @@ feature -- Basic operation
args: like arguments
p: detachable PROCESS
retried: INTEGER
err: BOOLEAN
do
last_succeed := False
if retried = 0 then
create l_factory
if stdin_mode_set then
@@ -111,15 +116,22 @@ feature -- Basic operation
f.close
create args.make (1)
args.force (f.path.name)
else
err := True
-- FAILURE !
check should_not_occur: False end
end
end
p := l_factory.process_launcher (executable_path.name, args, Void)
p.set_hidden (True)
p.set_separate_console (False)
if not err then
p := l_factory.process_launcher (executable_path.name, args, Void)
p.set_hidden (True)
p.set_separate_console (False)
p.launch
p.launch
end
end
if p.launched and not p.has_exited then
if p /= Void and then p.launched and then not p.has_exited then
last_succeed := True
execution_environment.sleep (1_000)
p.wait_for_exit
if not p.has_exited then
@@ -146,55 +158,37 @@ feature -- Basic operation
feature {NONE} -- Implementation
new_temporary_file (a_extension: detachable READABLE_STRING_8): RAW_FILE
new_temporary_file (a_prefix: detachable READABLE_STRING_8): detachable RAW_FILE
-- Create file with temporary name.
-- With concurrent execution, noting ensures that {FILE_NAME}.make_temporary_name is unique
-- So using `a_extension' may help
local
bn: STRING_32
fn: PATH
s: STRING_32
f: detachable like new_temporary_file
i: INTEGER
retried: INTEGER
l_prefix: READABLE_STRING_GENERAL
do
-- With concurrent execution, nothing ensures that {FILE_NAME}.make_temporary_name is unique
-- So let's try to find
from
create bn.make_from_string_general ((create {FILE_NAME}.make_temporary_name).string)
create s.make_empty
until
f /= Void or i > 1000
loop
create fn.make_from_string (bn)
s.make_empty
if i > 0 then
s.append_character ('-')
s.append_integer (i)
fn := fn.appended (s)
if retried <= 3 then
-- Try 3 times...
if attached {EXECUTION_ENVIRONMENT}.temporary_directory_path as tmp then
if a_prefix /= Void then
l_prefix := tmp.extended (a_prefix).name
else
l_prefix := tmp.extended ("tmp-").name
end
create Result.make_open_temporary_with_prefix (l_prefix)
elseif a_prefix /= Void then
create Result.make_open_temporary_with_prefix (a_prefix)
else
create Result.make_open_temporary
end
if a_extension /= Void then
fn := fn.appended_with_extension (a_extension)
end
create f.make_with_path (fn)
if f.exists then
i := i + 1
f := Void
end
end
if f = Void then
Result := new_temporary_file (Void)
else
Result := f
check not_temporary_file_exists: not Result.exists end
check temporary_creatable: Result.is_creatable end
end
ensure
not_result_exists: not Result.exists
result_creatable: Result.is_creatable
new_temporary_file_exists: Result /= Void implies Result.exists
result_is_open_write: Result /= Void implies Result.is_open_write
rescue
retried := retried + 1
retry
end
note
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -2,9 +2,9 @@ note
description: "[
Component responsible to send email
]"
author: "$Author: jfiat $"
date: "$Date: 2015-06-30 11:07:17 +0200 (mar., 30 juin 2015) $"
revision: "$Revision: 97586 $"
author: "$Author$"
date: "$Date$"
revision: "$Revision$"
deferred class
NOTIFICATION_MAILER

View File

@@ -1,7 +1,7 @@
note
description: "Mailer that does nothing."
date: "$Date: 2015-06-30 15:49:56 +0200 (mar., 30 juin 2015) $"
revision: "$Revision: 97588 $"
date: "$Date$"
revision: "$Revision$"
class
NOTIFICATION_NULL_MAILER

View File

@@ -2,9 +2,9 @@ note
description : "[
NOTIFICATION_MAILER using sendmail as mailtool
]"
author: "$Author: jfiat $"
date: "$Date: 2015-06-30 15:49:56 +0200 (mar., 30 juin 2015) $"
revision: "$Revision: 97588 $"
author: "$Author$"
date: "$Date$"
revision: "$Revision$"
class
NOTIFICATION_SENDMAIL_MAILER

View File

@@ -1,8 +1,8 @@
note
description: "Summary description for {NOTIFICATION_STORAGE_MAILER}."
author: ""
date: "$Date: 2015-06-30 15:49:56 +0200 (mar., 30 juin 2015) $"
revision: "$Revision: 97588 $"
date: "$Date$"
revision: "$Revision$"
class
NOTIFICATION_STORAGE_MAILER

View File

@@ -93,7 +93,7 @@ feature -- Basic operation
-- Process the sending of `a_email'
local
l_email: EMAIL
h: STRING
h: STRING_8
i: INTEGER
lst: LIST [READABLE_STRING_8]
do
@@ -143,7 +143,7 @@ feature -- Basic operation
across
l_lines as ic
loop
h := ic.item
h := ic.item.to_string_8
i := h.index_of (':', 1)
if i > 0 then
l_email.add_header_entry (h.head (i - 1), h.substring (i + 1, h.count))
@@ -199,7 +199,7 @@ feature {NONE} -- Implementation
end
note
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -1,7 +1,7 @@
note
description: "Store email in specific file (could also be stderr, ...)."
date: "$Date: 2017-03-08 10:34:57 +0100 (mer., 08 mars 2017) $"
revision: "$Revision: 99935 $"
date: "$Date$"
revision: "$Revision$"
class
NOTIFICATION_EMAIL_FILE_STORAGE

View File

@@ -1,7 +1,7 @@
note
description: "Abtract interface of email storage."
date: "$Date: 2015-06-30 15:49:56 +0200 (mar., 30 juin 2015) $"
revision: "$Revision: 97588 $"
date: "$Date$"
revision: "$Revision$"
deferred class
NOTIFICATION_EMAIL_STORAGE

View File

@@ -32,4 +32,3 @@ Note: supporting only HS256 and none algorithm for signature, but could be exten
end
```

View File

@@ -73,7 +73,7 @@ feature -- Access
elseif attached {JSON_BOOLEAN} jv as jb then
Result := jb.item.out
elseif attached {JSON_NUMBER} jv as jnum then
Result := jnum.item
Result := jnum.item.to_string_32
end
end
end

View File

@@ -50,7 +50,7 @@ feature {NONE} -- Initialization
loop
if ic.key.starts_with ("HTTP_") then
if ic.key.is_valid_as_string_8 then
http_meta_variables.force (ic.item, ic.key.as_string_8)
http_meta_variables.force (ic.item, ic.key.to_string_8)
else
http_meta_variables.force (ic.item, utf.escaped_utf_32_string_to_utf_8_string_8 (ic.key))
end

View File

@@ -425,7 +425,7 @@ feature {NONE} -- Element change: CGI meta parameter related to PATH_INFO
update_path_info
-- Fix and update PATH_INFO value if needed
local
l_path_info: STRING
l_path_info: READABLE_STRING_8
do
l_path_info := path_info
@@ -480,14 +480,14 @@ feature {NONE} -- Implementation: utilities
end
n := s.count
check i >= 2 and i <= n end
Result := s.substring (i - 1, s.count)
Result := s.substring (i - 1, s.count).to_string_8
else
--| starts with one '/' and only one
Result := s
Result := s.to_string_8
end
elseif n = 1 then
if s[1] = '/' then
Result := s
Result := s.to_string_8
else
create Result.make (2)
Result.append_character ('/')

View File

@@ -131,7 +131,7 @@ invariant
pool_attached: pool /= Void
note
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2018, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -88,7 +88,7 @@ invariant
pool_attached: pool /= Void
note
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2018, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -2,8 +2,8 @@ note
description: "{POOLED_THREAD} is used in combination with {THREAD_POOL} to allow for pooled threads."
legal: "See notice at end of class."
status: "Community Preview 1.0"
date: "$Date: 2009-09-01 19:15:37 -0300 (mar 01 de sep de 2009) $"
revision: "$Revision: 80577 $"
date: "$Date$"
revision: "$Revision$"
class
POOLED_THREAD [G]

View File

@@ -5,8 +5,8 @@ note
]"
legal: "See notice at end of class."
status: "Community Preview 1.0"
date: "$Date: 2009-09-01 19:15:37 -0300 (mar 01 de sep de 2009) $"
revision: "$Revision: 80577 $"
date: "$Date$"
revision: "$Revision$"
class
THREAD_POOL [G]

View File

@@ -72,8 +72,11 @@ feature {NONE} -- Initialization
if attached {READABLE_STRING_GENERAL} opts.option ("server_name") as l_server_name then
server_name := l_server_name.to_string_8
end
if attached {READABLE_STRING_GENERAL} opts.option ("base") as l_base_str then
base_url := l_base_str.as_string_8
if
attached {READABLE_STRING_GENERAL} opts.option ("base") as l_base_str and then
l_base_str.is_valid_as_string_8
then
base_url := l_base_str.to_string_8
end
verbose := opts.option_boolean_value ("verbose", verbose)
@@ -130,6 +133,11 @@ feature {NONE} -- Initialization
then
secure_settings := [ssl_prot, opts.option_string_32_value ("ssl_ca_crt", Void), opts.option_string_32_value ("ssl_ca_key", Void)]
end
if is_secure then
if opts.has_integer_option ("secure_port") then
port_number := opts.option_integer_value ("secure_port", port_number)
end
end
end
create conn.make

View File

@@ -11,6 +11,15 @@ class
inherit
WSF_SERVICE_LAUNCHER_OPTIONS
create
default_create,
make,
make_from_array,
make_from_iterable
convert
make_from_array ({ARRAY [TUPLE [name: READABLE_STRING_GENERAL; value: detachable ANY]]})
feature -- Status report
is_secure_connection_supported: BOOLEAN

View File

@@ -1,7 +1,7 @@
note
description: "Filter implementing debug output in error stream, or `output' file."
date: "$Date: 2013-05-23 21:54:29 +0200 (jeu., 23 mai 2013) $"
revision: "$Revision: 92585 $"
date: "$Date$"
revision: "$Revision$"
class
WSF_DEBUG_FILTER
@@ -72,7 +72,7 @@ feature -- Basic operations
s.append (c.item.generating_type.name)
s.append_character ('}')
s.append_character ('=')
s.append (c.item.debug_output.as_string_8)
s.append ({UTF_CONVERTER}.utf_32_string_to_utf_8_string_8 (c.item.debug_output))
s.append_character ('%N')
end
end

View File

@@ -99,7 +99,6 @@ feature -- Execution
fut: FILE_UTILITIES
proc: BASE_PROCESS
l_input_env: STRING_TABLE [READABLE_STRING_GENERAL]
l_input_header: detachable STRING
l_input_buf: STRING
l_output: STRING
l_output_header_sent: BOOLEAN
@@ -107,10 +106,6 @@ feature -- Execution
s: STRING
i, j, n: INTEGER
do
-- Header
if attached req.raw_header_data as l_header then
l_input_header := l_header
end
-- Input data
create l_input_buf.make (req.content_length_value.to_integer_32)
req.read_input_data_into (l_input_buf)
@@ -126,7 +121,7 @@ feature -- Execution
check supported: False end
end
end
-- No need to import `l_input_header` in environment
-- No need to import input_header in environment
-- As current connector already did the job.
if
attached cgi_request_data (req) as d and then
@@ -149,7 +144,7 @@ feature -- Execution
if proc.launched then
-- Do not send the header to CGI script
-- value are passed via environment variables
-- proc.put_string (l_input_header)
-- proc.put_string (input_header)
-- Send payload.
proc.put_string (l_input_buf)

View File

@@ -1,8 +1,8 @@
note
description: "Handler returning debug information."
date: "$Date: 2013-06-28 16:14:02 +0200 (ven., 28 juin 2013) $"
revision: "$Revision: 92754 $"
date: "$Date$"
revision: "$Revision$"
class
WSF_DEBUG_HANDLER

View File

@@ -53,7 +53,11 @@ feature -- Helper
i := i + 1
end
end
res.put_header ({HTTP_STATUS_CODE}.unsupported_media_type, << ["Content-Type", "text/plain"], ["Accept", accept_s]>>)
res.put_header ({HTTP_STATUS_CODE}.unsupported_media_type,
{ARRAY [TUPLE [READABLE_STRING_8, READABLE_STRING_8]]} <<
["Content-Type", "text/plain"], ["Accept", accept_s]
>>
)
if accept_s /= Void then
res.put_string ("Unsupported request content-type, Accept: " + accept_s + "%N")
end
@@ -76,7 +80,8 @@ feature -- Helper
end
s.append_string (c.item)
end
res.put_header ({HTTP_STATUS_CODE}.method_not_allowed, <<
res.put_header ({HTTP_STATUS_CODE}.method_not_allowed,
{ARRAY [TUPLE [READABLE_STRING_8, READABLE_STRING_8]]} <<
["Content-Type", {HTTP_MIME_TYPES}.text_plain],
["Allow", s]
>>)

View File

@@ -100,7 +100,7 @@ feature -- Execution
do
a_output.append ("CGI variables:")
a_output.append (eol)
a_output.append (req.cgi_variables.debug_output)
append_unicode (req.cgi_variables.debug_output, a_output)
a_output.append (eol)
a_output.append (eol)
end

View File

@@ -18,13 +18,13 @@ inherit
feature -- Url Query
script_absolute_url (req: WSF_REQUEST; a_path: STRING): STRING
script_absolute_url (req: WSF_REQUEST; a_path: READABLE_STRING_8): READABLE_STRING_8
-- Absolute Url for the script if any, extended by `a_path'
do
Result := req.absolute_script_url (a_path)
end
script_url (req: WSF_REQUEST; a_path: STRING): STRING
script_url (req: WSF_REQUEST; a_path: READABLE_STRING_8): READABLE_STRING_8
-- Url relative to script name if any, extended by `a_path'
require
a_path_attached: a_path /= Void
@@ -32,11 +32,12 @@ feature -- Url Query
Result := req.script_url (a_path)
end
url (req: WSF_REQUEST; a_path: STRING; args: detachable STRING; abs: BOOLEAN): STRING
url (req: WSF_REQUEST; a_path: READABLE_STRING_8; args: detachable READABLE_STRING_8; abs: BOOLEAN): READABLE_STRING_8
-- Associated url based on `path' and `args'
-- if `abs' then return absolute url
local
s,t: detachable STRING
s: detachable READABLE_STRING_8
t: detachable STRING_8
do
s := args
if s /= Void and then s.count > 0 then

View File

@@ -24,19 +24,19 @@ feature -- Request
feature -- Url Query
script_absolute_url (a_path: STRING): STRING
script_absolute_url (a_path: STRING): READABLE_STRING_8
-- Absolute Url for the script if any, extended by `a_path'
do
Result := utility.script_absolute_url (request, a_path)
end
script_url (a_path: STRING): STRING
script_url (a_path: STRING): READABLE_STRING_8
-- Url relative to script name if any, extended by `a_path'
do
Result := utility.script_url (request, a_path)
end
url (args: detachable STRING; abs: BOOLEAN): STRING
url (args: detachable STRING; abs: BOOLEAN): READABLE_STRING_8
-- Associated url based on `path' and `args'
-- if `abs' then return absolute url
do

View File

@@ -51,7 +51,7 @@ feature {NONE} -- Initialization
router: WSF_ROUTER
resource: detachable STRING
resource: detachable READABLE_STRING_8
is_hidden: BOOLEAN
-- Current mapped handler should be hidden from self documentation

View File

@@ -26,7 +26,7 @@ feature {NONE} -- Initialization
router := a_router
end
make_with_resource (req: WSF_REQUEST; a_router: WSF_ROUTER; a_resource: STRING)
make_with_resource (req: WSF_REQUEST; a_router: WSF_ROUTER; a_resource: READABLE_STRING_8)
-- Make Current for request `req' and router `a_router'
-- and use `a_resource' to also generate links to this documentation via `a_resource'
--| note: it could be "/doc" or "/api/doc" or ...
@@ -51,7 +51,7 @@ feature -- Access
router: WSF_ROUTER
resource: detachable STRING_8
resource: detachable READABLE_STRING_8
feature -- Properties
@@ -310,13 +310,13 @@ feature {NONE} -- Implementation
Result := resource /= Void
end
doc_url (a_api: STRING_8): STRING_8
doc_url (a_api: READABLE_STRING_8): STRING_8
-- URL to show the documentation related to `a_api'.
require
doc_url_supported: doc_url_supported
do
if attached resource as s then
Result := request.script_url (s) + "?api=" + url_encoder.encoded_string (a_api)
Result := request.script_url (s) + "?api=" + url_encoder.general_encoded_string (a_api)
else
Result := request.script_url ("")
end
@@ -333,7 +333,7 @@ feature {NONE} -- Implementation
end
note
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -1,7 +1,7 @@
note
description: "Summary description for {WSF_CUSTOM_HEADER_FILTER}."
date: "$Date: 2013-05-23 21:54:29 +0200 (jeu., 23 mai 2013) $"
revision: "$Revision: 92585 $"
date: "$Date$"
revision: "$Revision$"
class
WSF_CUSTOM_HEADER_FILTER

View File

@@ -2,39 +2,42 @@ note
description: "Summary description for {WSF_FORMAT_UTILITY }."
author: ""
date: "$Date$"
revision: "$Revision$"
revision: "$Revision$"
class
WSF_FORMAT_UTILITY
feature -- Access
accepted_content_types (req: WSF_REQUEST): detachable ARRAYED_LIST [READABLE_STRING_8]
accepted_content_types (req: WSF_REQUEST): detachable ARRAYED_LIST [STRING_8]
local
s: STRING_8
q: READABLE_STRING_8
q,rs: READABLE_STRING_8
p: INTEGER
lst: LIST [READABLE_STRING_8]
qs: QUICK_SORTER [READABLE_STRING_8]
do
--TEST if attached ("text/html,application/xhtml+xml;q=0.6,application/xml;q=0.2,text/plain;q=0.5,*/*;q=0.8") as l_accept then
if attached req.http_accept as l_accept then
lst := l_accept.as_string_8.split (',')
lst := l_accept.split (',')
create Result.make (lst.count)
from
lst.start
until
lst.after
loop
s := lst.item
p := s.substring_index (";q=", 1)
rs := lst.item
p := rs.substring_index (";q=", 1)
if p > 0 then
q := s.substring (p + 3, s.count)
s := s.substring (1, p - 1)
q := rs.substring (p + 3, rs.count)
rs := rs.substring (1, p - 1)
else
q := "1.0"
end
Result.force (q + ":" + s)
create s.make_from_string (q)
s.append_character (':')
s.append (rs)
Result.force (s)
lst.forth
end
@@ -77,7 +80,7 @@ feature {NONE} -- Implementation
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -28,8 +28,10 @@ feature -- Access
do
if attached condition_description as desc and then desc.is_valid_as_string_8 then
Result := desc.to_string_8
elseif description.is_valid_as_string_8 then
Result := description.to_string_8
else
Result := description
Result := {UTF_CONVERTER}.utf_32_string_to_utf_8_string_8 (description)
end
end

View File

@@ -11,7 +11,7 @@ inherit
feature -- Mapping helper: uri template
map_uri_template (a_tpl: STRING; h: WSF_URI_TEMPLATE_HANDLER; rqst_methods: detachable WSF_REQUEST_METHODS)
map_uri_template (a_tpl: READABLE_STRING_8; h: WSF_URI_TEMPLATE_HANDLER; rqst_methods: detachable WSF_REQUEST_METHODS)
-- Map `h' as handler for `a_tpl', according to `rqst_methods'.
require
a_tpl_attached: a_tpl /= Void

View File

@@ -254,7 +254,7 @@ feature -- Execution
if attached directory_index_file (d) as f then
process_file (f, req, res)
else
uri := a_uri
uri := a_uri.to_string_8
if not uri.is_empty and then uri [uri.count] /= '/' then
uri.append_character ('/')
end
@@ -376,7 +376,7 @@ feature -- Execution
ext := extension (f.path.name)
ct := extension_mime_mapping.mime_type (ext)
if ct = Void then
ct := {HTTP_MIME_TYPES}.application_force_download
ct := {HTTP_MIME_TYPES}.application_octet_stream
end
create fres.make_with_content_type_and_path (ct, f.path)
fres.set_status_code ({HTTP_STATUS_CODE}.ok)
@@ -654,7 +654,7 @@ feature {NONE} -- implementation: date time
end
note
copyright: "2011-2019, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -31,19 +31,19 @@ feature {NONE} -- Initialization
do
l_tokens := a_protocol.split ('/')
if l_tokens.count = 2 then
l_protocol_name := l_tokens [1].as_string_8
l_protocol_name := l_tokens [1].to_string_8
l_protocol_name.left_adjust
l_protocol_name.right_adjust
if l_protocol_name.is_case_insensitive_equal ({HTTP_CONSTANTS}.http_version_1_0.substring (1, 4)) then
l_protocol_version := l_tokens [2].as_string_8
l_protocol_version := l_tokens [2].to_string_8
l_protocol_version.left_adjust
l_protocol_version.right_adjust
l_tokens := l_protocol_version.split ('.')
if l_tokens.count = 2 then
l_major := l_tokens [1].as_string_8
l_major := l_tokens [1].to_string_8
l_major.left_adjust
l_major.right_adjust
l_minor := l_tokens [2].as_string_8
l_minor := l_tokens [2].to_string_8
l_minor.left_adjust
l_minor.right_adjust
if l_major.is_natural then

View File

@@ -106,9 +106,9 @@ feature {WSF_ROUTER} -- Mapping
debug ("router")
-- Display conflict in mapping
if has_item_associated_with_resource (l_mapping.associated_resource, a_item.request_methods) then
io.error.put_string ("Mapping: " + l_mapping.debug_output + ": conflict with existing mapping")
io.error.put_string_32 ({STRING_32} "Mapping: " + l_mapping.debug_output.to_string_32 + {STRING_32} ": conflict with existing mapping")
if attached item_associated_with_resource (l_mapping.associated_resource, a_item.request_methods) as l_conflicted then
io.error.put_string (": " + l_conflicted.debug_output)
io.error.put_string_32 ({STRING_32} ": " + l_conflicted.debug_output)
end
io.error.put_string ("%N")
end

View File

@@ -58,7 +58,10 @@ feature -- Execution
create sess
router.dispatch (req, res, sess)
if not sess.dispatched then
res.put_header ({HTTP_STATUS_CODE}.not_found, <<[{HTTP_HEADER_NAMES}.header_content_length, "0"]>>)
res.put_header ({HTTP_STATUS_CODE}.not_found,
{ARRAY [TUPLE [READABLE_STRING_8, READABLE_STRING_8]]} <<
[{HTTP_HEADER_NAMES}.header_content_length, "0"]
>>)
end
end

View File

@@ -2,8 +2,8 @@ note
description: "[
Component to handle percent encoding
]"
date: "$Date: 2013-05-21 01:15:17 +0200 (mar., 21 mai 2013) $"
revision: "$Revision: 92557 $"
date: "$Date$"
revision: "$Revision$"
EIS: "name=Percent-encoding", "protocol=URI", "src=http://en.wikipedia.org/wiki/Percent-encoding"
class

View File

@@ -26,7 +26,7 @@ feature -- Status report
feature -- Execution
handle (a_content_type: HTTP_CONTENT_TYPE; req: WSF_REQUEST;
a_vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL]; a_raw_data: detachable CELL [detachable STRING_8])
a_vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL]; a_raw_data: detachable CELL [detachable READABLE_STRING_8])
local
l_content: READABLE_STRING_8
n, p, i, j: INTEGER

View File

@@ -16,7 +16,7 @@ feature -- Status report
feature -- Execution
handle (a_content_type: HTTP_CONTENT_TYPE; req: WSF_REQUEST;
a_vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL]; a_raw_data: detachable CELL [detachable STRING_8])
a_vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL]; a_raw_data: detachable CELL [detachable READABLE_STRING_8])
-- Handle MIME content from request `req', eventually fill the `a_vars' (not yet available from `req')
-- and if `a_raw_data' is attached, store any read data inside `a_raw_data'
require
@@ -25,7 +25,7 @@ feature -- Execution
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -31,9 +31,9 @@ feature -- Status report
feature -- Execution
handle (a_content_type: HTTP_CONTENT_TYPE; req: WSF_REQUEST;
a_vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL]; a_raw_data: detachable CELL [detachable STRING_8])
a_vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL]; a_raw_data: detachable CELL [detachable READABLE_STRING_8])
local
s: like full_input_data
s: READABLE_STRING_8
do
s := full_input_data (req)
if a_raw_data /= Void then

View File

@@ -57,8 +57,7 @@ feature -- Query
-- if possible
do
if attached value as v then
-- FIXME: in the future, use the new `{TYPE}.name_32`
Result := generating_type.name.to_string_32
Result := generating_type.name_32
else
Result := {STRING_32} "Void"
end

View File

@@ -64,7 +64,7 @@ feature -- Status report
Result.append ("%"")
Result.append (" content-type=%"")
Result.append (content_type)
Result.append_string_general (content_type)
Result.append ("%"")
Result.append (" size=%"")
@@ -121,7 +121,7 @@ feature -- Access: Uploaded File
Result := ut.safe_filename (filename)
end
content_type: STRING
content_type: READABLE_STRING_8
-- Content type
size: INTEGER

View File

@@ -1,6 +1,6 @@
note
description : "Objects that ..."
author : "$Author: jfiat $"
author : "$Author$"
date : "$Date$"
revision : "$Revision$"

View File

@@ -307,7 +307,7 @@ feature -- Content-type related
create m_map.make_default
m := m_map.mime_type (file_extension (file_path).as_lower)
if m = Void then
m := {HTTP_MIME_TYPES}.application_force_download
m := {HTTP_MIME_TYPES}.application_octet_stream
end
content_type := m
end

View File

@@ -93,9 +93,9 @@ feature {WSF_RESPONSE} -- Output
send_to (res: WSF_RESPONSE)
local
s, l_html_error_code_text: STRING
s: STRING
l_text: detachable READABLE_STRING_GENERAL
l_loc: detachable READABLE_STRING_8
l_html_error_code_text, l_loc: detachable READABLE_STRING_8
h: like header
l_messages: HTTP_STATUS_CODE_MESSAGES
do
@@ -219,7 +219,8 @@ feature {WSF_RESPONSE} -- Output
h.put_content_type_text_html
else
s := l_html_error_code_text + ": the request method "
create s.make_from_string (l_html_error_code_text)
s.append (": the request method ")
s.append (request.request_method)
s.append (" is inappropriate for the URL for '" + html_encoder.general_encoded_string (request.request_uri) + "'.%N")
if attached suggested_methods as lst and then not lst.is_empty then
@@ -327,7 +328,7 @@ feature {NONE} -- Implementation
end
note
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -17,7 +17,7 @@ create
make_with_body
convert
make_with_body ({READABLE_STRING_8, STRING_8, IMMUTABLE_STRING_8})
make_with_body ({STRING_8})
feature {NONE} -- Initialization
@@ -27,7 +27,9 @@ feature {NONE} -- Initialization
create header.make
end
make_with_body (a_body: READABLE_STRING_8)
make_with_body (a_body: STRING_8)
-- Initialize `body` with `a_body`.
-- Note: it mays not be the same object.
do
make
body := a_body
@@ -105,7 +107,7 @@ feature {WSF_RESPONSE} -- Output
end
note
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -7,8 +7,8 @@ note
base: base_url (very specific to standalone server)
verbose: to display verbose output, useful for Standalone
]"
date: "$Date: 2016-08-06 13:34:52 +0200 (sam., 06 août 2016) $"
revision: "$Revision: 99106 $"
date: "$Date$"
revision: "$Revision$"
class
WSF_SERVICE_LAUNCHER_OPTIONS

View File

@@ -392,7 +392,7 @@ feature -- Helper
--| Based on header "Accept:" that can be for instance
--| text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
do
if attached (create {SERVER_MEDIA_TYPE_NEGOTIATION}.make (a_content_type.as_string_8)).preference (<<a_content_type.as_string_8>>, http_accept) as l_variants then
if attached (create {SERVER_MEDIA_TYPE_NEGOTIATION}.make (a_content_type.to_string_8)).preference (<<a_content_type.to_string_8>>, http_accept) as l_variants then
Result := l_variants.is_acceptable
end
end
@@ -503,6 +503,7 @@ feature -- Access: global variables
local
i: INTEGER
n: INTEGER
s: STRING_32
do
from
i := 1
@@ -511,7 +512,11 @@ feature -- Access: global variables
until
i = 0
loop
if attached {WSF_STRING} a_item_fct.item ([a_name + "[" + i.out + "]"]) as v then
create s.make_from_string_general (a_name)
s.append_character ('[')
s.append_integer (i)
s.append_character (']')
if attached {WSF_STRING} a_item_fct.item ([s]) as v then
Result.force (v.value, n)
n := n + 1
i := i + 1
@@ -1804,14 +1809,14 @@ feature -- URL Utility
Result := s
end
absolute_script_url (a_path: STRING): STRING
absolute_script_url (a_path: READABLE_STRING_8): STRING
-- Absolute Url for the script if any, extended by `a_path'
do
Result := script_url (a_path)
Result.prepend (server_url)
end
script_url (a_path: STRING): STRING
script_url (a_path: READABLE_STRING_8): STRING
-- Url relative to script name if any, extended by `a_path'
local
l_base_url: like internal_url_base
@@ -1854,7 +1859,7 @@ feature -- URL Utility
end
end
if l_base_url = Void then
create l_base_url.make_empty
create {STRING_8} l_base_url.make_empty
end
internal_url_base := l_base_url
end
@@ -1867,7 +1872,7 @@ feature {NONE} -- Implementation: URL Utility
internal_server_url: detachable like server_url
-- Server url
internal_url_base: detachable STRING
internal_url_base: detachable READABLE_STRING_8
-- URL base of potential script
internal_percent_encoded_path_info: detachable like percent_encoded_path_info
@@ -1912,7 +1917,7 @@ feature {WSF_MIME_HANDLER} -- Temporary File handling
end
end
save_uploaded_file (a_up_file: WSF_UPLOADED_FILE; a_content: STRING)
save_uploaded_file (a_up_file: WSF_UPLOADED_FILE; a_content: READABLE_STRING_8)
-- Save uploaded file content `a_content' into `a_filename'.
local
dn: PATH

View File

@@ -10,6 +10,7 @@
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="encoder" location="..\..\text\encoder\encoder.ecf"/>
<library name="uri_template" location="..\..\text\parser\uri_template\uri_template.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
<library name="wsf" location="..\wsf\wsf.ecf"/>
<cluster name="api" location=".\api\" recursive="true"/>
<cluster name="css" location=".\css\" recursive="true"/>

View File

@@ -9,7 +9,7 @@ class
BASE64
inherit
ENCODER [STRING_8, STRING_8]
ENCODER [READABLE_STRING_8, READABLE_STRING_8]
redefine
valid_encoded_string
end
@@ -25,7 +25,7 @@ feature -- Status report
has_error: BOOLEAN
valid_encoded_string (v: STRING): BOOLEAN
valid_encoded_string (v: READABLE_STRING_8): BOOLEAN
do
Result := Precursor (v) and then
(v.is_empty or v.count >= 4)
@@ -33,7 +33,7 @@ feature -- Status report
feature -- base64 encoder
encoded_string (s: STRING): STRING_8
encoded_string (s: READABLE_STRING_8): STRING_8
-- base64 encoded value of `s'.
local
i,n: INTEGER
@@ -95,14 +95,14 @@ feature -- base64 encoder
feature -- Decoder
decoded_string (v: STRING): STRING
decoded_string (v: READABLE_STRING_8): STRING
-- base64 decoded value of `s'.
do
create Result.make (v.count)
decode_string_to_buffer (v, Result)
end
decode_string_to_buffer (v: STRING; a_buffer: STRING)
decode_string_to_buffer (v: READABLE_STRING_8; a_buffer: STRING)
-- Write base64 decoded value of `s' into `a_buffer'
local
byte_count: INTEGER
@@ -180,7 +180,7 @@ feature -- Decoder
end
end
decode_string_to_output_medium (v: STRING; a_output: IO_MEDIUM)
decode_string_to_output_medium (v: READABLE_STRING_8; a_output: IO_MEDIUM)
-- Write base64 decoded value of `s' into `a_output' medium
require
a_output_writable: a_output.is_open_write
@@ -259,7 +259,7 @@ feature -- Decoder
end
end
next_encoded_character_position (v: STRING; from_pos: INTEGER): INTEGER
next_encoded_character_position (v: READABLE_STRING_8; from_pos: INTEGER): INTEGER
-- Next encoded character position from `v' starting after `from_pos' index.
-- Result over `v.count' denodes no remaining decodable position
--| Mainly to handle base64 encoded text on multiple line

View File

@@ -91,7 +91,7 @@ feature -- Decoder
local
i, n: INTEGER
c: CHARACTER
hex: STRING
hex: READABLE_STRING_8
do
has_error := False
n := v.count
@@ -183,7 +183,7 @@ feature {NONE} -- Implementation
end
note
copyright: "Copyright (c) 2011-2014, Eiffel Software and others"
copyright: "Copyright (c) 2011-2020, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -2,8 +2,8 @@ note
description: "[
Component to handle percent encoding
]"
date: "$Date: 2014-04-09 16:37:28 +0200 (mer., 09 avr. 2014) $"
revision: "$Revision: 94801 $"
date: "$Date$"
revision: "$Revision$"
EIS: "name=Percent-encoding", "protocol=URI", "src=http://en.wikipedia.org/wiki/Percent-encoding"
class

View File

@@ -93,7 +93,7 @@ feature -- Decoder
feature {NONE} -- Implementation: decoder
next_entity (v: STRING_8; cl_i: CELL [INTEGER]): STRING_32
next_entity (v: READABLE_STRING_8; cl_i: CELL [INTEGER]): STRING_32
-- Return next entity value
-- move index
local
@@ -259,7 +259,7 @@ feature {NONE} -- Implementation: decoder
end
note
copyright: "2011-2012, Eiffel Software and others"
copyright: "Copyright (c) 2011-2020, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -2,8 +2,8 @@ note
description: "[
Convert a FEED to XHTML representation.
]"
date: "$Date: 2015-10-08 10:45:13 +0200 (jeu., 08 oct. 2015) $"
revision: "$Revision: 97964 $"
date: "$Date$"
revision: "$Revision$"
class
FEED_TO_XHTML_VISITOR

View File

@@ -178,7 +178,8 @@ feature -- Builder
-- Expanded template using variable from `a_ht'
-- with based url
do
Result := a_base_url + expanded_string (a_ht)
create Result.make_from_string (a_base_url)
Result.append (expanded_string (a_ht))
end
feature -- Match
@@ -192,12 +193,12 @@ feature -- Match
l_offset: INTEGER
p,q,nb: INTEGER
exp: URI_TEMPLATE_EXPRESSION
vn, s,t: STRING
vv, path_vv: STRING
vv, vn, t, s: READABLE_STRING_8
path_vv: STRING
l_vars, l_path_vars, l_query_vars: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8]
l_uri_count: INTEGER
tpl_count: INTEGER
l_next_literal_separator: detachable STRING
l_next_literal_separator: detachable READABLE_STRING_8
do
--| Extract expansion parts "\\{([^\\}]*)\\}"
analyze
@@ -419,7 +420,7 @@ feature {NONE} -- Implementation
end
end
import_path_style_parameters_into (a_content: STRING; res: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8])
import_path_style_parameters_into (a_content: READABLE_STRING_8; res: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8])
require
a_content_attached: a_content /= Void
res_attached: res /= Void
@@ -427,7 +428,7 @@ feature {NONE} -- Implementation
import_custom_style_parameters_into (a_content, ';', res)
end
import_form_style_parameters_into (a_content: STRING; res: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8])
import_form_style_parameters_into (a_content: READABLE_STRING_8; res: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8])
require
a_content_attached: a_content /= Void
res_attached: res /= Void
@@ -435,7 +436,7 @@ feature {NONE} -- Implementation
import_custom_style_parameters_into (a_content, '&', res)
end
import_custom_style_parameters_into (a_content: STRING; a_separator: CHARACTER; res: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8])
import_custom_style_parameters_into (a_content: READABLE_STRING_8; a_separator: CHARACTER; res: HASH_TABLE [READABLE_STRING_8, READABLE_STRING_8])
require
a_content_attached: a_content /= Void
res_attached: res /= Void
@@ -475,7 +476,7 @@ feature {NONE} -- Implementation
end
end
next_path_variable_value (a_uri: STRING; a_index: INTEGER; a_end_token: detachable STRING): STRING
next_path_variable_value (a_uri: READABLE_STRING_8; a_index: INTEGER; a_end_token: detachable READABLE_STRING_8): STRING
require
valid_index: a_index <= a_uri.count
local
@@ -511,7 +512,7 @@ feature {NONE} -- Implementation
end
i := i + 1
end
Result := a_uri.substring (a_index, p)
Result := a_uri.substring (a_index, p).to_string_8
end
note

View File

@@ -2,8 +2,8 @@ note
description : "Objects that represent a custom error"
legal: "See notice at end of class."
status: "See notice at end of class."
date: "$Date: 2015-10-10 00:55:41 +0200 (sam., 10 oct. 2015) $"
revision: "$Revision: 97980 $"
date: "$Date$"
revision: "$Revision$"
class
ERROR_CUSTOM

View File

@@ -36,7 +36,7 @@ feature -- Output
do
if a_str /= Void then
to_implement ("Convert into UTF-8 or console encoding before output")
file.put_string (a_str.as_string_8)
file.put_string ({UTF_CONVERTER}.utf_32_string_to_utf_8_string_8 (a_str))
end
end