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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user