fix: should build with libssl dependency
All checks were successful
/ test (map[name:1.74.1]) (push) Successful in 10s
/ test (map[name:stable]) (push) Successful in 9s
/ test (map[name:nightly]) (push) Successful in 12s

This commit is contained in:
Paul Campbell 2025-01-14 20:09:30 +00:00
parent 9a12ffc5fc
commit 6aa876047a
2 changed files with 16 additions and 0 deletions

View file

@ -4,3 +4,4 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
native-tls = "0.2"

15
examples/native-tls.rs Normal file
View file

@ -0,0 +1,15 @@
use native_tls::TlsConnector;
use std::io::{Read, Write};
use std::net::TcpStream;
fn main() {
let connector = TlsConnector::new().unwrap();
let stream = TcpStream::connect("google.com:443").unwrap();
let mut stream = connector.connect("google.com", stream).unwrap();
stream.write_all(b"GET / HTTP/1.0\r\n\r\n").unwrap();
let mut res = vec![];
stream.read_to_end(&mut res).unwrap();
println!("{}", String::from_utf8_lossy(&res));
}