Parent

Methods

Class Index [+]

Quicksearch

Curl::Easy

Public Class Methods

} click to toggle source

Stream the specified url (via perform) and save the data directly to the supplied filename (defaults to the last component of the URL path, which will usually be the filename most simple urls).

If a block is supplied, it will be passed the curl instance prior to the perform call.

Note that the semantics of the on_body handler are subtly changed when using download, to account for the automatic routing of data to the specified file: The data string is passed to the handler before it is written to the file, allowing the handler to perform mutative operations where necessary. As usual, the transfer will be aborted if the on_body handler returns a size that differs from the data chunk size - in this case, the offending chunk will not be written to the file, the file will be closed, and a Curl::Err::AbortedByCallbackError will be raised.

    # File lib/curb.rb, line 26
26:       def download(url, filename = url.split(/\?/).first.split(/\//).last, &blk)
27:         curl = Curl::Easy.new(url, &blk)
28:         
29:         File.open(filename, "wb") do |output|
30:           old_on_body = curl.on_body do |data| 
31:             result = old_on_body ?  old_on_body.call(data) : data.length
32:             output << data if result == data.length
33:             result
34:           end
35:           
36:           curl.perform
37:         end        
38: 
39:         return curl
40:       end
> click to toggle source

Convenience method that creates a new Curl::Easy instance with the specified URL and calls http_delete, before returning the new instance.

If a block is supplied, the new instance will be yielded just prior to the http_delete call.

static VALUE ruby_curl_easy_class_perform_delete(int argc, VALUE *argv, VALUE klass) 
> click to toggle source

Convenience method that creates a new Curl::Easy instance with the specified URL and calls http_get, before returning the new instance.

If a block is supplied, the new instance will be yielded just prior to the http_get call.

static VALUE ruby_curl_easy_class_perform_get(int argc, VALUE *argv, VALUE klass) 
> click to toggle source

Convenience method that creates a new Curl::Easy instance with the specified URL and calls http_head, before returning the new instance.

If a block is supplied, the new instance will be yielded just prior to the http_head call.

static VALUE ruby_curl_easy_class_perform_head(int argc, VALUE *argv, VALUE klass) 
, Curl::PostField) => true click to toggle source

POST the specified formdata to the currently configured URL using the current options set for this Curl::Easy instance. This method always returns true, or raises an exception (defined under Curl::Err) on error.

If you wish to use multipart form encoding, you’ll need to supply a block in order to set multipart_form_post true. See # for more information.

static VALUE ruby_curl_easy_class_perform_post(int argc, VALUE *argv, VALUE klass) 
} click to toggle source

see easy.http_put

static VALUE ruby_curl_easy_class_perform_put(VALUE klass, VALUE url, VALUE data) 
> click to toggle source

Create a new Curl::Easy instance, optionally supplying the URL. The block form allows further configuration to be supplied before the instance is returned.

static VALUE ruby_curl_easy_new(int argc, VALUE *argv, VALUE klass) 
> click to toggle source

Convenience method that creates a new Curl::Easy instance with the specified URL and calls the general perform method, before returning the new instance. For HTTP URLs, this is equivalent to calling http_get.

If a block is supplied, the new instance will be yielded just prior to the http_get call.

static VALUE ruby_curl_easy_class_perform(int argc, VALUE *argv, VALUE klass) 

Public Instance Methods

click to toggle source

easy = Curl::Easy.new easy.autoreferer=true

static VALUE ruby_curl_easy_autoreferer_set(VALUE self, VALUE autoreferer) 
body_str => "response body" click to toggle source

Return the response body from the previous call to perform. This is populated by the default on_body handler - if you supply your own body handler, this string will be empty.

static VALUE ruby_curl_easy_body_str_get(VALUE self) 
cacert => string click to toggle source

Obtain the cacert file to use for this Curl::Easy instance.

static VALUE ruby_curl_easy_cacert_get(VALUE self) 
cacert = string => "" click to toggle source

Set a cacert bundle to use for this Curl::Easy instance. This file will be used to validate SSL certificates.

static VALUE ruby_curl_easy_cacert_set(VALUE self, VALUE cacert) 
cert => string click to toggle source

Obtain the cert file to use for this Curl::Easy instance.

static VALUE ruby_curl_easy_cert_get(VALUE self) 
cert=(cert_file) click to toggle source
    # File lib/curb.rb, line 47
47:     def cert=(cert_file)
48:       pos = cert_file.rindex(':')
49:       if pos && pos > 1
50:         self.native_cert= cert_file[0..pos-1]
51:         self.certpassword= cert_file[pos+1..1]
52:       else
53:         self.native_cert= cert_file
54:       end
55:       self.cert
56:     end
Also aliased as: native_cert=
cert = string => "" click to toggle source

Set a cert file to use for this Curl::Easy instance. This file will be used to validate SSL connections.

static VALUE ruby_curl_easy_cert_set(VALUE self, VALUE cert) 
file" click to toggle source

Obtain the cert key file to use for this Curl::Easy instance.

static VALUE ruby_curl_easy_cert_key_get(VALUE self) 
file" => "" click to toggle source

Set a cert key to use for this Curl::Easy instance. This file will be used to validate SSL certificates.

static VALUE ruby_curl_easy_cert_key_set(VALUE self, VALUE cert_key) 
certpassword = string => "" click to toggle source

