Merge branch 'master' into es17.05
This commit is contained in:
@@ -10,6 +10,9 @@ It provides simple routine to perform http requests, and get response.
|
||||
- Eiffel Net library
|
||||
- and optionally Eiffel NetSSL library to support `https://...`
|
||||
|
||||
* Note: set ciphers settings is supported only with libcurl implementation for now, net implementation
|
||||
set all the ciphers as part of the OpenSSL initialization.
|
||||
|
||||
This means on Windows, do not forget to copy the libcurl.dll (and related) either in the same directory of the executable, or ensure the .dll are in the PATH environment.
|
||||
|
||||
It is possible to exclude the libcurl implementation xor the Eiffel Net implementation:
|
||||
|
||||
@@ -16,8 +16,19 @@ feature -- Access
|
||||
deferred
|
||||
end
|
||||
|
||||
get (a_url: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT): HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
Result := new_session (a_url).get ("", ctx)
|
||||
end
|
||||
|
||||
custom (a_method: READABLE_STRING_8; a_url: READABLE_STRING_8; ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT): HTTP_CLIENT_RESPONSE
|
||||
-- Response for `a_method' request based on `a_url' and optional `ctx'.
|
||||
do
|
||||
Result := new_session (a_url).custom (a_method, "", ctx)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -31,7 +31,11 @@ feature {NONE} -- Initialization
|
||||
-- This can be used to reset/reinitialize Current with new url
|
||||
-- in the case of redirection.
|
||||
do
|
||||
url := a_url
|
||||
if a_url.starts_with ("http://") or a_url.starts_with ("http://") then
|
||||
url := a_url
|
||||
else
|
||||
url := session.url (a_url, Void)
|
||||
end
|
||||
headers := session.headers.twin
|
||||
if ctx /= Void then
|
||||
context := ctx
|
||||
|
||||
@@ -272,6 +272,15 @@ feature -- Authentication
|
||||
-- Associated optional credentials value.
|
||||
-- Computed as `username':`password'.
|
||||
|
||||
ciphers_settings: detachable READABLE_STRING_8
|
||||
-- SSL cipher preference lists
|
||||
-- examples: DEFAULT, ALL, TLSv1
|
||||
-- check https://www.openssl.org/docs/man1.1.0/apps/ciphers.html
|
||||
--Warning At the moment only used for LIB_CURL_HTTP_CLIENT
|
||||
--Warning Net implementation set all the ciphers using the OpenSSL at
|
||||
--Warning initialization time.
|
||||
|
||||
|
||||
feature -- Status setting
|
||||
|
||||
set_is_debug (b: BOOLEAN)
|
||||
@@ -401,6 +410,14 @@ feature -- Element change
|
||||
chunk_size := a_size
|
||||
end
|
||||
|
||||
set_ciphers_settings (a_ciphers_settings: READABLE_STRING_8)
|
||||
-- Set 'ciphers_settings' with 'a_ciphers_settings'.
|
||||
do
|
||||
create {STRING_8} ciphers_settings.make_from_string (a_ciphers_settings)
|
||||
ensure
|
||||
cipher_settings_set: attached ciphers_settings as c_settings and then c_settings.same_string (a_ciphers_settings)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
@@ -372,6 +372,11 @@ feature -- Execution
|
||||
curl_easy.setopt_integer (curl_handle, {CURL_OPT_CONSTANTS}.curlopt_ssl_verifypeer, 0)
|
||||
end
|
||||
|
||||
--| Cipher List
|
||||
if attached session.ciphers_settings as c_list then
|
||||
curl_easy.setopt_string (curl_handle, {CURL_OPT_CONSTANTS}.curlopt_ssl_cipher_list, c_list )
|
||||
end
|
||||
|
||||
--| Request method
|
||||
if request_method.is_case_insensitive_equal ("GET") then
|
||||
curl_easy.setopt_integer (curl_handle, {CURL_OPT_CONSTANTS}.curlopt_httpget, 1)
|
||||
|
||||
@@ -113,6 +113,7 @@ feature -- Access
|
||||
-- Get URL data
|
||||
l_is_https := url.starts_with_general ("https://")
|
||||
create l_uri.make_from_string (url)
|
||||
check valid_url: l_uri.is_valid end
|
||||
l_port := l_uri.port
|
||||
if l_port = 0 then
|
||||
if l_is_https then
|
||||
|
||||
Reference in New Issue
Block a user