From: Alexis Laferrière Date: Sun, 7 Jun 2015 18:42:51 +0000 (-0400) Subject: contrib: update users of Curl X-Git-Tag: v0.7.6~52^2~3 X-Git-Url: http://nitlanguage.org contrib: update users of Curl Signed-off-by: Alexis Laferrière --- diff --git a/contrib/benitlux/src/benitlux_daily.nit b/contrib/benitlux/src/benitlux_daily.nit index bb6d1fa..1c1f4d6 100644 --- a/contrib/benitlux/src/benitlux_daily.nit +++ b/contrib/benitlux/src/benitlux_daily.nit @@ -129,14 +129,11 @@ class Benitlux # Fetch the Web page at `url` fun download_html_page: String do - var curl = new Curl - - var request = new CurlHTTPRequest(url, curl) + var request = new CurlHTTPRequest(url) var response = request.execute if response isa CurlResponseSuccess then var body = response.body_str - curl.destroy return body else if response isa CurlResponseFailed then print "Failed downloading URL '{url}' with: {response.error_msg} ({response.error_code})" diff --git a/contrib/rss_downloader/src/rss_downloader.nit b/contrib/rss_downloader/src/rss_downloader.nit index eacaf79..ed5fc72 100644 --- a/contrib/rss_downloader/src/rss_downloader.nit +++ b/contrib/rss_downloader/src/rss_downloader.nit @@ -62,16 +62,12 @@ class Element # Download this element to `path` fun download_to(path: Text) do - var curl = new Curl - - var request = new CurlHTTPRequest(link, curl) + var request = new CurlHTTPRequest(link) var response = request.download_to_file(path.to_s) - if response isa CurlFileResponseSuccess then - curl.destroy - else if response isa CurlResponseFailed then + if response isa CurlResponseFailed then sys.stderr.write "Failed downloading URL '{link}' with: {response.error_msg} ({response.error_code})\n" - else abort + end end # Get an unique identifier for this element, uses `Config::unique_pattern` @@ -232,16 +228,13 @@ redef class Text # Get the content of the RSS feed at `self` fun fetch_rss_content: Text do - var curl = new Curl - if sys.verbose then print "\n# Downloading RSS file from '{self}'" - var request = new CurlHTTPRequest(to_s, curl) + var request = new CurlHTTPRequest(to_s) var response = request.execute if response isa CurlResponseSuccess then var body = response.body_str - curl.destroy if sys.verbose then print "Download successful" return body else if response isa CurlResponseFailed then