Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
sunli829 committed Nov 20, 2024
2 parents 3de57f8 + f35094f commit e3eb3f4
Show file tree
Hide file tree
Showing 27 changed files with 341 additions and 69 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
# Switch to stable Rust
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.76.0
toolchain: stable
components: rustfmt, clippy
override: true
- name: Cache Rust
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
# Switch to stable Rust
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.76.0
toolchain: stable
components: rustfmt, clippy
- name: Cache Rust
uses: Swatinem/rust-cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install Stable Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.76.0
toolchain: 1.81.0
components: rustfmt
- name: Cache Rust
uses: Swatinem/rust-cache@v2
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ license = "MIT OR Apache-2.0"
documentation = "https://docs.rs/poem/"
homepage = "https://github.com/poem-web/poem"
repository = "https://github.com/poem-web/poem"
rust-version = "1.75"
rust-version = "1.81"

[workspace.dependencies]
poem = { path = "poem", version = "3.1.0", default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<img src="https://img.shields.io/badge/unsafe-forbidden-success.svg?style=flat-square"
alt="Unsafe Rust forbidden" />
</a>
<a href="https://blog.rust-lang.org/2023/11/16/Rust-1.76.0.html">
<img src="https://img.shields.io/badge/rustc-1.76.0+-ab6000.svg"
alt="rustc 1.76.0+" />
<a href="https://blog.rust-lang.org/2023/11/16/Rust-1.81.0.html">
<img src="https://img.shields.io/badge/rustc-1.81.0+-ab6000.svg"
alt="rustc 1.81.0+" />
</a>
<a href="https://discord.gg/qWWNxwasb7">
<img src="https://img.shields.io/discord/932986985604333638.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2" />
Expand Down
2 changes: 1 addition & 1 deletion poem-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poem-derive"
version = "3.1.0"
version = "3.1.4"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion poem-grpc-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poem-grpc-build"
version = "0.5.0"
version = "0.5.2"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
5 changes: 5 additions & 0 deletions poem-grpc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [0.5.2] 2024-11-20

- Add `ClientConfigBuilder::http2_max_header_list_size` method to set the max size of received header frames.
- Update MSRV to `1.81.0`

# [0.5.1] 2024-09-12

- set the correct `content-type` for `GrpcClient`
Expand Down
4 changes: 2 additions & 2 deletions poem-grpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poem-grpc"
version = "0.5.1"
version = "0.5.2"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down Expand Up @@ -42,7 +42,7 @@ thiserror.workspace = true
fastrand = "2.0.0"
http.workspace = true
hyper = { version = "1.0.0", features = ["http1", "http2"] }
hyper-util = { version = "0.1.3", features = ["client-legacy", "tokio"] }
hyper-util = { version = "0.1.10", features = ["client-legacy", "tokio"] }
http-body-util = "0.1.0"
tokio-rustls.workspace = true
tower-service = "0.3.2"
Expand Down
8 changes: 4 additions & 4 deletions poem-grpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<img src="https://img.shields.io/badge/unsafe-forbidden-success.svg?style=flat-square"
alt="Unsafe Rust forbidden" />
</a>
<a href="https://blog.rust-lang.org/2023/11/16/Rust-1.76.0.html">
<img src="https://img.shields.io/badge/rustc-1.76.0+-ab6000.svg"
alt="rustc 1.76.0+" />
<a href="https://blog.rust-lang.org/2023/11/16/Rust-1.81.0.html">
<img src="https://img.shields.io/badge/rustc-1.81.0+-ab6000.svg"
alt="rustc 1.81.0+" />
</a>
</div>

Expand Down Expand Up @@ -63,7 +63,7 @@ This crate uses `#![forbid(unsafe_code)]` to ensure everything is implemented in

## MSRV

The minimum supported Rust version for this crate is `1.76.0`.
The minimum supported Rust version for this crate is `1.81.0`.

## Contributing

Expand Down
21 changes: 19 additions & 2 deletions poem-grpc/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,25 @@ use crate::{
pub(crate) type BoxBody = http_body_util::combinators::BoxBody<Bytes, IoError>;

/// A configuration for GRPC client
#[derive(Default)]
pub struct ClientConfig {
uris: Vec<Uri>,
origin: Option<Uri>,
user_agent: Option<HeaderValue>,
tls_config: Option<TlsClientConfig>,
max_header_list_size: u32,
}

impl ClientConfig {
/// Create a `ClientConfig` builder
pub fn builder() -> ClientConfigBuilder {
ClientConfigBuilder {
config: Ok(ClientConfig::default()),
config: Ok(ClientConfig {
uris: vec![],
origin: None,
user_agent: None,
tls_config: None,
max_header_list_size: 16384,
}),
}
}
}
Expand Down Expand Up @@ -146,6 +152,16 @@ impl ClientConfigBuilder {
self
}

/// Sets the max size of received header frames.
///
/// Default is `16384` bytes.
pub fn http2_max_header_list_size(mut self, max: u32) -> Self {
if let Ok(config) = &mut self.config {
config.max_header_list_size = max;
}
self
}

/// Consumes this builder and returns the `ClientConfig`
pub fn build(self) -> Result<ClientConfig, ClientBuilderError> {
self.config
Expand Down Expand Up @@ -451,6 +467,7 @@ fn create_client_endpoint(
let mut config = config;
let cli = Client::builder(TokioExecutor::new())
.http2_only(true)
.http2_max_header_list_size(config.max_header_list_size)
.build(HttpsConnector::new(config.tls_config.take()));

let config = Arc::new(config);
Expand Down
4 changes: 4 additions & 0 deletions poem-lambda/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [5.1.1] 2024-11-20

- Update MSRV to `1.81.0`

# [5.0.0] 2024-03-30

- use AFIT instead of `async_trait`
Expand Down
2 changes: 1 addition & 1 deletion poem-lambda/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poem-lambda"
version = "5.1.0"
version = "5.1.1"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
8 changes: 4 additions & 4 deletions poem-lambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<img src="https://img.shields.io/badge/unsafe-forbidden-success.svg?style=flat-square"
alt="Unsafe Rust forbidden" />
</a>
<a href="https://blog.rust-lang.org/2023/11/16/Rust-1.76.0.html">
<img src="https://img.shields.io/badge/rustc-1.76.0+-ab6000.svg"
alt="rustc 1.76.0+" />
<a href="https://blog.rust-lang.org/2023/11/16/Rust-1.81.0.html">
<img src="https://img.shields.io/badge/rustc-1.81.0+-ab6000.svg"
alt="rustc 1.81.0+" />
</a>
</div>

Expand All @@ -49,7 +49,7 @@ This crate uses `#![forbid(unsafe_code)]` to ensure everything is implemented in

## MSRV

The minimum supported Rust version for this crate is `1.76.0`.
The minimum supported Rust version for this crate is `1.81.0`.

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion poem-openapi-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poem-openapi-derive"
version = "5.1.1"
version = "5.1.3"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
7 changes: 6 additions & 1 deletion poem-openapi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# Unreleased
#[5.1.3] 2024-11-20

- Update MSRV to `1.81.0`

# [5.1.2] 2024-10-02

- implements `Serialize` and `Deserialize` for `poem_openapi::types::Any<T>`.
- add `ParseError::message method` to get the error message.

# [5.1.1] 2024-09-13

Expand Down
2 changes: 1 addition & 1 deletion poem-openapi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poem-openapi"
version = "5.1.1"
version = "5.1.3"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
48 changes: 24 additions & 24 deletions poem-openapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
<img src="https://img.shields.io/badge/unsafe-forbidden-success.svg?style=flat-square"
alt="Unsafe Rust forbidden" />
</a>
<a href="https://blog.rust-lang.org/2023/11/16/Rust-1.76.0.html">
<img src="https://img.shields.io/badge/rustc-1.76.0+-ab6000.svg"
alt="rustc 1.76.0+" />
<a href="https://blog.rust-lang.org/2023/11/16/Rust-1.81.0.html">
<img src="https://img.shields.io/badge/rustc-1.81.0+-ab6000.svg"
alt="rustc 1.81.0+" />
</a>
<a href="https://discord.gg/qWWNxwasb7">
<img src="https://img.shields.io/discord/932986985604333638.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2" />
Expand All @@ -50,26 +50,26 @@ important business implementations.

To avoid compiling unused dependencies, Poem gates certain features, some of which are disabled by default:

| Feature | Description |
|------------------|----------------------------------------------------------------------------------------|
| chrono | Integrate with the [`chrono` crate](https://crates.io/crates/chrono). |
| time | Integrate with the [`time` crate](https://crates.io/crates/time). |
| humantime | Integrate with the [`humantime` crate](https://crates.io/crates/humantime) |
| openapi-explorer | Add OpenAPI Explorer support |
| swagger-ui | Add swagger UI support |
| rapidoc | Add RapiDoc UI support |
| redoc | Add Redoc UI support |
| email | Support for email address string |
| hostname | Support for hostname string |
| uuid | Integrate with the [`uuid` crate](https://crates.io/crates/uuid) |
| url | Integrate with the [`url` crate](https://crates.io/crates/url) |
| geo | Integrate with the [`geo-types` crate](https://crates.io/crates/geo-types) |
| bson | Integrate with the [`bson` crate](https://crates.io/crates/bson) |
| rust_decimal | Integrate with the [`rust_decimal` crate](https://crates.io/crates/rust_decimal) |
| prost-wkt-types | Integrate with the [`prost-wkt-types` crate](https://crates.io/crates/prost-wkt-types) |
| static-files | Support for static file response |
| websocket | Support for websocket |
|sonic-rs | Uses [`sonic-rs`](https://github.com/cloudwego/sonic-rs) instead of `serde_json`. Pls, checkout `sonic-rs` requirements to properly enable `sonic-rs` capabilities |
| Feature | Description |
|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| chrono | Integrate with the [`chrono` crate](https://crates.io/crates/chrono). |
| time | Integrate with the [`time` crate](https://crates.io/crates/time). |
| humantime | Integrate with the [`humantime` crate](https://crates.io/crates/humantime) |
| openapi-explorer | Add OpenAPI Explorer support |
| swagger-ui | Add swagger UI support |
| rapidoc | Add RapiDoc UI support |
| redoc | Add Redoc UI support |
| email | Support for email address string |
| hostname | Support for hostname string |
| uuid | Integrate with the [`uuid` crate](https://crates.io/crates/uuid) |
| url | Integrate with the [`url` crate](https://crates.io/crates/url) |
| geo | Integrate with the [`geo-types` crate](https://crates.io/crates/geo-types) |
| bson | Integrate with the [`bson` crate](https://crates.io/crates/bson) |
| rust_decimal | Integrate with the [`rust_decimal` crate](https://crates.io/crates/rust_decimal) |
| prost-wkt-types | Integrate with the [`prost-wkt-types` crate](https://crates.io/crates/prost-wkt-types) |
| static-files | Support for static file response |
| websocket | Support for websocket |
| sonic-rs | Uses [`sonic-rs`](https://github.com/cloudwego/sonic-rs) instead of `serde_json`. Pls, checkout `sonic-rs` requirements to properly enable `sonic-rs` capabilities |

## Safety

Expand Down Expand Up @@ -131,7 +131,7 @@ hello, sunli!

## MSRV

The minimum supported Rust version for this crate is `1.76.0`.
The minimum supported Rust version for this crate is `1.81.0`.

## Contributing

Expand Down
5 changes: 5 additions & 0 deletions poem-openapi/src/types/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ impl<T: Type> ParseError<T> {
pub fn into_message(self) -> String {
self.message
}

/// Return the error message.
pub fn message(&self) -> &str {
&self.message
}
}

/// An error parsing a value of type `T`.
Expand Down
19 changes: 18 additions & 1 deletion poem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [3.1.4] 2024-11-20

- Add `Server::http2_max_header_list_size` method to set the max size of received header frames.
- Update MSRV to `1.81.0`

# [3.1.3] 2024-10-21

- Add `Middlware::combine_if` method.

# [3.1.2] 2024-10-21

- Add `Middlware::combine` method to combine two middlewares.

# [3.1.1] 2024-10-02

- Add `WebSocket::config` method to set the WebSocket configuration.

# [3.1.0] 2024-09-08

- build(deps): update nix requirement from 0.28.0 to 0.29.0 [#851](https://github.com/poem-web/poem/pull/851)
Expand All @@ -14,7 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- feat: allow to set a custom name for the csrf cookie (#801) [#864](https://github.com/poem-web/poem/pull/864)
- add `sonic-rs` feature to replace `serde_json` with `sonic_rs` [#819](https://github.com/poem-web/poem/pull/819)
- fix: setting path pattern in opentelemetry traces [#878](https://github.com/poem-web/poem/pull/878)
- update MSRV to `1.76.0`
- update MSRV to `1.81.0`
- feat: implement StdErr for poem::Error [#868](https://github.com/poem-web/poem/pull/868)


Expand Down
2 changes: 1 addition & 1 deletion poem/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poem"
version = "3.1.0"
version = "3.1.4"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
8 changes: 4 additions & 4 deletions poem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<img src="https://img.shields.io/badge/unsafe-forbidden-success.svg?style=flat-square"
alt="Unsafe Rust forbidden" />
</a>
<a href="https://blog.rust-lang.org/2023/11/16/Rust-1.76.0.html">
<img src="https://img.shields.io/badge/rustc-1.76.0+-ab6000.svg"
alt="rustc 1.76.0+" />
<a href="https://blog.rust-lang.org/2023/11/16/Rust-1.81.0.html">
<img src="https://img.shields.io/badge/rustc-1.81.0+-ab6000.svg"
alt="rustc 1.81.0+" />
</a>
<a href="https://discord.gg/qWWNxwasb7">
<img src="https://img.shields.io/discord/932986985604333638.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2" />
Expand Down Expand Up @@ -108,7 +108,7 @@ More examples can be found [here][examples].

## MSRV

The minimum supported Rust version for this crate is `1.76.0`.
The minimum supported Rust version for this crate is `1.81.0`.

## Contributing

Expand Down
5 changes: 4 additions & 1 deletion poem/src/endpoint/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,12 @@ where
}
}

/// Combines two different endpoints for [`Endpoint::with_if`].
/// The enum `EitherEndpoint` with variants `Left`` and `Right` is a general
/// purpose sum type with two cases.
pub enum EitherEndpoint<A, B> {
/// A endpoint of type `A`
A(A),
/// A endpoint of type `B`
B(B),
}

Expand Down
Loading

0 comments on commit e3eb3f4

Please sign in to comment.