Set a password used to open the specified cert

static VALUE ruby_curl_easy_certpassword_set(VALUE self, VALUE certpassword) 
certtype => string click to toggle source

Obtain the cert type used for this Curl::Easy instance

static VALUE ruby_curl_easy_certtype_get(VALUE self) 
certtype = "PEM|DER" => "" click to toggle source

Set a cert type to use for this Curl::Easy instance. Default is PEM

static VALUE ruby_curl_easy_certtype_set(VALUE self, VALUE certtype) 
dup => #<easy clone> click to toggle source

Clone this Curl::Easy instance, creating a new instance. This method duplicates the underlying CURL* handle.

static VALUE ruby_curl_easy_clone(VALUE self) 
Also aliased as: dup
close => nil click to toggle source

Close the Curl::Easy instance. Any open connections are closed The easy handle is reinitialized. If a previous multi handle was open it is set to nil and will be cleared after a GC.

static VALUE ruby_curl_easy_close(VALUE self) 
connect_time => float click to toggle source

Retrieve the time, in seconds, it took from the start until the connect to the remote host (or proxy) was completed.

static VALUE ruby_curl_easy_connect_time_get(VALUE self) 
connect_timeout => fixnum or nil click to toggle source

Obtain the maximum time in seconds that you allow the connection to the server to take.

static VALUE ruby_curl_easy_connect_timeout_get(VALUE self, VALUE connect_timeout) 
connect_timeout = fixnum or nil => fixnum or nil click to toggle source

Set the maximum time in seconds that you allow the connection to the server to take. This only limits the connection phase, once it has connected, this option is of no more use.

Set to nil (or zero) to disable connection timeout (it will then only timeout on the system’s internal timeouts).

static VALUE ruby_curl_easy_connect_timeout_set(VALUE self, VALUE connect_timeout) 
content_type => "content/type" or nil click to toggle source

Retrieve the content-type of the downloaded object. This is the value read from the Content-Type: field. If you get nil, it means that the server didn’t send a valid Content-Type header or that the protocol used doesn’t support this.

static VALUE ruby_curl_easy_content_type_get(VALUE self) 
cookiefile => string click to toggle source

Obtain the cookiefile file for this Curl::Easy instance.

static VALUE ruby_curl_easy_cookiefile_get(VALUE self) 
cookiefile = string => string click to toggle source

Set a file that contains cookies to be sent in subsequent requests by this Curl::Easy instance.

Note that you must set enable_cookies true to enable the cookie engine, or this option will be ignored.

static VALUE ruby_curl_easy_cookiefile_set(VALUE self, VALUE cookiefile) 
cookiejar => string click to toggle source

Obtain the cookiejar file to use for this Curl::Easy instance.

static VALUE ruby_curl_easy_cookiejar_get(VALUE self) 
cookiejar = string => string click to toggle source

Set a cookiejar file to use for this Curl::Easy instance. Cookies from the response will be written into this file.

Note that you must set enable_cookies true to enable the cookie engine, or this option will be ignored.

static VALUE ruby_curl_easy_cookiejar_set(VALUE self, VALUE cookiejar) 
cookies => "name1=content1; name2=content2;" click to toggle source

Obtain the cookies for this Curl::Easy instance.

static VALUE ruby_curl_easy_cookies_get(VALUE self) 
cookies = "name1=content1; name2=content2;" => string click to toggle source

Set cookies to be sent by this Curl::Easy instance. The format of the string should be NAME=CONTENTS, where NAME is the cookie name and CONTENTS is what the cookie should contain. Set multiple cookies in one string like this: “name1=content1; name2=content2;” etc.

static VALUE ruby_curl_easy_cookies_set(VALUE self, VALUE cookies) 
delete=(p1) click to toggle source

call-seq:

 easy = Curl::Easy.new("url") do|c|
  c.delete = true
 end
 easy.perform
 
static VALUE ruby_curl_easy_set_delete_option(VALUE self, VALUE onoff) 
dns_cache_timeout => fixnum or nil click to toggle source

Obtain the dns cache timeout in seconds.

static VALUE ruby_curl_easy_dns_cache_timeout_get(VALUE self, VALUE dns_cache_timeout) 
dns_cache_timeout = fixnum or nil => fixnum or nil click to toggle source

Set the dns cache timeout in seconds. Name resolves will be kept in memory for this number of seconds. Set to zero (0) to completely disable caching, or set to nil (or -1) to make the cached entries remain forever. By default, libcurl caches this info for 60 seconds.

static VALUE ruby_curl_easy_dns_cache_timeout_set(VALUE self, VALUE dns_cache_timeout) 
download_speed => float click to toggle source

Retrieve the average download speed that curl measured for the preceeding complete download.

static VALUE ruby_curl_easy_download_speed_get(VALUE self) 
downloaded_bytes => float click to toggle source

Retrieve the total amount of bytes that were downloaded in the preceeding transfer.

static VALUE ruby_curl_easy_downloaded_bytes_get(VALUE self) 
downloaded_content_length => float click to toggle source

Retrieve the content-length of the download. This is the value read from the Content-Length: field.

static VALUE ruby_curl_easy_downloaded_content_length_get(VALUE self) 
dup() click to toggle source
Alias for: clone
enable_cookies = boolean => boolean click to toggle source

Configure whether the libcurl cookie engine is enabled for this Curl::Easy instance.

