-
Notifications
You must be signed in to change notification settings - Fork 724
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
139 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,45 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#![warn(missing_docs)] | ||
|
||
//! This crate provides compatibility structs for the [hyper](https://hyper.rs/) HTTP library, | ||
//! allowing s2n-tls to be used as the underlying TLS implementation to negotiate HTTPS with hyper | ||
//! clients. | ||
//! | ||
//! `s2n-tls-hyper` provides an `HttpsConnector` struct which is compatible with the | ||
//! `hyper_util::client::legacy::Client` builder, allowing hyper clients to be constructed with | ||
//! configurable s2n-tls connections. The following example demonstrates how to construct a hyper | ||
//! client with s2n-tls: | ||
//! | ||
//! ``` | ||
//! use std::str::FromStr; | ||
//! use hyper_util::{ | ||
//! client::legacy::Client, | ||
//! rt::TokioExecutor, | ||
//! }; | ||
//! use s2n_tls_hyper::connector::HttpsConnector; | ||
//! use s2n_tls::config::Config; | ||
//! use bytes::Bytes; | ||
//! use http_body_util::Empty; | ||
//! use http::uri::Uri; | ||
//! | ||
//! // An `HttpsConnector` is built with a `s2n_tls::connection::Builder`, such as an | ||
//! // `s2n_tls::config::Config`, which allows for the underlying TLS connection to be configured. | ||
//! let config = Config::default(); | ||
//! | ||
//! // The `HttpsConnector` wraps hyper's `HttpConnector`. `HttpsConnector::builder()` will create | ||
//! // a new `HttpConnector` to wrap. `HttpsConnector::builder_with_http()` can be used to wrap an | ||
//! // existing `HttpConnector`. | ||
//! let connector = HttpsConnector::builder(Config::default()).build(); | ||
//! | ||
//! // The `HttpsConnector` can then be provided to the hyper Client builder, which can be used to | ||
//! // send HTTP requests over HTTPS by specifying the HTTPS scheme in the URL. | ||
//! let client: Client<_, Empty<Bytes>> = | ||
//! Client::builder(TokioExecutor::new()).build(connector); | ||
//! let response = client.get(Uri::from_str("https://www.amazon.com").unwrap()); | ||
//! ``` | ||
/// Provides the `HttpsConnector` struct. | ||
pub mod connector; | ||
mod stream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters