class Curl::Downloader

Defined in:

curl-downloader/downloader.cr

Constant 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

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def accept_encoding=(enc : String) #

ex: accept_encoding = "gzip, deflate"


[View source]
def auth_basic=(auth : String) #

ex: auth_basic = "login:password"


[View source]
def auth_digest=(auth : String) #

ex: auth_digest = "login:password"


[View source]
def body=(body : String) #

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


[View source]
def clear_buffers #

[View source]
def code : LibCurl::CURLcode #

[View source]
def connect_time #

[View source]
def connect_timeout=(t : Int32 | Time::Span) #

ex: connect_timeout = 10 # seconds


[View source]
def content #

[View source]
def content_type #

[View source]
def cookie_file=(path : String) #

ex: cookie_file = "/tmp/bla.txt"


[View source]
def cookie_jar=(path : String) #

ex: cookie_jar = "/tmp/bla.txt"


[View source]
def duration #

[View source]
def error_description #

[View source]
def execute #

run execution


[View source]
def finalize #

[View source]
def follow_redirects! #

set to follow redirects


[View source]
def free #

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


[View source]
def get_info_double(key) #

[View source]
def get_info_int(key) #

[View source]
def get_info_string(key) #

[View source]
def headers #

[View source]
def headers=(headers : Array(String)) #

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


[View source]
def headers=(headers : Hash(String, String)) #

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


[View source]
def http_status #

[View source]
def interface=(bind : String) #

ex: interface = "127.0.0.1"


[View source]
def local_addr #

[View source]
def max_redirects=(max_redirs : Int32) #

ex: max_redirects = 10


[View source]
def method=(method : String) #

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


[View source]
def namelookup_time #

[View source]
def no_body! #

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


[View source]
def num_connects #

[View source]
def ok? #

[View source]
def proxy=(proxy : String) #

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


[View source]
def redirect_time #

[View source]
def redirects_count #

[View source]
def remote_addr #

[View source]
def resolve=(resolve : Array(String)) #

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


[View source]
def set_opt(opt, val) #

[View source]
def ssl_verifyhost=(flag : Bool) #

ex: ssl_verifyhost = false


[View source]
def ssl_verifypeer=(flag : Bool) #

ex: ssl_verifypeer = false


[View source]
def timeout=(t : Int32 | Time::Span) #

ex: timeout = 60 # seconds


[View source]
def total_time #

[View source]
def url=(url : String) #

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


[View source]
def url_effective #

[View source]
def verbose! #

[View source]