class Curl::Downloader
- Curl::Downloader
- Reference
- Object
Defined in:
curl-downloader/downloader.crConstant Summary
-
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 Method Summary
-
#accept_encoding=(enc : String)
ex: accept_encoding = "gzip, deflate"
-
#auth_basic=(auth : String)
ex: auth_basic = "login:password"
-
#auth_digest=(auth : String)
ex: auth_digest = "login:password"
-
#body=(body : String)
ex: body = "bla=1&gg=2"
- #clear_buffers
- #code : LibCurl::CURLcode
- #connect_time
-
#connect_timeout=(t : Int32 | Time::Span)
ex: connect_timeout = 10 # seconds
- #content
- #content_type
-
#cookie_file=(path : String)
ex: cookie_file = "/tmp/bla.txt"
-
#cookie_jar=(path : String)
ex: cookie_jar = "/tmp/bla.txt"
- #duration
- #error_description
-
#execute
run execution
- #finalize
-
#follow_redirects!
set to follow redirects
-
#free
call this after execution done, also this called when object finalized
- #get_info_double(key)
- #get_info_int(key)
- #get_info_string(key)
- #headers
-
#headers=(headers : Array(String))
set headers, ex: headers = ["Accept: text/html", "User-Agent: Bla"]
-
#headers=(headers : Hash(String, String))
set headers, ex: headers = {"Accept" => "text/html", "User-Agent" => "Bla"}
- #http_status
-
#interface=(bind : String)
ex: interface = "127.0.0.1"
- #local_addr
-
#max_redirects=(max_redirs : Int32)
ex: max_redirects = 10
-
#method=(method : String)
ex: method = "POST", default: "GET"
- #namelookup_time
-
#no_body!
to execute HEAD method downloader.method = "HEAD" downloader.no_body!
- #num_connects
- #ok?
-
#proxy=(proxy : String)
ex: proxy = "http://127.0.0.1:443", proxy = "socks5://127.0.0.1:443"
- #redirect_time
- #redirects_count
- #remote_addr
-
#resolve=(resolve : Array(String))
ex: resolve = ["bla.ru:80:127.0.0.1"]
- #set_opt(opt, val)
-
#ssl_verifyhost=(flag : Bool)
ex: ssl_verifyhost = false
-
#ssl_verifypeer=(flag : Bool)
ex: ssl_verifypeer = false
-
#timeout=(t : Int32 | Time::Span)
ex: timeout = 60 # seconds
- #total_time
-
#url=(url : String)
ex: url = "https://google.com/"
- #url_effective
- #verbose!
Constructor Detail
Instance Method Detail
set headers, ex: headers = ["Accept: text/html", "User-Agent: Bla"]
set headers, ex: headers = {"Accept" => "text/html", "User-Agent" => "Bla"}