static VALUE ruby_curl_easy_enable_cookies_set(VALUE self, VALUE enable_cookies)
{
  CURB_BOOLEAN_SETTER(ruby_curl_easy, enable_cookies);
}
enable_cookies? => boolean click to toggle source

Determine whether the libcurl cookie engine is enabled for this Curl::Easy instance.

static VALUE ruby_curl_easy_enable_cookies_q(VALUE self) 
encoding => string click to toggle source

Get the set encoding types

static VALUE ruby_curl_easy_encoding_get(VALUE self) 
encoding = string => string click to toggle source

Set the accepted encoding types, curl will handle all of the decompression

static VALUE ruby_curl_easy_encoding_set(VALUE self, VALUE encoding) 
escape("some text") => "some%20text" click to toggle source

Convert the given input string to a URL encoded string and return the result. All input characters that are not a-z, A-Z or 0-9 are converted to their “URL escaped” version (%NN where NN is a two-digit hexadecimal number).

static VALUE ruby_curl_easy_escape(VALUE self, VALUE svalue) 
fetch_file_time = boolean => boolean click to toggle source

Configure whether this Curl instance will fetch remote file times, if available.

static VALUE ruby_curl_easy_fetch_file_time_set(VALUE self, VALUE fetch_file_time) 
fetch_file_time? => boolean click to toggle source

Determine whether this Curl instance will fetch remote file times, if available.

static VALUE ruby_curl_easy_fetch_file_time_q(VALUE self) 
file_time => fixnum click to toggle source

Retrieve the remote time of the retrieved document (in number of seconds since 1 jan 1970 in the GMT/UTC time zone). If you get -1, it can be because of many reasons (unknown, the server hides it or the server doesn’t support the command that tells document time etc) and the time of the document is unknown.

Note that you must tell the server to collect this information before the transfer is made, by setting fetch_file_time? to true, or you will unconditionally get a -1 back.

This requires libcurl 7.5 or higher - otherwise -1 is unconditionally returned.

static VALUE ruby_curl_easy_file_time_get(VALUE self) 
follow_location = boolean => boolean click to toggle source

Configure whether this Curl instance will follow Location: headers in HTTP responses. Redirects will only be followed to the extent specified by max_redirects.

static VALUE ruby_curl_easy_follow_location_set(VALUE self, VALUE follow_location) 
follow_location? => boolean click to toggle source

Determine whether this Curl instance will follow Location: headers in HTTP responses.

static VALUE ruby_curl_easy_follow_location_q(VALUE self) 
ftp_commands() click to toggle source

call-seq

  easy.ftp_commands                                => array or nil
static VALUE ruby_curl_easy_ftp_commands_get(VALUE self) 
] click to toggle source

Explicitly sets the list of commands to execute on the FTP server when calling perform

static VALUE ruby_curl_easy_ftp_commands_set(VALUE self, VALUE ftp_commands) 
ftp_entry_path => "C:\ftp\root\" or nil click to toggle source

Retrieve the path of the entry path. That is the initial path libcurl ended up in when logging on to the remote FTP server. This returns nil if something is wrong.

(requires libcurl 7.15.4 or higher, otherwise nil is always returned).

static VALUE ruby_curl_easy_ftp_entry_path_get(VALUE self) 
ftp_filemethod() click to toggle source

call-seq

  easy.ftp_filemethod                              => fixnum

Get the configuration for how libcurl will reach files on the server.

static VALUE ruby_curl_easy_ftp_filemethod_get(VALUE self, VALUE ftp_filemethod) 
ftp_filemethod = value => fixnum or nil click to toggle source

Controls how libcurl reaches files on the server. Valid options are Curl::CURL_MULTICWD, Curl::CURL_NOCWD, and Curl::CURL_SINGLECWD (see libcurl docs for CURLOPT_FTP_METHOD).

static VALUE ruby_curl_easy_ftp_filemethod_set(VALUE self, VALUE ftp_filemethod) 
ftp_response_timeout => fixnum or nil click to toggle source

Obtain the maximum time that libcurl will wait for FTP command responses.

static VALUE ruby_curl_easy_ftp_response_timeout_get(VALUE self, VALUE ftp_response_timeout) 
ftp_response_timeout = fixnum or nil => fixnum or nil click to toggle source

Set a timeout period (in seconds) on the amount of time that the server is allowed to take in order to generate a response message for a command before the session is considered hung. While curl is waiting for a response, this value overrides timeout. It is recommended that if used in conjunction with timeout, you set ftp_response_timeout to a value smaller than timeout.

Ignored if libcurl version is < 7.10.8.

static VALUE ruby_curl_easy_ftp_response_timeout_set(VALUE self, VALUE ftp_response_timeout) 
head=(p1) click to toggle source

call-seq:

 easy = Curl::Easy.new("url") do|c|
  c.head = true
 end
 easy.perform
 
static VALUE ruby_curl_easy_set_head_option(VALUE self, VALUE onoff) 
header_in_body = boolean => boolean click to toggle source

Configure whether this Curl instance will return HTTP headers combined with body data. If this option is set true, both header and body data will go to body_str (or the configured on_body handler).

static VALUE ruby_curl_easy_header_in_body_set(VALUE self, VALUE header_in_body) 
header_in_body? => boolean click to toggle source

Determine whether this Curl instance will verify the SSL peer certificate.

