contrib: update users of Curl
authorAlexis Laferrière <alexis.laf@xymus.net>
Sun, 7 Jun 2015 18:42:51 +0000 (14:42 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Sun, 7 Jun 2015 23:46:52 +0000 (19:46 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

contrib/benitlux/src/benitlux_daily.nit
contrib/rss_downloader/src/rss_downloader.nit

index bb6d1fa..1c1f4d6 100644 (file)
@@ -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})"
index eacaf79..ed5fc72 100644 (file)
@@ -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