- 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)
simple HTTP client
Overview
It provides simple routine to perform http requests, and get response.
Requirements
-
One of the following
- Eiffel cURL library
- cURL dynamic libraries in the PATH or the current directory (.dll or .so)
- Eiffel Net library
- and optionally Eiffel NetSSL library to support
https://...
- and optionally Eiffel NetSSL library to support
- Eiffel cURL library
-
Note: set ciphers setting 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: In the .ecf configuration file of your project, you can use the following custom variables:
* Disable the libcurl implementation
<variable name="libcurl_http_client_disabled" value="True"/>
* Disable the net implementation
<variable name="net_http_client_disabled" value="True"/>
* If you disabled both, the http client will not work as expected.
For the net implementation (using EiffelNet), if you need https:// support, you need to enabled the ssl support with the custom variables :
<variable name="ssl_enabled" value="True"/>
* By default, SSL is not included (mostly because it is sometime a pain to get the needed dynamic libraries .dll or .so)
Usage
- To build code that is portable across the libcurl or net implementation of
http_clientlibrary, use theDEFAULT_HTTP_CLIENT
cl: DEFAULT_HTTP_CLIENT
sess: HTTP_CLIENT_SESSION
create cl
sess := cl.new_session ("http://example.com")
if attached sess.get ("/path-to-test") as l_response then
if not l_response.error_occurred then
if attached l_response.body as l_body then
print (l_body)
end
end
end
Examples
- See the
tests/test-safe.ecfproject to see how to use. - Examples will come in the future.