static VALUE ruby_curl_easy_header_in_body_q(VALUE self) 
header_size => fixnum click to toggle source

Retrieve the total size of all the headers received in the preceeding transfer.

static VALUE ruby_curl_easy_header_size_get(VALUE self) 
header_str => "response header" click to toggle source

Return the response header from the previous call to perform. This is populated by the default on_header handler - if you supply your own header handler, this string will be empty.

static VALUE ruby_curl_easy_header_str_get(VALUE self) 
headers => Hash, Array or Str click to toggle source

Obtain the custom HTTP headers for following requests.

static VALUE ruby_curl_easy_headers_get(VALUE self) 
] click to toggle source

Set custom HTTP headers for following requests. This can be used to add custom headers, or override standard headers used by libcurl. It defaults to a Hash.

For example to set a standard or custom header:

   easy.headers["MyHeader"] = "myval"

To remove a standard header (this is useful when removing libcurls default ‘Expect: 100-Continue’ header when using HTTP form posts):

   easy.headers["Expect:"] = ''

Anything passed to libcurl as a header will be converted to a string during the perform step.

static VALUE ruby_curl_easy_headers_set(VALUE self, VALUE headers) 
http(verb) click to toggle source

Send an HTTP request with method set to verb, using the current options set for this Curl::Easy instance. This method always returns true or raises an exception (defined under Curl::Err) on error.

static VALUE ruby_curl_easy_perform_verb(VALUE self, VALUE verb) 
http_auth_types => fixnum or nil click to toggle source

Obtain the HTTP authentication types that may be used for the following perform calls.

static VALUE ruby_curl_easy_http_auth_types_get(VALUE self) 
http_auth_types = [:basic,:digest,:digest_ie,:gssnegotiate, :ntlm, :any, :anysafe] click to toggle source

Set the HTTP authentication types that may be used for the following perform calls. This is a bitmap made by ORing together the Curl::CURLAUTH constants.

static VALUE ruby_curl_easy_http_auth_types_set(int argc, VALUE *argv, VALUE self) 
http_connect_code => fixnum click to toggle source

Retrieve the last received proxy response code to a CONNECT request.

static VALUE ruby_curl_easy_http_connect_code_get(VALUE self) 
http_delete click to toggle source

DELETE the currently configured URL using the current options set for this Curl::Easy instance. This method always returns true, or raises an exception (defined under Curl::Err) on error.

static VALUE ruby_curl_easy_perform_delete(VALUE self) 
http_get => true click to toggle source

GET the currently configured URL using the current options set for this Curl::Easy instance. This method always returns true, or raises an exception (defined under Curl::Err) on error.

static VALUE ruby_curl_easy_perform_get(VALUE self) 
http_head => true click to toggle source

Request headers from the currently configured URL using the HEAD method and current options set for this Curl::Easy instance. This method always returns true, or raises an exception (defined under Curl::Err) on error.

static VALUE ruby_curl_easy_perform_head(VALUE self) 
, Curl::PostField) => true click to toggle source

POST the specified formdata to the currently configured URL using the current options set for this Curl::Easy instance. This method always returns true, or raises an exception (defined under Curl::Err) on error.

The Content-type of the POST is determined by the current setting of multipart_form_post? , according to the following rules:

  • When false (the default): the form will be POSTed with a content-type of ‘application/x-www-form-urlencoded’, and any of the four calling forms may be used.

  • When true: the form will be POSTed with a content-type of ‘multipart/formdata’. Only the last calling form may be used, i.e. only PostField instances may be POSTed. In this mode, individual fields’ content-types are recognised, and file upload fields are supported.

static VALUE ruby_curl_easy_perform_post(int argc, VALUE *argv, VALUE self) 
http_put(data) => true click to toggle source

PUT the supplied data to the currently configured URL using the current options set for this Curl::Easy instance. This method always returns true, or raises an exception (defined under Curl::Err) on error.

static VALUE ruby_curl_easy_perform_put(VALUE self, VALUE data) 
inspect() click to toggle source

call-seq:

  easy.inspect                                     => "#<Curl::Easy http://google.com/>"
static VALUE ruby_curl_easy_inspect(VALUE self) 
interface => string click to toggle source

Obtain the interface name that is used as the outgoing network interface. The name can be an interface name, an IP address or a host name.

static VALUE ruby_curl_easy_interface_get(VALUE self) 
interface = string => string click to toggle source

Set the interface name to use as the outgoing network interface. The name can be an interface name, an IP address or a host name.

static VALUE ruby_curl_easy_interface_set(VALUE self, VALUE interface_hm) 
url" or nil click to toggle source

Retrieve the last effective URL used by this instance. This is the URL used in the last perform call, and may differ from the value of easy.url.

static VALUE ruby_curl_easy_last_effective_url_get(VALUE self) 
local_port => fixnum or nil click to toggle source

Obtain the local port that will be used for the following perform calls.

This option is ignored if compiled against libcurl < 7.15.2.

static VALUE ruby_curl_easy_local_port_get(VALUE self) 
local_port = fixnum or nil => fixnum or nil click to toggle source

Set the local port that will be used for the following perform calls.

Passing nil will return to the default behaviour (no local port preference).

This option is ignored if compiled against libcurl < 7.15.2.

