Skip to content

Commit

Permalink
Merge branch 'master' into add-ci-check-external-types
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanburrell committed Dec 5, 2022
2 parents 0cc10bf + 252d8a7 commit 3fb768d
Show file tree
Hide file tree
Showing 72 changed files with 2,692 additions and 3,806 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
env:
RUST_BACKTRACE: 1

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
ci-pass:
name: CI is green
Expand Down Expand Up @@ -179,7 +182,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
override: true

- name: Install cbindgen
Expand All @@ -194,7 +197,7 @@ jobs:
RUSTFLAGS: --cfg hyper_unstable_ffi
with:
command: rustc
args: --features client,http1,http2,ffi -Z unstable-options --crate-type cdylib
args: --features client,http1,http2,ffi --crate-type cdylib

- name: Make Examples
run: cd capi/examples && make client
Expand Down
64 changes: 64 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,67 @@
### v1.0.0-rc.1 (2022-10-25)


#### Bug Fixes

* **http1:**
* trim obs-folded headers when unfolding (#2926) ([d4b5bd4e](https://github.com/hyperium/hyper/commit/d4b5bd4ee6af0ae8924cf05ab799cc3e19a3c62d))


#### Features

* **body:**
* rename `Body` struct to `Incoming` (#3022) ([95a153bb](https://github.com/hyperium/hyper/commit/95a153bbc2717bd4233486e09848622ceb900574), closes [#2971](https://github.com/hyperium/hyper/issues/2971))
* update `HttpBody` trait to use `Frame`s (#3020) ([0888623d](https://github.com/hyperium/hyper/commit/0888623d3764e887706d4e38f82f0fb57c50bd1a), closes [#3010](https://github.com/hyperium/hyper/issues/3010))
* make body::Sender and Body::channel private (#2970) ([d963e6a9](https://github.com/hyperium/hyper/commit/d963e6a9504575116f63df2485d8480fdb9b6f0b), closes [#2962](https://github.com/hyperium/hyper/issues/2962))
* remove "full" constructors from `Body` (#2958) ([9e8fc8fc](https://github.com/hyperium/hyper/commit/9e8fc8fca195f470a82be5bfb2fd8019c044b97a))
* **client:**
* remove `client::conn::{SendRequest, Connection}` (#2987) ([8ae73cac](https://github.com/hyperium/hyper/commit/8ae73cac6a8f6a61944505c121158dc312e7b68f))
* remove `client::connect` module (#2949) ([5e206883](https://github.com/hyperium/hyper/commit/5e206883984fe6de2812861ec363964d92b89b06))
* remove higher-level `hyper::Client` (#2941) ([bb3af17c](https://github.com/hyperium/hyper/commit/bb3af17ce1a3841e9170adabcce595c7c8743ea7))
* remove `hyper::client::server` (#2940) ([889fa2d8](https://github.com/hyperium/hyper/commit/889fa2d87252108eb7668b8bf034ffcc30985117))
* introduce version-specific client modules (#2906) ([509672aa](https://github.com/hyperium/hyper/commit/509672aada0af68a91d963e69828c6e31c44cb7b))
* **ffi:** add http1_allow_multiline_headers (#2918) ([09e35668](https://github.com/hyperium/hyper/commit/09e35668e5b094d679efb4b98ecde9cb6f9f2f93))
* **lib:** remove `stream` cargo feature (#2896) ([ce72f734](https://github.com/hyperium/hyper/commit/ce72f73464d96fd67b59ceff08fd424733b43ffa), closes [#2855](https://github.com/hyperium/hyper/issues/2855))
* **rt:** add Timer trait (#2974) ([fae97ced](https://github.com/hyperium/hyper/commit/fae97ced3a1f71fc46b6eadd3313e19705cc0006))
* **server:**
* remove `server::conn::{Http, Connection}` types (#3013) ([0766d3f7](https://github.com/hyperium/hyper/commit/0766d3f78d116ea243222cea134cfe7f418e6a3c), closes [#3012](https://github.com/hyperium/hyper/issues/3012))
* `server::conn::http1` and `server::conn::http2` modules (#3011) ([fc4d3356](https://github.com/hyperium/hyper/commit/fc4d3356cb7f2fffff5af9c474fa34c5adc5d6f1), closes [#2851](https://github.com/hyperium/hyper/issues/2851))
* remove the high-level Server API (#2932) ([3c7bef3b](https://github.com/hyperium/hyper/commit/3c7bef3b6f6b6c3ec780e5e2db12c9d5795c1b80))
* remove `AddrStream` struct (#2869) ([e9cab49e](https://github.com/hyperium/hyper/commit/e9cab49e6e18f712b94137966580f6756e32fabb), closes [#2850](https://github.com/hyperium/hyper/issues/2850))
* **service:** create own `Service` trait (#2920) ([fee7d361](https://github.com/hyperium/hyper/commit/fee7d361c28c7eb42ef6bbfae0db14028d24bfee), closes [#2853](https://github.com/hyperium/hyper/issues/2853))


#### Breaking Changes

* The polling functions of the `Body` trait have been
redesigned.

The free functions `hyper::body::to_bytes` and `aggregate` have been
removed. Similar functionality is on
`http_body_util::BodyExt::collect`.
([0888623d](https://github.com/hyperium/hyper/commit/0888623d3764e887706d4e38f82f0fb57c50bd1a))
* Either choose a version-specific `Connection` type, or
look for the auto-version type in `hyper-util`.
([0766d3f7](https://github.com/hyperium/hyper/commit/0766d3f78d116ea243222cea134cfe7f418e6a3c))
* Pick a version-specific connection, or use the combined
one in `hyper-util`.
([8ae73cac](https://github.com/hyperium/hyper/commit/8ae73cac6a8f6a61944505c121158dc312e7b68f))
* Change any manual `impl tower::Service` to implement `hyper::service::Service` instead. The `poll_ready` method has been removed.
([fee7d361](https://github.com/hyperium/hyper/commit/fee7d361c28c7eb42ef6bbfae0db14028d24bfee))
* The trait has been renamed.
([031454e5](https://github.com/hyperium/hyper/commit/031454e5e647dda0648424a944dbef795505e2e4))
* A channel body will be available in `hyper-util`.
([d963e6a9](https://github.com/hyperium/hyper/commit/d963e6a9504575116f63df2485d8480fdb9b6f0b))
* Use the types from `http-body-util`.
([9e8fc8fc](https://github.com/hyperium/hyper/commit/9e8fc8fca195f470a82be5bfb2fd8019c044b97a))
* Use `connect` from `hyper-util`.
([5e206883](https://github.com/hyperium/hyper/commit/5e206883984fe6de2812861ec363964d92b89b06))
* A pooling client is in the hyper-util crate.
([bb3af17c](https://github.com/hyperium/hyper/commit/bb3af17ce1a3841e9170adabcce595c7c8743ea7))
* Tower `Service` utilities will exist in `hyper-util`.
([889fa2d8](https://github.com/hyperium/hyper/commit/889fa2d87252108eb7668b8bf034ffcc30985117))


### v0.14.19 (2022-05-27)


Expand Down
29 changes: 7 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hyper"
version = "1.0.0-dev.0"
version = "1.0.0-rc.1"
description = "A fast and correct HTTP library."
readme = "README.md"
homepage = "https://hyper.rs"
Expand All @@ -12,8 +12,6 @@ keywords = ["http", "hyper", "hyperium"]
categories = ["network-programming", "web-programming::http-client", "web-programming::http-server"]
edition = "2018"

publish = false # no accidents while in dev

include = [
"Cargo.toml",
"LICENSE",
Expand All @@ -27,15 +25,14 @@ futures-core = { version = "0.3", default-features = false }
futures-channel = "0.3"
futures-util = { version = "0.3", default-features = false }
http = "0.2"
http-body = { git = "https://github.com/hyperium/http-body", branch = "master" }
http-body-util = { git = "https://github.com/hyperium/http-body", branch = "master" }
http-body = "1.0.0-rc.1"
http-body-util = { version = "0.1.0-rc.1", optional = true }
httpdate = "1.0"
httparse = "1.6"
httparse = "1.8"
h2 = { version = "0.3.9", optional = true }
itoa = "1"
tracing = { version = "0.1", default-features = false, features = ["std"] }
pin-project-lite = "0.2.4"
tower-service = "0.3"
tokio = { version = "1", features = ["sync"] }
want = "0.3"

Expand All @@ -46,6 +43,7 @@ socket2 = { version = "0.4", optional = true }

[dev-dependencies]
futures-util = { version = "0.3", default-features = false, features = ["alloc"] }
http-body-util = "0.1.0-rc.1"
matches = "0.1"
num_cpus = "1.0"
pretty_env_logger = "0.4"
Expand All @@ -55,6 +53,7 @@ serde_json = "1.0"
tokio = { version = "1", features = [
"fs",
"macros",
"net",
"io-std",
"io-util",
"rt",
Expand All @@ -65,7 +64,6 @@ tokio = { version = "1", features = [
] }
tokio-test = "0.4"
tokio-util = { version = "0.7", features = ["codec"] }
tower = { version = "0.4", features = ["make", "util"] }
url = "2.2"

[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dev-dependencies]
Expand All @@ -81,7 +79,6 @@ full = [
"http1",
"http2",
"server",
"runtime",
]

# HTTP versions
Expand All @@ -92,15 +89,8 @@ http2 = ["h2"]
client = []
server = []

# Tokio support
runtime = [
"tokio/net",
"tokio/rt",
"tokio/time",
]

# C-API support (currently unstable (no semver))
ffi = ["libc"]
ffi = ["libc", "http-body-util"]

# internal features used in CI
nightly = []
Expand Down Expand Up @@ -181,11 +171,6 @@ name = "state"
path = "examples/state.rs"
required-features = ["full"]

[[example]]
name = "tower_server"
path = "examples/tower_server.rs"
required-features = ["full"]

[[example]]
name = "upgrades"
path = "examples/upgrades.rs"
Expand Down
12 changes: 7 additions & 5 deletions benches/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ extern crate test;
use bytes::Buf;
use futures_util::stream;
use futures_util::StreamExt;
use http_body_util::StreamBody;
use http_body::Frame;
use http_body_util::{BodyExt, StreamBody};

macro_rules! bench_stream {
($bencher:ident, bytes: $bytes:expr, count: $count:expr, $total_ident:ident, $body_pat:pat, $block:expr) => {{
Expand All @@ -21,7 +22,8 @@ macro_rules! bench_stream {
$bencher.iter(|| {
rt.block_on(async {
let $body_pat = StreamBody::new(
stream::iter(__s.iter()).map(|&s| Ok::<_, std::convert::Infallible>(s)),
stream::iter(__s.iter())
.map(|&s| Ok::<_, std::convert::Infallible>(Frame::data(s))),
);

$block;
Expand All @@ -39,7 +41,7 @@ macro_rules! benches {
#[bench]
fn $name(b: &mut test::Bencher) {
bench_stream!(b, bytes: $bytes, count: $count, total, body, {
let buf = hyper::body::aggregate(body).await.unwrap();
let buf = BodyExt::collect(body).await.unwrap().aggregate();
assert_eq!(buf.remaining(), total);
});
}
Expand All @@ -55,7 +57,7 @@ macro_rules! benches {
bench_stream!(b, bytes: $bytes, count: $count, total, mut body, {
let mut vec = Vec::new();
while let Some(chunk) = body.next().await {
vec.extend_from_slice(&chunk.unwrap());
vec.extend_from_slice(&chunk.unwrap().into_data().unwrap());
}
assert_eq!(vec.len(), total);
});
Expand All @@ -70,7 +72,7 @@ macro_rules! benches {
#[bench]
fn $name(b: &mut test::Bencher) {
bench_stream!(b, bytes: $bytes, count: $count, total, body, {
let bytes = hyper::body::to_bytes(body).await.unwrap();
let bytes = BodyExt::collect(body).await.unwrap().to_bytes();
assert_eq!(bytes.len(), total);
});
}
Expand Down
13 changes: 9 additions & 4 deletions benches/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@

extern crate test;

use std::convert::Infallible;
use std::io::{Read, Write};
use std::net::{SocketAddr, TcpStream};
use std::sync::mpsc;
use std::time::Duration;

use bytes::Bytes;
use http_body_util::Full;
use tokio::net::TcpListener;
use tokio::sync::oneshot;

use hyper::server::conn::Http;
use hyper::server::conn::http1;
use hyper::service::service_fn;
use hyper::{Body, Response};
use hyper::Response;

const PIPELINED_REQUESTS: usize = 16;

Expand All @@ -38,12 +41,14 @@ fn hello_world_16(b: &mut test::Bencher) {
loop {
let (stream, _addr) = listener.accept().await.expect("accept");

Http::new()
http1::Builder::new()
.pipeline_flush(true)
.serve_connection(
stream,
service_fn(|_| async {
Ok::<_, hyper::Error>(Response::new(Body::from("Hello, World!")))
Ok::<_, Infallible>(Response::new(Full::new(Bytes::from(
"Hello, World!",
))))
}),
)
.await
Expand Down
16 changes: 9 additions & 7 deletions benches/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ use std::net::{SocketAddr, TcpListener, TcpStream};
use std::sync::mpsc;
use std::time::Duration;

use bytes::Bytes;
use futures_util::{stream, StreamExt};
use http_body_util::{BodyExt, StreamBody};
use http_body_util::{BodyExt, Full, StreamBody};
use tokio::sync::oneshot;

use hyper::server::conn::Http;
use hyper::body::Frame;
use hyper::server::conn::http1;
use hyper::service::service_fn;
use hyper::Response;

Expand All @@ -37,7 +39,7 @@ macro_rules! bench_server {
loop {
let (stream, _) = listener.accept().await.expect("accept");

Http::new()
http1::Builder::new()
.serve_connection(
stream,
service_fn(|_| async {
Expand Down Expand Up @@ -87,8 +89,8 @@ macro_rules! bench_server {
}};
}

fn body(b: &'static [u8]) -> hyper::Body {
b.into()
fn body(b: &'static [u8]) -> Full<Bytes> {
Full::new(b.into())
}

#[bench]
Expand All @@ -108,7 +110,7 @@ fn throughput_fixedsize_many_chunks(b: &mut test::Bencher) {
bench_server!(b, ("content-length", "1000000"), move || {
static S: &[&[u8]] = &[&[b'x'; 1_000] as &[u8]; 1_000] as _;
BodyExt::boxed(StreamBody::new(
stream::iter(S.iter()).map(|&s| Ok::<_, String>(s)),
stream::iter(S.iter()).map(|&s| Ok::<_, String>(Frame::data(s))),
))
})
}
Expand All @@ -132,7 +134,7 @@ fn throughput_chunked_many_chunks(b: &mut test::Bencher) {
bench_server!(b, ("transfer-encoding", "chunked"), || {
static S: &[&[u8]] = &[&[b'x'; 1_000] as &[u8]; 1_000] as _;
BodyExt::boxed(StreamBody::new(
stream::iter(S.iter()).map(|&s| Ok::<_, String>(s)),
stream::iter(S.iter()).map(|&s| Ok::<_, String>(Frame::data(s))),
))
})
}
Expand Down
3 changes: 3 additions & 0 deletions benches/support/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

mod tokiort;
pub use tokiort::TokioTimer;
Loading

0 comments on commit 3fb768d

Please sign in to comment.