From 65b28ed877a155b466b227a3cf9423826f93174e Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Wed, 16 Sep 2015 00:00:30 +0200 Subject: [PATCH] Updated README.md with configuration topics related to libcurl or net disabling. Fixed ssl test by precising insecure ssl. --- library/network/http_client/README.md | 46 ++++++++++++++++++- .../http_client/tests/test_http_client_i.e | 1 + 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/library/network/http_client/README.md b/library/network/http_client/README.md index 59eb25ea..7760464b 100644 --- a/library/network/http_client/README.md +++ b/library/network/http_client/README.md @@ -1,14 +1,56 @@ # simple HTTP client ## Overview +It provides simple routine to perform http requests, and get response. ## Requirements -* Eiffel cURL library -* cURL dynamic libraries in the PATH or the current directory (.dll or .so) +* 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:// 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 +``` + +``` + + * Disable the net implementation +``` + +``` + + * 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 : +``` + +``` + * 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_client library, use the DEFAULT_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.ecf project to see how to use. +* Examples will come in the future. diff --git a/library/network/http_client/tests/test_http_client_i.e b/library/network/http_client/tests/test_http_client_i.e index 66f42c39..f8228f3c 100644 --- a/library/network/http_client/tests/test_http_client_i.e +++ b/library/network/http_client/tests/test_http_client_i.e @@ -54,6 +54,7 @@ feature -- Test routines h: STRING_8 do sess := new_session ("https://www.eiffel.org") + sess.set_is_insecure (True) if attached sess.get ("/welcome", Void) as res then assert ("Get returned without error", not res.error_occurred) create h.make_empty