[−][src]Struct curl::easy::Easy
Raw bindings to a libcurl "easy session".
This type is the same as the Easy2
type in this library except that it
does not contain a type parameter. Callbacks from curl are all controlled
via closures on this Easy
type, and this type namely has a transfer
method as well for ergonomic management of these callbacks.
There's not necessarily a right answer for which type is correct to use, but
as a general rule of thumb Easy
is typically a reasonable choice for
synchronous I/O and Easy2
is a good choice for asynchronous I/O.
Examples
Creating a handle which can be used later
use curl::easy::Easy; let handle = Easy::new();
Send an HTTP request, writing the response to stdout.
use std::io::{stdout, Write}; use curl::easy::Easy; let mut handle = Easy::new(); handle.url("https://www.rust-lang.org/").unwrap(); handle.write_function(|data| { stdout().write_all(data).unwrap(); Ok(data.len()) }).unwrap(); handle.perform().unwrap();
Collect all output of an HTTP request to a vector.
use curl::easy::Easy; let mut data = Vec::new(); let mut handle = Easy::new(); handle.url("https://www.rust-lang.org/").unwrap(); { let mut transfer = handle.transfer(); transfer.write_function(|new_data| { data.extend_from_slice(new_data); Ok(new_data.len()) }).unwrap(); transfer.perform().unwrap(); } println!("{:?}", data);
More examples of various properties of an HTTP request can be found on the specific methods as well.
Methods
impl Easy
[src]
pub fn new() -> Easy
[src]
Creates a new "easy" handle which is the core of almost all operations in libcurl.
To use a handle, applications typically configure a number of options
followed by a call to perform
. Options are preserved across calls to
perform
and need to be reset manually (or via the reset
method) if
this is not desired.
pub fn verbose(&mut self, verbose: bool) -> Result<(), Error>
[src]
Same as Easy2::verbose
pub fn show_header(&mut self, show: bool) -> Result<(), Error>
[src]
Same as Easy2::show_header
pub fn progress(&mut self, progress: bool) -> Result<(), Error>
[src]
Same as Easy2::progress
pub fn signal(&mut self, signal: bool) -> Result<(), Error>
[src]
Same as Easy2::signal
pub fn wildcard_match(&mut self, m: bool) -> Result<(), Error>
[src]
Same as Easy2::wildcard_match
pub fn unix_socket(&mut self, unix_domain_socket: &str) -> Result<(), Error>
[src]
Same as Easy2::unix_socket
pub fn write_function<F>(&mut self, f: F) -> Result<(), Error> where
F: FnMut(&[u8]) -> Result<usize, WriteError> + Send + 'static,
[src]
F: FnMut(&[u8]) -> Result<usize, WriteError> + Send + 'static,
Set callback for writing received data.
This callback function gets called by libcurl as soon as there is data received that needs to be saved.
The callback function will be passed as much data as possible in all
invokes, but you must not make any assumptions. It may be one byte, it
may be thousands. If show_header
is enabled, which makes header data
get passed to the write callback, you can get up to
CURL_MAX_HTTP_HEADER
bytes of header data passed into it. This
usually means 100K.
This function may be called with zero bytes data if the transferred file is empty.
The callback should return the number of bytes actually taken care of.
If that amount differs from the amount passed to your callback function,
it'll signal an error condition to the library. This will cause the
transfer to get aborted and the libcurl function used will return
an error with is_write_error
.
If your callback function returns Err(WriteError::Pause)
it will cause
this transfer to become paused. See unpause_write
for further details.
By default data is sent into the void, and this corresponds to the
CURLOPT_WRITEFUNCTION
and CURLOPT_WRITEDATA
options.
Note that the lifetime bound on this function is 'static
, but that
is often too restrictive. To use stack data consider calling the
transfer
method and then using write_function
to configure a
callback that can reference stack-local data.
Examples
use std::io::{stdout, Write}; use curl::easy::Easy; let mut handle = Easy::new(); handle.url("https://www.rust-lang.org/").unwrap(); handle.write_function(|data| { Ok(stdout().write(data).unwrap()) }).unwrap(); handle.perform().unwrap();
Writing to a stack-local buffer
use std::io::{stdout, Write}; use curl::easy::Easy; let mut buf = Vec::new(); let mut handle = Easy::new(); handle.url("https://www.rust-lang.org/").unwrap(); let mut transfer = handle.transfer(); transfer.write_function(|data| { buf.extend_from_slice(data); Ok(data.len()) }).unwrap(); transfer.perform().unwrap();
pub fn read_function<F>(&mut self, f: F) -> Result<(), Error> where
F: FnMut(&mut [u8]) -> Result<usize, ReadError> + Send + 'static,
[src]
F: FnMut(&mut [u8]) -> Result<usize, ReadError> + Send + 'static,
Read callback for data uploads.
This callback function gets called by libcurl as soon as it needs to read data in order to send it to the peer - like if you ask it to upload or post data to the server.
Your function must then return the actual number of bytes that it stored in that memory area. Returning 0 will signal end-of-file to the library and cause it to stop the current transfer.
If you stop the current transfer by returning 0 "pre-maturely" (i.e before the server expected it, like when you've said you will upload N bytes and you upload less than N bytes), you may experience that the server "hangs" waiting for the rest of the data that won't come.
The read callback may return Err(ReadError::Abort)
to stop the
current operation immediately, resulting in a is_aborted_by_callback
error code from the transfer.
The callback can return Err(ReadError::Pause)
to cause reading from
this connection to pause. See unpause_read
for further details.
By default data not input, and this corresponds to the
CURLOPT_READFUNCTION
and CURLOPT_READDATA
options.
Note that the lifetime bound on this function is 'static
, but that
is often too restrictive. To use stack data consider calling the
transfer
method and then using read_function
to configure a
callback that can reference stack-local data.
Examples
Read input from stdin
use std::io::{stdin, Read}; use curl::easy::Easy; let mut handle = Easy::new(); handle.url("https://example.com/login").unwrap(); handle.read_function(|into| { Ok(stdin().read(into).unwrap()) }).unwrap(); handle.post(true).unwrap(); handle.perform().unwrap();
Reading from stack-local data:
use std::io::{stdin, Read}; use curl::easy::Easy; let mut data_to_upload = &b"foobar"[..]; let mut handle = Easy::new(); handle.url("https://example.com/login").unwrap(); handle.post(true).unwrap(); let mut transfer = handle.transfer(); transfer.read_function(|into| { Ok(data_to_upload.read(into).unwrap()) }).unwrap(); transfer.perform().unwrap();
pub fn seek_function<F>(&mut self, f: F) -> Result<(), Error> where
F: FnMut(SeekFrom) -> SeekResult + Send + 'static,
[src]
F: FnMut(SeekFrom) -> SeekResult + Send + 'static,
User callback for seeking in input stream.
This function gets called by libcurl to seek to a certain position in the input stream and can be used to fast forward a file in a resumed upload (instead of reading all uploaded bytes with the normal read function/callback). It is also called to rewind a stream when data has already been sent to the server and needs to be sent again. This may happen when doing a HTTP PUT or POST with a multi-pass authentication method, or when an existing HTTP connection is reused too late and the server closes the connection.
The callback function must return SeekResult::Ok
on success,
SeekResult::Fail
to cause the upload operation to fail or
SeekResult::CantSeek
to indicate that while the seek failed, libcurl
is free to work around the problem if possible. The latter can sometimes
be done by instead reading from the input or similar.
By default data this option is not set, and this corresponds to the
CURLOPT_SEEKFUNCTION
and CURLOPT_SEEKDATA
options.
Note that the lifetime bound on this function is 'static
, but that
is often too restrictive. To use stack data consider calling the
transfer
method and then using seek_function
to configure a
callback that can reference stack-local data.
pub fn progress_function<F>(&mut self, f: F) -> Result<(), Error> where
F: FnMut(f64, f64, f64, f64) -> bool + Send + 'static,
[src]
F: FnMut(f64, f64, f64, f64) -> bool + Send + 'static,
Callback to progress meter function
This function gets called by libcurl instead of its internal equivalent with a frequent interval. While data is being transferred it will be called very frequently, and during slow periods like when nothing is being transferred it can slow down to about one call per second.
The callback gets told how much data libcurl will transfer and has transferred, in number of bytes. The first argument is the total number of bytes libcurl expects to download in this transfer. The second argument is the number of bytes downloaded so far. The third argument is the total number of bytes libcurl expects to upload in this transfer. The fourth argument is the number of bytes uploaded so far.
Unknown/unused argument values passed to the callback will be set to zero (like if you only download data, the upload size will remain 0). Many times the callback will be called one or more times first, before it knows the data sizes so a program must be made to handle that.
Returning false
from this callback will cause libcurl to abort the
transfer and return is_aborted_by_callback
.
If you transfer data with the multi interface, this function will not be called during periods of idleness unless you call the appropriate libcurl function that performs transfers.
progress
must be set to true
to make this function actually get
called.
By default this function calls an internal method and corresponds to
CURLOPT_PROGRESSFUNCTION
and CURLOPT_PROGRESSDATA
.
Note that the lifetime bound on this function is 'static
, but that
is often too restrictive. To use stack data consider calling the
transfer
method and then using progress_function
to configure a
callback that can reference stack-local data.
pub fn ssl_ctx_function<F>(&mut self, f: F) -> Result<(), Error> where
F: FnMut(*mut c_void) -> Result<(), Error> + Send + 'static,
[src]
F: FnMut(*mut c_void) -> Result<(), Error> + Send + 'static,
Callback to SSL context
This callback function gets called by libcurl just before the
initialization of an SSL connection after having processed all
other SSL related options to give a last chance to an
application to modify the behaviour of the SSL
initialization. The ssl_ctx
parameter is actually a pointer
to the SSL library's SSL_CTX. If an error is returned from the
callback no attempt to establish a connection is made and the
perform operation will return the callback's error code.
This function will get called on all new connections made to a server, during the SSL negotiation. The SSL_CTX pointer will be a new one every time.
To use this properly, a non-trivial amount of knowledge of your SSL library is necessary. For example, you can use this function to call library-specific callbacks to add additional validation code for certificates, and even to change the actual URI of a HTTPS request.
By default this function calls an internal method and
corresponds to CURLOPT_SSL_CTX_FUNCTION
and
CURLOPT_SSL_CTX_DATA
.
Note that the lifetime bound on this function is 'static
, but that
is often too restrictive. To use stack data consider calling the
transfer
method and then using progress_function
to configure a
callback that can reference stack-local data.
pub fn debug_function<F>(&mut self, f: F) -> Result<(), Error> where
F: FnMut(InfoType, &[u8]) + Send + 'static,
[src]
F: FnMut(InfoType, &[u8]) + Send + 'static,
Specify a debug callback
debug_function
replaces the standard debug function used when
verbose
is in effect. This callback receives debug information,
as specified in the type argument.
By default this option is not set and corresponds to the
CURLOPT_DEBUGFUNCTION
and CURLOPT_DEBUGDATA
options.
Note that the lifetime bound on this function is 'static
, but that
is often too restrictive. To use stack data consider calling the
transfer
method and then using debug_function
to configure a
callback that can reference stack-local data.
pub fn header_function<F>(&mut self, f: F) -> Result<(), Error> where
F: FnMut(&[u8]) -> bool + Send + 'static,
[src]
F: FnMut(&[u8]) -> bool + Send + 'static,
Callback that receives header data
This function gets called by libcurl as soon as it has received header
data. The header callback will be called once for each header and only
complete header lines are passed on to the callback. Parsing headers is
very easy using this. If this callback returns false
it'll signal an
error to the library. This will cause the transfer to get aborted and
the libcurl function in progress will return is_write_error
.
A complete HTTP header that is passed to this function can be up to CURL_MAX_HTTP_HEADER (100K) bytes.
It's important to note that the callback will be invoked for the headers of all responses received after initiating a request and not just the final response. This includes all responses which occur during authentication negotiation. If you need to operate on only the headers from the final response, you will need to collect headers in the callback yourself and use HTTP status lines, for example, to delimit response boundaries.
When a server sends a chunked encoded transfer, it may contain a trailer. That trailer is identical to a HTTP header and if such a trailer is received it is passed to the application using this callback as well. There are several ways to detect it being a trailer and not an ordinary header: 1) it comes after the response-body. 2) it comes after the final header line (CR LF) 3) a Trailer: header among the regular response-headers mention what header(s) to expect in the trailer.
For non-HTTP protocols like FTP, POP3, IMAP and SMTP this function will get called with the server responses to the commands that libcurl sends.
By default this option is not set and corresponds to the
CURLOPT_HEADERFUNCTION
and CURLOPT_HEADERDATA
options.
Note that the lifetime bound on this function is 'static
, but that
is often too restrictive. To use stack data consider calling the
transfer
method and then using header_function
to configure a
callback that can reference stack-local data.
Examples
use std::str; use curl::easy::Easy; let mut handle = Easy::new(); handle.url("https://www.rust-lang.org/").unwrap(); handle.header_function(|header| { print!("header: {}", str::from_utf8(header).unwrap()); true }).unwrap(); handle.perform().unwrap();
Collecting headers to a stack local vector
use std::str; use curl::easy::Easy; let mut headers = Vec::new(); let mut handle = Easy::new(); handle.url("https://www.rust-lang.org/").unwrap(); { let mut transfer = handle.transfer(); transfer.header_function(|header| { headers.push(str::from_utf8(header).unwrap().to_string()); true }).unwrap(); transfer.perform().unwrap(); } println!("{:?}", headers);
pub fn fail_on_error(&mut self, fail: bool) -> Result<(), Error>
[src]
Same as Easy2::fail_on_error
pub fn url(&mut self, url: &str) -> Result<(), Error>
[src]
Same as Easy2::url
pub fn port(&mut self, port: u16) -> Result<(), Error>
[src]
Same as Easy2::port
pub fn proxy(&mut self, url: &str) -> Result<(), Error>
[src]
Same as Easy2::proxy
pub fn proxy_port(&mut self, port: u16) -> Result<(), Error>
[src]
Same as Easy2::proxy_port
pub fn proxy_type(&mut self, kind: ProxyType) -> Result<(), Error>
[src]
Same as Easy2::proxy_type
pub fn noproxy(&mut self, skip: &str) -> Result<(), Error>
[src]
Same as Easy2::noproxy
pub fn http_proxy_tunnel(&mut self, tunnel: bool) -> Result<(), Error>
[src]
Same as Easy2::http_proxy_tunnel
pub fn interface(&mut self, interface: &str) -> Result<(), Error>
[src]
Same as Easy2::interface
pub fn set_local_port(&mut self, port: u16) -> Result<(), Error>
[src]
Same as Easy2::set_local_port
pub fn local_port_range(&mut self, range: u16) -> Result<(), Error>
[src]
Same as Easy2::local_port_range
pub fn dns_servers(&mut self, servers: &str) -> Result<(), Error>
[src]
Same as Easy2::dns_servers
pub fn dns_cache_timeout(&mut self, dur: Duration) -> Result<(), Error>
[src]
Same as Easy2::dns_cache_timeout
pub fn buffer_size(&mut self, size: usize) -> Result<(), Error>
[src]
Same as Easy2::buffer_size
pub fn tcp_nodelay(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::tcp_nodelay
pub fn tcp_keepalive(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::tcp_keepalive
pub fn tcp_keepintvl(&mut self, dur: Duration) -> Result<(), Error>
[src]
Same as Easy2::tcp_keepintvl
pub fn tcp_keepidle(&mut self, dur: Duration) -> Result<(), Error>
[src]
Same as Easy2::tcp_keepidle
pub fn address_scope(&mut self, scope: u32) -> Result<(), Error>
[src]
Same as Easy2::address_scope
pub fn username(&mut self, user: &str) -> Result<(), Error>
[src]
Same as Easy2::username
pub fn password(&mut self, pass: &str) -> Result<(), Error>
[src]
Same as Easy2::password
pub fn http_auth(&mut self, auth: &Auth) -> Result<(), Error>
[src]
Same as Easy2::http_auth
pub fn proxy_username(&mut self, user: &str) -> Result<(), Error>
[src]
Same as Easy2::proxy_username
pub fn proxy_password(&mut self, pass: &str) -> Result<(), Error>
[src]
Same as Easy2::proxy_password
pub fn proxy_auth(&mut self, auth: &Auth) -> Result<(), Error>
[src]
Same as Easy2::proxy_auth
pub fn netrc(&mut self, netrc: NetRc) -> Result<(), Error>
[src]
Same as Easy2::netrc
pub fn autoreferer(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::autoreferer
pub fn accept_encoding(&mut self, encoding: &str) -> Result<(), Error>
[src]
Same as Easy2::accept_encoding
pub fn transfer_encoding(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::transfer_encoding
pub fn follow_location(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::follow_location
pub fn unrestricted_auth(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::unrestricted_auth
pub fn max_redirections(&mut self, max: u32) -> Result<(), Error>
[src]
Same as Easy2::max_redirections
pub fn put(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::put
pub fn post(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::post
pub fn post_fields_copy(&mut self, data: &[u8]) -> Result<(), Error>
[src]
Same as Easy2::post_field_copy
pub fn post_field_size(&mut self, size: u64) -> Result<(), Error>
[src]
Same as Easy2::post_field_size
pub fn httppost(&mut self, form: Form) -> Result<(), Error>
[src]
Same as Easy2::httppost
pub fn referer(&mut self, referer: &str) -> Result<(), Error>
[src]
Same as Easy2::referer
pub fn useragent(&mut self, useragent: &str) -> Result<(), Error>
[src]
Same as Easy2::useragent
pub fn http_headers(&mut self, list: List) -> Result<(), Error>
[src]
Same as Easy2::http_headers
pub fn cookie(&mut self, cookie: &str) -> Result<(), Error>
[src]
Same as Easy2::cookie
pub fn cookie_file<P: AsRef<Path>>(&mut self, file: P) -> Result<(), Error>
[src]
Same as Easy2::cookie_file
pub fn cookie_jar<P: AsRef<Path>>(&mut self, file: P) -> Result<(), Error>
[src]
Same as Easy2::cookie_jar
pub fn cookie_session(&mut self, session: bool) -> Result<(), Error>
[src]
Same as Easy2::cookie_session
pub fn cookie_list(&mut self, cookie: &str) -> Result<(), Error>
[src]
Same as Easy2::cookie_list
pub fn get(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::get
pub fn ignore_content_length(&mut self, ignore: bool) -> Result<(), Error>
[src]
Same as Easy2::ignore_content_length
pub fn http_content_decoding(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::http_content_decoding
pub fn http_transfer_decoding(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::http_transfer_decoding
pub fn range(&mut self, range: &str) -> Result<(), Error>
[src]
Same as Easy2::range
pub fn resume_from(&mut self, from: u64) -> Result<(), Error>
[src]
Same as Easy2::resume_from
pub fn custom_request(&mut self, request: &str) -> Result<(), Error>
[src]
Same as Easy2::custom_request
pub fn fetch_filetime(&mut self, fetch: bool) -> Result<(), Error>
[src]
Same as Easy2::fetch_filetime
pub fn nobody(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::nobody
pub fn in_filesize(&mut self, size: u64) -> Result<(), Error>
[src]
Same as Easy2::in_filesize
pub fn upload(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::upload
pub fn max_filesize(&mut self, size: u64) -> Result<(), Error>
[src]
Same as Easy2::max_filesize
pub fn time_condition(&mut self, cond: TimeCondition) -> Result<(), Error>
[src]
Same as Easy2::time_condition
pub fn time_value(&mut self, val: i64) -> Result<(), Error>
[src]
Same as Easy2::time_value
pub fn timeout(&mut self, timeout: Duration) -> Result<(), Error>
[src]
Same as Easy2::timeout
pub fn low_speed_limit(&mut self, limit: u32) -> Result<(), Error>
[src]
Same as Easy2::low_speed_limit
pub fn low_speed_time(&mut self, dur: Duration) -> Result<(), Error>
[src]
Same as Easy2::low_speed_time
pub fn max_send_speed(&mut self, speed: u64) -> Result<(), Error>
[src]
Same as Easy2::max_send_speed
pub fn max_recv_speed(&mut self, speed: u64) -> Result<(), Error>
[src]
Same as Easy2::max_recv_speed
pub fn max_connects(&mut self, max: u32) -> Result<(), Error>
[src]
Same as Easy2::max_connects
pub fn fresh_connect(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::fresh_connect
pub fn forbid_reuse(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::forbid_reuse
pub fn connect_timeout(&mut self, timeout: Duration) -> Result<(), Error>
[src]
Same as Easy2::connect_timeout
pub fn ip_resolve(&mut self, resolve: IpResolve) -> Result<(), Error>
[src]
Same as Easy2::ip_resolve
pub fn resolve(&mut self, list: List) -> Result<(), Error>
[src]
Same as Easy2::resolve
pub fn connect_only(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::connect_only
pub fn ssl_cert<P: AsRef<Path>>(&mut self, cert: P) -> Result<(), Error>
[src]
Same as Easy2::ssl_cert
pub fn ssl_cert_type(&mut self, kind: &str) -> Result<(), Error>
[src]
Same as Easy2::ssl_cert_type
pub fn ssl_key<P: AsRef<Path>>(&mut self, key: P) -> Result<(), Error>
[src]
Same as Easy2::ssl_key
pub fn ssl_key_type(&mut self, kind: &str) -> Result<(), Error>
[src]
Same as Easy2::ssl_key_type
pub fn key_password(&mut self, password: &str) -> Result<(), Error>
[src]
Same as Easy2::key_password
pub fn ssl_engine(&mut self, engine: &str) -> Result<(), Error>
[src]
Same as Easy2::ssl_engine
pub fn ssl_engine_default(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::ssl_engine_default
pub fn http_version(&mut self, version: HttpVersion) -> Result<(), Error>
[src]
Same as Easy2::http_version
pub fn ssl_version(&mut self, version: SslVersion) -> Result<(), Error>
[src]
Same as Easy2::ssl_version
pub fn ssl_min_max_version(
&mut self,
min_version: SslVersion,
max_version: SslVersion
) -> Result<(), Error>
[src]
&mut self,
min_version: SslVersion,
max_version: SslVersion
) -> Result<(), Error>
Same as Easy2::ssl_min_max_version
pub fn ssl_verify_host(&mut self, verify: bool) -> Result<(), Error>
[src]
Same as Easy2::ssl_verify_host
pub fn ssl_verify_peer(&mut self, verify: bool) -> Result<(), Error>
[src]
Same as Easy2::ssl_verify_peer
pub fn cainfo<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error>
[src]
Same as Easy2::cainfo
pub fn issuer_cert<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error>
[src]
Same as Easy2::issuer_cert
pub fn capath<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error>
[src]
Same as Easy2::capath
pub fn crlfile<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Error>
[src]
Same as Easy2::crlfile
pub fn certinfo(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::certinfo
pub fn random_file<P: AsRef<Path>>(&mut self, p: P) -> Result<(), Error>
[src]
Same as Easy2::random_file
pub fn egd_socket<P: AsRef<Path>>(&mut self, p: P) -> Result<(), Error>
[src]
Same as Easy2::egd_socket
pub fn ssl_cipher_list(&mut self, ciphers: &str) -> Result<(), Error>
[src]
Same as Easy2::ssl_cipher_list
pub fn ssl_sessionid_cache(&mut self, enable: bool) -> Result<(), Error>
[src]
Same as Easy2::ssl_sessionid_cache
pub fn ssl_options(&mut self, bits: &SslOpt) -> Result<(), Error>
[src]
Same as Easy2::ssl_options
pub fn time_condition_unmet(&mut self) -> Result<bool, Error>
[src]
Same as Easy2::time_condition_unmet
pub fn effective_url(&mut self) -> Result<Option<&str>, Error>
[src]
Same as Easy2::effective_url
pub fn effective_url_bytes(&mut self) -> Result<Option<&[u8]>, Error>
[src]
Same as Easy2::effective_url_bytes
pub fn response_code(&mut self) -> Result<u32, Error>
[src]
Same as Easy2::response_code
pub fn http_connectcode(&mut self) -> Result<u32, Error>
[src]
Same as Easy2::http_connectcode
pub fn filetime(&mut self) -> Result<Option<i64>, Error>
[src]
Same as Easy2::filetime
pub fn download_size(&mut self) -> Result<f64, Error>
[src]
Same as Easy2::download_size
pub fn content_length_download(&mut self) -> Result<f64, Error>
[src]
Same as Easy2::content_length_download
pub fn total_time(&mut self) -> Result<Duration, Error>
[src]
Same as Easy2::total_time
pub fn namelookup_time(&mut self) -> Result<Duration, Error>
[src]
Same as Easy2::namelookup_time
pub fn connect_time(&mut self) -> Result<Duration, Error>
[src]
Same as Easy2::connect_time
pub fn appconnect_time(&mut self) -> Result<Duration, Error>
[src]
Same as Easy2::appconnect_time
pub fn pretransfer_time(&mut self) -> Result<Duration, Error>
[src]
Same as Easy2::pretransfer_time
pub fn starttransfer_time(&mut self) -> Result<Duration, Error>
[src]
Same as Easy2::starttransfer_time
pub fn redirect_time(&mut self) -> Result<Duration, Error>
[src]
Same as Easy2::redirect_time
pub fn redirect_count(&mut self) -> Result<u32, Error>
[src]
Same as Easy2::redirect_count
pub fn redirect_url(&mut self) -> Result<Option<&str>, Error>
[src]
Same as Easy2::redirect_url
pub fn redirect_url_bytes(&mut self) -> Result<Option<&[u8]>, Error>
[src]
Same as Easy2::redirect_url_bytes
pub fn header_size(&mut self) -> Result<u64, Error>
[src]
Same as Easy2::header_size
pub fn request_size(&mut self) -> Result<u64, Error>
[src]
Same as Easy2::request_size
pub fn content_type(&mut self) -> Result<Option<&str>, Error>
[src]
Same as Easy2::content_type
pub fn content_type_bytes(&mut self) -> Result<Option<&[u8]>, Error>
[src]
Same as Easy2::content_type_bytes
pub fn os_errno(&mut self) -> Result<i32, Error>
[src]
Same as Easy2::os_errno
pub fn primary_ip(&mut self) -> Result<Option<&str>, Error>
[src]
Same as Easy2::primary_ip
pub fn primary_port(&mut self) -> Result<u16, Error>
[src]
Same as Easy2::primary_port
pub fn local_ip(&mut self) -> Result<Option<&str>, Error>
[src]
Same as Easy2::local_ip
pub fn local_port(&mut self) -> Result<u16, Error>
[src]
Same as Easy2::local_port
pub fn cookies(&mut self) -> Result<List, Error>
[src]
Same as Easy2::cookies
pub fn pipewait(&mut self, wait: bool) -> Result<(), Error>
[src]
Same as Easy2::pipewait
pub fn perform(&self) -> Result<(), Error>
[src]
Same as Easy2::perform
pub fn transfer<'data, 'easy>(&'easy mut self) -> Transfer<'easy, 'data>
[src]
Creates a new scoped transfer which can be used to set callbacks and data which only live for the scope of the returned object.
An Easy
handle is often reused between different requests to cache
connections to servers, but often the lifetime of the data as part of
each transfer is unique. This function serves as an ability to share an
Easy
across many transfers while ergonomically using possibly
stack-local data as part of each transfer.
Configuration can be set on the Easy
and then a Transfer
can be
created to set scoped configuration (like callbacks). Finally, the
perform
method on the Transfer
function can be used.
When the Transfer
option is dropped then all configuration set on the
transfer itself will be reset.
pub fn unpause_read(&self) -> Result<(), Error>
[src]
Same as Easy2::unpause_read
pub fn unpause_write(&self) -> Result<(), Error>
[src]
Same as Easy2::unpause_write
pub fn url_encode(&mut self, s: &[u8]) -> String
[src]
Same as Easy2::url_encode
pub fn url_decode(&mut self, s: &str) -> Vec<u8>
[src]
Same as Easy2::url_decode
pub fn reset(&mut self)
[src]
Same as Easy2::reset
pub fn recv(&mut self, data: &mut [u8]) -> Result<usize, Error>
[src]
Same as Easy2::recv
pub fn send(&mut self, data: &[u8]) -> Result<usize, Error>
[src]
Same as Easy2::send
pub fn raw(&self) -> *mut CURL
[src]
Same as Easy2::raw
pub fn take_error_buf(&self) -> Option<String>
[src]
Same as Easy2::take_error_buf
Trait Implementations
Auto Trait Implementations
impl Send for Easy
impl Unpin for Easy
impl !Sync for Easy
impl !UnwindSafe for Easy
impl !RefUnwindSafe for Easy
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,