curl-rust
libcurl bindings for Rust
Quick Start
extern crate curl;
use ;
use Easy;
// Print a web page onto stdout
extern crate curl;
use Easy;
// Capture output into a local `Vec`.
Post / Put requests
The put
and post
methods on Easy
can configure the method of the HTTP
request, and then read_function
can be used to specify how data is filled in.
This interface works particularly well with types that implement Read
.
extern crate curl;
use Read;
use Easy;
Custom headers
Custom headers can be specified as part of the request:
extern crate curl;
use ;
Keep alive
The handle can be re-used across multiple requests. Curl will attempt to keep the connections alive.
extern crate curl;
use Easy;
Multiple requests
The libcurl library provides support for sending multiple requests
simultaneously through the "multi" interface. This is currently bound in the
multi
module of this crate and provides the ability to execute multiple
transfers simultaneously. For more information, see that module.
Building
By default, this crate will attempt to dynamically link to the system-wide libcurl and the system-wide SSL library. Some of this behavior can be customized with various Cargo features:
ssl
: Enable SSL support. Enabled by default.http2
: Enable HTTP/2 support via libnghttp2. Disabled by default.static-curl
: Use a bundled libcurl version and statically link to it. Disabled by default.static-ssl
: Use a bundled OpenSSL version and statically link to it. Only applies on platforms that use OpenSSL. Disabled by default.spengo
: Enable SPENGO support. Disabled by default.
Version Support
The bindings have been developed using curl version 7.24.0. They should work with any newer version of curl and possibly with older versions, but this has not been tested.
License
The curl-rust
crate is licensed under the MIT license, see LICENSE
for more
details.