Crates.io | http_io |
lib.rs | http_io |
version | 0.3.0 |
source | src |
created_at | 2019-03-13 07:07:41.234433 |
updated_at | 2024-11-20 03:02:57.892806 |
description | A library with limited dependencies containing an HTTP client and server. |
homepage | https://github.com/bobbobbio/http_io |
repository | https://github.com/bobbobbio/http_io |
max_upload_size | |
id | 120399 |
size | 188,402 |
Crate containing HTTP client and server.
#![no_std]
.The no_std build requires nightly since it relies on the alloc crate.
use http_io::error::Result;
use std::fs::File;
use std::io;
fn main() -> Result<()> {
// Stream contents of url to stdout
let mut body = http_io::client::get("https://postman-echo.com/get")?;
io::copy(&mut body, &mut std::io::stdout())?;
// Stream contents of file to remote server
let file = File::open("src/client.rs")?;
http_io::client::put("https://postman-echo.com/put", file)?;
Ok(())
}
By default http_io
uses native-tls
as its library for TLS (HTTPS support). It supports two other TLS libraries, rustls
and openssl
. These other "back-ends" can be selected using feaures
$ # If you want to use `rustls`:
$ cargo build --no-default-features --features std,ssl-rustls
$ # If you want to use `openssl`:
$ cargo build --no-default-features --features std,ssl-openssl