class

Curl::Downloader

Inherits Reference < Object

Constants

VERSION = "0.5"
WRITE_DATA_CALLBACK = ->(ptr : ::Pointer(UInt8), size : LibC::SizeT, nmemb : LibC::SizeT, data : ::Pointer(Void)) do slice = Bytes.new(ptr, size * nmemb) (data.as(Buffer)).receive_data(slice) size * nmemb end

Constructors

Instance methods

accept_encoding=(enc : String)

ex: accept_encoding = "gzip, deflate"

Source
auth_basic=(auth : String)

ex: auth_basic = "login:password"

Source
auth_digest=(auth : String)

ex: auth_digest = "login:password"

Source
body=(body : String)

ex: body = "bla=1&gg=2"

Source
clear_buffers
Source
code
Source
connect_time
Source
connect_timeout=(t : Int32 | Time::Span)

ex: connect_timeout = 10 # seconds

Source
content
Source
content_type
Source
duration
Source
error_description
Source
execute

run execution

Source
finalize
Source
follow_redirects!

set to follow redirects

Source
free

call this after execution done, also this called when object finalized

Source
get_info_double(key)
Source
get_info_int(key)
Source
get_info_string(key)
Source
headers
Source
headers=(headers : Array(String))

set headers, ex: headers = ["Accept: text/html", "User-Agent: Bla"]

Source
headers=(headers : Hash(String, String))

set headers, ex: headers = {"Accept" => "text/html", "User-Agent" => "Bla"}

Source
http_status
Source
interface=(bind : String)

ex: interface = "127.0.0.1"

Source
local_addr
Source
max_redirects=(max_redirs : Int32)

ex: max_redirects = 10

Source
method=(method : String)

ex: method = "POST", default: "GET"

Source
namelookup_time
Source
no_body!

to execute HEAD method downloader.method = "HEAD" downloader.no_body!

Source
num_connects
Source
proxy=(proxy : String)

ex: proxy = "http://127.0.0.1:443", proxy = "socks5://127.0.0.1:443"

Source
redirect_time
Source
redirects_count
Source
remote_addr
Source
resolve=(resolve : Array(String))

ex: resolve = ["bla.ru:80:127.0.0.1"]

Source
set_opt(opt, val)
Source
ssl_verifyhost=(flag : Bool)

ex: ssl_verifyhost = false

Source
ssl_verifypeer=(flag : Bool)

ex: ssl_verifypeer = false

Source
timeout=(t : Int32 | Time::Span)

ex: timeout = 60 # seconds

Source
total_time
Source
url=(url : String)

ex: url = "https://google.com/"

Source
url_effective
Source
verbose!
Source