static VALUE ruby_curl_easy_local_port_set(VALUE self, VALUE local_port) 
local_port_range => fixnum or nil click to toggle source

Obtain the local port range that will be used for the following perform calls.

This option is ignored if compiled against libcurl < 7.15.2.

static VALUE ruby_curl_easy_local_port_range_get(VALUE self) 
local_port_range = fixnum or nil => fixnum or nil click to toggle source

Set the local port range that will be used for the following perform calls. This is a number (between 0 and 65535) that determines how far libcurl may deviate from the supplied local_port in order to find an available port.

If you set local_port it’s also recommended that you set this, since it is fairly likely that your specified port will be unavailable.

This option is ignored if compiled against libcurl < 7.15.2.

static VALUE ruby_curl_easy_local_port_range_set(VALUE self, VALUE local_port_range) 
max_redirects => fixnum or nil click to toggle source

Obtain the maximum number of redirections to follow in the following perform calls.

static VALUE ruby_curl_easy_max_redirects_get(VALUE self) 
max_redirects = fixnum or nil => fixnum or nil click to toggle source

Set the maximum number of redirections to follow in the following perform calls. Set to nil or -1 allow an infinite number (the default). Setting this option only makes sense if follow_location is also set true.

With libcurl >= 7.15.1, setting this to 0 will cause libcurl to refuse any redirect.

static VALUE ruby_curl_easy_max_redirects_set(VALUE self, VALUE max_redirs) 
multipart_form_post = boolean => boolean click to toggle source

Configure whether this Curl instance uses multipart/formdata content type for HTTP POST requests. If this is false (the default), then the application/x-www-form-urlencoded content type is used for the form data.

If this is set true, you must pass one or more PostField instances to the http_post method - no support for posting multipart forms from a string is provided.

static VALUE ruby_curl_easy_multipart_form_post_set(VALUE self, VALUE multipart_form_post)
{
  CURB_BOOLEAN_SETTER(ruby_curl_easy, multipart_form_post);
}
multipart_form_post? => boolean click to toggle source

Determine whether this Curl instance uses multipart/formdata content type for HTTP POST requests.

static VALUE ruby_curl_easy_multipart_form_post_q(VALUE self) 
name_lookup_time => float click to toggle source

Retrieve the time, in seconds, it took from the start until the name resolving was completed.

static VALUE ruby_curl_easy_name_lookup_time_get(VALUE self) 
native_cert=(cert_file) click to toggle source

Allow the incoming cert string to be file:password but be careful to not use a colon from a windows file path as the split point. Mimic what curl’s main does

Alias for: cert=
click to toggle source

easy = Curl::Easy.new easy.nosignal = true

static VALUE ruby_curl_easy_set_nosignal(VALUE self, VALUE onoff) 
num_connects => integer click to toggle source

Retrieve the number of new connections libcurl had to create to achieve the previous transfer (only the successful connects are counted). Combined with redirect_count you are able to know how many times libcurl successfully reused existing connection(s) or not.

See the Connection Options of curl_easy_setopt(3) to see how libcurl tries to make persistent connections to save time.

(requires libcurl 7.12.3 or higher, otherwise -1 is always returned).

static VALUE ruby_curl_easy_num_connects_get(VALUE self) 
} => <old handler> click to toggle source

Assign or remove the on_body handler for this Curl::Easy instance. To remove a previously-supplied handler, call this method with no attached block.

The on_body handler is called for each chunk of response body passed back by libcurl during perform. It should perform any processing necessary, and return the actual number of bytes handled. Normally, this will equal the length of the data string, and CURL will continue processing. If the returned length does not equal the input length, CURL will abort the processing with a Curl::Err::AbortedByCallbackError.

static VALUE ruby_curl_easy_on_body_set(int argc, VALUE *argv, VALUE self) 
} => <old handler> click to toggle source

Assign or remove the on_complete handler for this Curl::Easy instance. To remove a previously-supplied handler, call this method with no attached block.

The on_complete handler is called when the request is finished.

static VALUE ruby_curl_easy_on_complete_set(int argc, VALUE *argv, VALUE self) 
} => <old handler> click to toggle source

Assign or remove the on_debug handler for this Curl::Easy instance. To remove a previously-supplied handler, call this method with no attached block.

The on_debug handler, if configured, will receive detailed information from libcurl during the perform call. This can be useful for debugging. Setting a debug handler overrides libcurl’s internal handler, disabling any output from verbose, if set.

The type argument will match one of the Curl::Easy::CURLINFO_XXXX constants, and specifies the kind of information contained in the data. The data is passed as a String.

static VALUE ruby_curl_easy_on_debug_set(int argc, VALUE *argv, VALUE self) 
} => <old handler> click to toggle source

Assign or remove the on_failure handler for this Curl::Easy instance. To remove a previously-supplied handler, call this method with no attached block.

The on_failure handler is called when the request is finished with a status of 50x

static VALUE ruby_curl_easy_on_failure_set(int argc, VALUE *argv, VALUE self) 
} => <old handler> click to toggle source

Assign or remove the on_header handler for this Curl::Easy instance. To remove a previously-supplied handler, call this method with no attached block.

The on_header handler is called for each chunk of response header passed back by libcurl during perform. The semantics are the same as for the block supplied to on_body.

static VALUE ruby_curl_easy_on_header_set(int argc, VALUE *argv, VALUE self) 
} => <old handler> click to toggle source

