#tls #s2n-tls #encryption #s2n #protocols #c99 #s2n-tls-hyper #https-connector

s2n-tls-hyper

A compatbility crate allowing s2n-tls to be used with the hyper HTTP library

10 releases

new 0.0.9 Apr 19, 2025
0.0.8 Apr 7, 2025
0.0.7 Mar 25, 2025
0.0.4 Feb 19, 2025
0.0.0 Nov 21, 2023

#1960 in Cryptography

Download history 81/week @ 2025-01-04 94/week @ 2025-01-11 152/week @ 2025-01-18 1/week @ 2025-01-25 5/week @ 2025-02-01 165/week @ 2025-02-08 135/week @ 2025-02-15 73/week @ 2025-02-22 164/week @ 2025-03-01 1096/week @ 2025-03-08 1419/week @ 2025-03-15 2545/week @ 2025-03-22 1646/week @ 2025-03-29 1516/week @ 2025-04-05 1364/week @ 2025-04-12

7,371 downloads per month
Used in aws-smithy-http-client

Apache-2.0

400KB
7K SLoC

This crate provides compatibility structs for the hyper 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 an `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::new()` will create
// a new `HttpConnector` to wrap.
let connector = HttpsConnector::new(Config::default());

// 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);

s2n-tls-hyper provides compatibility structs for hyper, allowing s2n-tls to be used as the underlying TLS implementation with hyper clients.

This crate is currently being developed and is unstable.

Dependencies

~69MB
~1.5M SLoC