1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! A small blocking HTTP client on top of libcurl: curl's HTTP stack as a
//! Rust library, for programs that have to work where they are deployed.
//!
//! No async runtime, one libcurl handle per thread with connection reuse,
//! the machine's proxies, certificate store, `~/.netrc` and single sign-on
//! honoured, request bodies held in memory once, and `multipart/form-data`
//! in both directions.
//!
//! ```no_run
//! use curlite::Multipart;
//!
//! let response = curlite::get("https://httpbin.org/get")
//! .query("page", "2")
//! .send()?;
//! println!("{} {}", response.status(), response.text()?);
//!
//! let response = curlite::post("https://httpbin.org/post")
//! .multipart(
//! Multipart::new()
//! .text("description", "report")
//! .file("file", "report.pdf", mime::APPLICATION_PDF, std::fs::read("report.pdf")?),
//! )
//! .send()?;
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! Bodies are set with [`Request::body`] (raw bytes with a MIME type),
//! [`Request::body_reader`] (streamed from a file or other reader),
//! [`Request::form`] (`application/x-www-form-urlencoded`) or
//! [`Request::multipart`]. Responses are read into memory by
//! [`Request::send`], streamed to a writer by [`Request::send_to`] or read
//! on demand through [`Request::send_reader`]. Multipart responses are
//! split with [`Response::parts`]. A [`Client`] holds headers, timeouts,
//! proxy and TLS settings shared by several requests, and
//! [`Request::to_curl`] prints any request as a `curl` command line.
//!
//! # Features
//!
//! * `json`: [`Request::json`] and [`Response::json`] via `serde_json`.
//! * `log`: libcurl's verbose output as `log::trace!` records with target
//! `curlite`, when that level is enabled.
//! * `http2`, `static-curl`, `static-ssl`, `rustls`: passed through to the
//! [`curl`] crate, see below.
//!
//! # TLS
//!
//! TLS comes from libcurl. By default the system libcurl is linked
//! dynamically, with whatever TLS library it was built against. The
//! `static-curl`, `static-ssl` and `rustls` features are passed through to
//! the [`curl`] crate to build and link libcurl statically instead.
pub use Multipart;
pub use Client;
pub use ;
pub use ;
pub use ;
pub use ResponseReader;
pub use Bytes;
pub use ;
/// The `mime` crate, for `mime::APPLICATION_JSON` and friends.
pub use mime;
pub use Mime;