Assign or remove the on_progress handler for this Curl::Easy instance. To remove a previously-supplied handler, call this method with no attached block.

The on_progress handler is called regularly by libcurl (approximately once per second) during transfers to allow the application to receive progress information. There is no guarantee that the reported progress will change between calls.

The result of the block call determines whether libcurl continues the transfer. Returning a non-true value (i.e. nil or false) will cause the transfer to abort, throwing a Curl::Err::AbortedByCallbackError.

static VALUE ruby_curl_easy_on_progress_set(int argc, VALUE *argv, VALUE self) 
} => <old handler> click to toggle source

Assign or remove the on_success handler for this Curl::Easy instance. To remove a previously-supplied handler, call this method with no attached block.

The on_success handler is called when the request is finished with a status of 20x

static VALUE ruby_curl_easy_on_success_set(int argc, VALUE *argv, VALUE self) 
os_errno => integer click to toggle source

Retrieve the errno variable from a connect failure (requires libcurl 7.12.2 or higher, otherwise 0 is always returned).

static VALUE ruby_curl_easy_os_errno_get(VALUE self) 
password => string click to toggle source

Get the current password

static VALUE ruby_curl_easy_password_get(VALUE self, VALUE password) 
password = string => string click to toggle source

Set the HTTP Authentication password.

static VALUE ruby_curl_easy_password_set(VALUE self, VALUE password) 
perform => true click to toggle source

Transfer the currently configured URL using the options set for this Curl::Easy instance. If this is an HTTP URL, it will be transferred via the GET or HEAD request method.

static VALUE ruby_curl_easy_perform(VALUE self) 
post_body => string or nil click to toggle source

Obtain the POST body used in this Curl::Easy instance.

static VALUE ruby_curl_easy_post_body_get(VALUE self) 
post_body = "some=form%20data&to=send" => string or nil click to toggle source

Sets the POST body of this Curl::Easy instance. This is expected to be URL encoded; no additional processing or encoding is done on the string. The content-type header will be set to application/x-www-form-urlencoded.

This is handy if you want to perform a POST against a Curl::Multi instance.

static VALUE ruby_curl_easy_post_body_set(VALUE self, VALUE post_body) 
pre_transfer_time => float click to toggle source

Retrieve the time, in seconds, it took from the start until the file transfer is just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved.

static VALUE ruby_curl_easy_pre_transfer_time_get(VALUE self) 
xx" or nil click to toggle source

Retrieve the resolved IP of the most recent connection done with this curl handle. This string may be IPv6 if that’s enabled. This feature requires curl 7.19.x and above

static VALUE ruby_curl_easy_primary_ip_get(VALUE self) 
proxy_auth_types => fixnum or nil click to toggle source

Obtain the proxy authentication types that may be used for the following perform calls.

static VALUE ruby_curl_easy_proxy_auth_types_get(VALUE self) 
proxy_auth_types = fixnum or nil => fixnum or nil click to toggle source

Set the proxy authentication types that may be used for the following perform calls. This is a bitmap made by ORing together the Curl::CURLAUTH constants.

static VALUE ruby_curl_easy_proxy_auth_types_set(VALUE self, VALUE proxy_auth_types) 
proxy_port => fixnum or nil click to toggle source

Obtain the proxy port that will be used for the following perform calls.

static VALUE ruby_curl_easy_proxy_port_get(VALUE self) 
proxy_port = fixnum or nil => fixnum or nil click to toggle source

Set the proxy port that will be used for the following perform calls.

static VALUE ruby_curl_easy_proxy_port_set(VALUE self, VALUE proxy_port) 
proxy_tunnel = boolean => boolean click to toggle source

Configure whether this Curl instance will use proxy tunneling.

static VALUE ruby_curl_easy_proxy_tunnel_set(VALUE self, VALUE proxy_tunnel) 
proxy_tunnel? => boolean click to toggle source

Determine whether this Curl instance will use proxy tunneling.

static VALUE ruby_curl_easy_proxy_tunnel_q(VALUE self) 
proxy_type => fixnum or nil click to toggle source

Obtain the proxy type that will be used for the following perform calls.

static VALUE ruby_curl_easy_proxy_type_get(VALUE self) 
proxy_type = fixnum or nil => fixnum or nil click to toggle source

Set the proxy type that will be used for the following perform calls. This should be one of the Curl::CURLPROXY constants.

static VALUE ruby_curl_easy_proxy_type_set(VALUE self, VALUE proxy_type) 
proxy_url => string click to toggle source

Obtain the HTTP Proxy URL that will be used by subsequent calls to perform.

static VALUE ruby_curl_easy_proxy_url_get(VALUE self) 
proxy_url = string => string click to toggle source

Set the URL of the HTTP proxy to use for subsequent calls to perform. The URL should specify the the host name or dotted IP address. To specify port number in this string, append :[port] to the end of the host name. The proxy string may be prefixed with [protocol]:// since any such prefix will be ignored. The proxy’s port number may optionally be specified with the separate option proxy_port .

When you tell the library to use an HTTP proxy, libcurl will transparently convert operations to HTTP even if you specify an FTP URL etc. This may have an impact on what other features of the library you can use, such as FTP specifics that don’t work unless you tunnel through the HTTP proxy. Such tunneling is activated with proxy_tunnel = true.

libcurl respects the environment variables http_proxy, ftp_proxy, all_proxy etc, if any of those is set. The proxy_url option does however override any possibly set environment variables.

Starting with libcurl 7.14.1, the proxy host string given in environment variables can be specified the exact same way as the proxy can be set with proxy_url, including protocol prefix (http://) and embedded user + password.

 
static VALUE ruby_curl_easy_proxy_url_set(VALUE self, VALUE proxy_url) 
proxypwd => string click to toggle source

Obtain the username/password string that will be used for proxy connection during subsequent calls to perform. The supplied string should have the form “username:password“

static VALUE ruby_curl_easy_proxypwd_get(VALUE self) 
proxypwd = string => string click to toggle source

Set the username/password string to use for proxy connection during subsequent calls to perform. The supplied string should have the form “username:password“

static VALUE ruby_curl_easy_proxypwd_set(VALUE self, VALUE proxypwd) 
put_data = data => "" click to toggle source

Points this Curl::Easy instance to data to be uploaded via PUT. This sets the request to a PUT type request - useful if you want to PUT via a multi handle.

static VALUE ruby_curl_easy_put_data_set(VALUE self, VALUE data) 
redirect_count => integer click to toggle source

Retrieve the total number of redirections that were actually followed.

Requires libcurl 7.9.7 or higher, otherwise -1 is always returned.

static VALUE ruby_curl_easy_redirect_count_get(VALUE self) 
redirect_time => float click to toggle source

Retrieve the total time, in seconds, it took for all redirection steps include name lookup, connect, pretransfer and transfer before final transaction was started. redirect_time contains the complete execution time for multiple redirections.

Requires libcurl 7.9.7 or higher, otherwise -1 is always returned.

static VALUE ruby_curl_easy_redirect_time_get(VALUE self) 
request_size => fixnum click to toggle source

Retrieve the total size of the issued requests. This is so far only for HTTP requests. Note that this may be more than one request if follow_location? is true.

static VALUE ruby_curl_easy_request_size_get(VALUE self) 
reset => Hash click to toggle source

Reset the Curl::Easy instance, clears out all settings.

from curl.haxx.se/libcurl/c/curl_easy_reset.html Re-initializes all options previously set on a specified CURL handle to the default values. This puts back the handle to the same state as it was in when it was just created with curl_easy_init(3). It does not change the following information kept in the handle: live connections, the Session ID cache, the DNS cache, the cookies and shares.

The return value contains all settings stored.

static VALUE ruby_curl_easy_reset(VALUE self) 
response_code => fixnum click to toggle source

Retrieve the last received HTTP or FTP code. This will be zero if no server response code has been received. Note that a proxy’s CONNECT response should be read with http_connect_code and not this method.

static VALUE ruby_curl_easy_response_code_get(VALUE self) 
ssl_verify_host = boolean => boolean click to toggle source

Configure whether this Curl instance will verify that the server cert is for the server it is known as. When true (the default) the server certificate must indicate that the server is the server to which you meant to connect, or the connection fails. When false, the connection will succeed regardless of the names in the certificate.

this option controls is of the identity that the server claims. The server could be lying. To control lying, see ssl_verify_peer? .

static VALUE ruby_curl_easy_ssl_verify_host_set(VALUE self, VALUE ssl_verify_host) 
ssl_verify_host? => boolean click to toggle source

Determine whether this Curl instance will verify that the server cert is for the server it is known as.

static VALUE ruby_curl_easy_ssl_verify_host_q(VALUE self) 
ssl_verify_peer = boolean => boolean click to toggle source

Configure whether this Curl instance will verify the SSL peer certificate. When true (the default), and the verification fails to prove that the certificate is authentic, the connection fails. When false, the connection succeeds regardless.

Authenticating the certificate is not by itself very useful. You typically want to ensure that the server, as authentically identified by its certificate, is the server you mean to be talking to. The ssl_verify_host? options controls that.

static VALUE ruby_curl_easy_ssl_verify_peer_set(VALUE self, VALUE ssl_verify_peer) 
ssl_verify_peer? => boolean click to toggle source

Determine whether this Curl instance will verify the SSL peer certificate.

static VALUE ruby_curl_easy_ssl_verify_peer_q(VALUE self) 
ssl_verify_result => integer click to toggle source

Retrieve the result of the certification verification that was requested (by setting ssl_verify_peer? to true).

static VALUE ruby_curl_easy_ssl_verify_result_get(VALUE self) 
ssl_version => fixnum click to toggle source

Get the version of SSL/TLS that libcurl will attempt to use.

static VALUE ruby_curl_easy_ssl_version_get(VALUE self, VALUE ssl_version) 
ssl_version = value => fixnum or nil click to toggle source

Sets the version of SSL/TLS that libcurl will attempt to use. Valid options are Curl::CURL_SSLVERSION_TLSv1, Curl::CURL_SSLVERSION::SSLv2, Curl::CURL_SSLVERSION_SSLv3 and Curl::CURL_SSLVERSION_DEFAULT

static VALUE ruby_curl_easy_ssl_version_set(VALUE self, VALUE ssl_version) 
start_transfer_time => float click to toggle source

Retrieve the time, in seconds, it took from the start until the first byte is just about to be transferred. This includes the pre_transfer_time and also the time the server needs to calculate the result.

static VALUE ruby_curl_easy_start_transfer_time_get(VALUE self) 
timeout => fixnum or nil click to toggle source

Obtain the maximum time in seconds that you allow the libcurl transfer operation to take.

static VALUE ruby_curl_easy_timeout_get(VALUE self, VALUE timeout) 
timeout = fixnum or nil => fixnum or nil click to toggle source

Set the maximum time in seconds that you allow the libcurl transfer operation to take. Normally, name lookups can take a considerable time and limiting operations to less than a few minutes risk aborting perfectly normal operations.

Set to nil (or zero) to disable timeout (it will then only timeout on the system’s internal timeouts).

static VALUE ruby_curl_easy_timeout_set(VALUE self, VALUE timeout) 
total_time => float click to toggle source

Retrieve the total time in seconds for the previous transfer, including name resolving, TCP connect etc.

static VALUE ruby_curl_easy_total_time_get(VALUE self) 
unescape("some%20text") => "some text" click to toggle source

Convert the given URL encoded input string to a “plain string” and return the result. All input characters that are URL encoded (%XX where XX is a two-digit hexadecimal number) are converted to their binary versions.

static VALUE ruby_curl_easy_unescape(VALUE self, VALUE str) 
unrestricted_auth = boolean => boolean click to toggle source

Configure whether this Curl instance may use any HTTP authentication method available when necessary.

static VALUE ruby_curl_easy_unrestricted_auth_set(VALUE self, VALUE unrestricted_auth) 
unrestricted_auth? => boolean click to toggle source

Determine whether this Curl instance may use any HTTP authentication method available when necessary.

static VALUE ruby_curl_easy_unrestricted_auth_q(VALUE self) 
upload_speed => float click to toggle source

Retrieve the average upload speed that curl measured for the preceeding complete upload.

static VALUE ruby_curl_easy_upload_speed_get(VALUE self) 
uploaded_bytes => float click to toggle source

Retrieve the total amount of bytes that were uploaded in the preceeding transfer.

static VALUE ruby_curl_easy_uploaded_bytes_get(VALUE self) 
uploaded_content_length => float click to toggle source

Retrieve the content-length of the upload.

static VALUE ruby_curl_easy_uploaded_content_length_get(VALUE self) 
url => string click to toggle source

Obtain the URL that will be used by subsequent calls to perform.

static VALUE ruby_curl_easy_url_get(VALUE self) 
url/" click to toggle source

Set the URL for subsequent calls to perform. It is acceptable (and even recommended) to reuse Curl::Easy instances by reassigning the URL between calls to perform.

static VALUE ruby_curl_easy_url_set(VALUE self, VALUE url) 
use_netrc = boolean => boolean click to toggle source

Configure whether this Curl instance will use data from the user’s .netrc file for FTP connections.

static VALUE ruby_curl_easy_use_netrc_set(VALUE self, VALUE use_netrc) 
use_netrc? => boolean click to toggle source

Determine whether this Curl instance will use data from the user’s .netrc file for FTP connections.

static VALUE ruby_curl_easy_use_netrc_q(VALUE self) 
use_ssl => fixnum click to toggle source

Get the desired level for using SSL on FTP connections.

static VALUE ruby_curl_easy_use_ssl_get(VALUE self, VALUE use_ssl) 
use_ssl = value => fixnum or nil click to toggle source

Ensure libcurl uses SSL for FTP connections. Valid options are Curl::CURL_USESSL_NONE, Curl::CURL_USESSL_TRY, Curl::CURL_USESSL_CONTROL, and Curl::CURL_USESSL_ALL.

static VALUE ruby_curl_easy_use_ssl_set(VALUE self, VALUE use_ssl) 
useragent => "Ruby/Curb" click to toggle source

Obtain the user agent string used for this Curl::Easy instance

static VALUE ruby_curl_easy_useragent_get(VALUE self) 
useragent = "Ruby/Curb" => "" click to toggle source

Set the user agent string for this Curl::Easy instance

static VALUE ruby_curl_easy_useragent_set(VALUE self, VALUE useragent) 
username => string click to toggle source

Get the current username

static VALUE ruby_curl_easy_username_get(VALUE self, VALUE username) 
username = string => string click to toggle source

Set the HTTP Authentication username.

static VALUE ruby_curl_easy_username_set(VALUE self, VALUE username) 
userpwd => string click to toggle source

Obtain the username/password string that will be used for subsequent calls to perform.

static VALUE ruby_curl_easy_userpwd_get(VALUE self) 
userpwd = string => string click to toggle source

Set the username/password string to use for subsequent calls to perform. The supplied string should have the form “username:password“

static VALUE ruby_curl_easy_userpwd_set(VALUE self, VALUE userpwd) 
verbose = boolean => boolean click to toggle source

Configure whether this Curl instance gives verbose output to STDERR during transfers. Ignored if this instance has an on_debug handler.

static VALUE ruby_curl_easy_verbose_set(VALUE self, VALUE verbose) 
verbose? => boolean click to toggle source

Determine whether this Curl instance gives verbose output to STDERR during transfers.

static VALUE ruby_curl_easy_verbose_q(VALUE self) 
click to toggle source

easy = Curl::Easy.new(“url”) easy.version = Curl::HTTP_1_1 easy.version = Curl::HTTP_1_0 easy.version = Curl::HTTP_NONE

static VALUE ruby_curl_easy_set_version(VALUE self, VALUE version) 

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.