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
//! # cabot
//!
//! cabot is a command line tool and a rust library for sending HTTP query.
//! It is a simple implementation of HTTP based on the rust standard library
//! to perform TCP and DNS query, and use rustls for handling HTTPS connection.
//! No tiers library are used for HTTP protocol.
//!
//! cabot is inspired by the cURL command line tool, but focus on the
//! http protocol which is the referent in HTTP client library.
//!
//! # Examples:
//!
//! ## Command Line:
//!
//! ```bash
//! $ cabot https://www.rust-lang.org/en-US/ | head -n 10 | grep "description"
//! <meta name="description" content="A systems programming language that runs
//! blazingly fast, prevents segfaults, and guarantees thread safety.">
//! ```
//!
//! ## Library:
//!
//! ```
//! use cabot::{RequestBuilder, Client};
//!
//! let request = RequestBuilder::new("https://www.rust-lang.org/en-US/")
//!     .build()
//!     .unwrap();
//! let client = Client::new();
//! let response = client.execute(&request).unwrap();
//! assert!(response.body_as_string().unwrap().contains("runs blazingly fast"));
//!
//! ```
//!
//! # Why cabot ?
//!
//! To get a simple rust native https client. No binding to OpenSSL.
//!
//! # License
//!
//! BSD 3-Clause License
//!

#[macro_use]
extern crate log;

extern crate url;
extern crate rustls;
extern crate webpki_roots;
#[macro_use]
extern crate lazy_static;
extern crate regex;

mod dns;

pub mod constants;
pub mod http;
pub mod results;
pub mod request;
pub mod client;
pub mod response;

// Rexport
pub use client::Client;
pub use request::RequestBuilder;