Skip to content

Commit 6a8b4f7

Browse files
authored
Merge branch 'master' into feat/awc-sni-host
2 parents 0915879 + 8200e4e commit 6a8b4f7

File tree

19 files changed

+58
-66
lines changed

19 files changed

+58
-66
lines changed

.github/workflows/ci-post-merge.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
toolchain: ${{ matrix.version.version }}
5050

5151
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
52-
uses: taiki-e/install-action@v2.45.6
52+
uses: taiki-e/install-action@v2.46.20
5353
with:
5454
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
5555

@@ -83,7 +83,7 @@ jobs:
8383
uses: actions-rust-lang/[email protected]
8484

8585
- name: Install just, cargo-hack
86-
uses: taiki-e/install-action@v2.45.6
86+
uses: taiki-e/install-action@v2.46.20
8787
with:
8888
tool: just,cargo-hack
8989

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
toolchain: ${{ matrix.version.version }}
6565

6666
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
67-
uses: taiki-e/install-action@v2.45.6
67+
uses: taiki-e/install-action@v2.46.20
6868
with:
6969
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
7070

@@ -113,7 +113,7 @@ jobs:
113113
toolchain: nightly
114114

115115
- name: Install just
116-
uses: taiki-e/install-action@v2.45.6
116+
uses: taiki-e/install-action@v2.46.20
117117
with:
118118
tool: just
119119

.github/workflows/coverage.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ jobs:
2424
components: llvm-tools
2525

2626
- name: Install just, cargo-llvm-cov, cargo-nextest
27-
uses: taiki-e/install-action@v2.45.6
27+
uses: taiki-e/install-action@v2.46.20
2828
with:
2929
tool: just,cargo-llvm-cov,cargo-nextest
3030

3131
- name: Generate code coverage
3232
run: just test-coverage-codecov
3333

3434
- name: Upload coverage to Codecov
35-
uses: codecov/codecov-action@v5.0.7
35+
uses: codecov/codecov-action@v5.1.2
3636
with:
3737
files: codecov.json
3838
fail_ci_if_error: true

.github/workflows/lint.yml

+1-28
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
toolchain: ${{ vars.RUST_VERSION_EXTERNAL_TYPES }}
7878

7979
- name: Install just
80-
uses: taiki-e/install-action@v2.45.6
80+
uses: taiki-e/install-action@v2.46.20
8181
with:
8282
tool: just
8383

@@ -88,30 +88,3 @@ jobs:
8888

8989
- name: check external types
9090
run: just check-external-types-all +${{ vars.RUST_VERSION_EXTERNAL_TYPES }}
91-
92-
public-api-diff:
93-
runs-on: ubuntu-latest
94-
steps:
95-
- name: Checkout main branch
96-
uses: actions/checkout@v4
97-
with:
98-
ref: ${{ github.base_ref }}
99-
100-
- name: Checkout PR branch
101-
uses: actions/checkout@v4
102-
103-
- name: Install Rust (${{ vars.RUST_VERSION_API_DIFF }})
104-
uses: actions-rust-lang/[email protected]
105-
with:
106-
toolchain: ${{ vars.RUST_VERSION_API_DIFF }}
107-
108-
- name: Install cargo-public-api
109-
uses: taiki-e/[email protected]
110-
with:
111-
tool: cargo-public-api
112-
113-
- name: Generate API diff
114-
run: |
115-
for f in $(find -mindepth 2 -maxdepth 2 -name Cargo.toml); do
116-
cargo public-api --manifest-path "$f" --simplified diff ${{ github.event.pull_request.base.sha }}..${{ github.sha }}
117-
done

actix-http/src/header/map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ impl<'a> Drain<'a> {
830830
}
831831
}
832832

833-
impl<'a> Iterator for Drain<'a> {
833+
impl Iterator for Drain<'_> {
834834
type Item = (Option<HeaderName>, HeaderValue);
835835

836836
fn next(&mut self) -> Option<Self::Item> {

actix-http/src/helpers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn write_content_length<B: BufMut>(n: u64, buf: &mut B, camel_case: bool) {
6161
/// perform a remaining length check before writing.
6262
pub(crate) struct MutWriter<'a, B>(pub(crate) &'a mut B);
6363

64-
impl<'a, B> io::Write for MutWriter<'a, B>
64+
impl<B> io::Write for MutWriter<'_, B>
6565
where
6666
B: BufMut,
6767
{

actix-http/src/http_message.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub trait HttpMessage: Sized {
103103
}
104104
}
105105

106-
impl<'a, T> HttpMessage for &'a mut T
106+
impl<T> HttpMessage for &mut T
107107
where
108108
T: HttpMessage,
109109
{

actix-router/src/resource_path.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl ResourcePath for String {
1919
}
2020
}
2121

22-
impl<'a> ResourcePath for &'a str {
22+
impl ResourcePath for &str {
2323
fn path(&self) -> &str {
2424
self
2525
}

actix-web-codegen/tests/routes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ async fn routes_overlapping_inaccessible_test(req: HttpRequest) -> impl Responde
136136
}
137137

138138
#[get("/custom_resource_name", name = "custom")]
139-
async fn custom_resource_name_test<'a>(req: HttpRequest) -> impl Responder {
139+
async fn custom_resource_name_test(req: HttpRequest) -> impl Responder {
140140
assert!(req.url_for_static("custom").is_ok());
141141
assert!(req.url_for_static("custom_resource_name_test").is_err());
142142
HttpResponse::Ok()

actix-web/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
[![Dependency Status](https://deps.rs/crate/actix-web/4.9.0/status.svg)](https://deps.rs/crate/actix-web/4.9.0)
1515
<br />
1616
[![CI](https://github.com/actix/actix-web/actions/workflows/ci.yml/badge.svg)](https://github.com/actix/actix-web/actions/workflows/ci.yml)
17-
[![codecov](https://codecov.io/gh/actix/actix-web/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-web)
17+
[![codecov](https://codecov.io/gh/actix/actix-web/graph/badge.svg?token=dSwOnp9QCv)](https://codecov.io/gh/actix/actix-web)
1818
![downloads](https://img.shields.io/crates/d/actix-web.svg)
1919
[![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x)
2020

actix-web/src/helpers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use bytes::BufMut;
1010
/// perform a remaining length check before writing.
1111
pub(crate) struct MutWriter<'a, B>(pub(crate) &'a mut B);
1212

13-
impl<'a, B> io::Write for MutWriter<'a, B>
13+
impl<B> io::Write for MutWriter<'_, B>
1414
where
1515
B: BufMut,
1616
{

actix-web/src/middleware/logger.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ impl FormatText {
704704
/// Converter to get a String from something that writes to a Formatter.
705705
pub(crate) struct FormatDisplay<'a>(&'a dyn Fn(&mut fmt::Formatter<'_>) -> Result<(), fmt::Error>);
706706

707-
impl<'a> fmt::Display for FormatDisplay<'a> {
707+
impl fmt::Display for FormatDisplay<'_> {
708708
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
709709
(self.0)(fmt)
710710
}

actix-web/src/resource.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ use crate::{
2828
///
2929
/// Resource in turn has at least one route. Route consists of an handlers objects and list of
3030
/// guards (objects that implement `Guard` trait). Resources and routes uses builder-like pattern
31-
/// for configuration. During request handling, resource object iterate through all routes and check
32-
/// guards for specific route, if request matches all guards, route considered matched and route
33-
/// handler get called.
31+
/// for configuration. During request handling, the resource object iterates through all routes
32+
/// and checks guards for the specific route, if the request matches all the guards, then the route
33+
/// is considered matched and the route handler gets called.
3434
///
3535
/// # Examples
3636
/// ```

actix-web/src/types/json.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ impl<T: DeserializeOwned> JsonBody<T> {
332332
(true, Ok(Some(mime))) => {
333333
mime.subtype() == mime::JSON
334334
|| mime.suffix() == Some(mime::JSON)
335-
|| ctype_fn.map_or(false, |predicate| predicate(mime))
335+
|| ctype_fn.is_some_and(|predicate| predicate(mime))
336336
}
337337

338338
// if content-type is expected but not parsable as mime type, bail

awc/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ tokio = { version = "1.24.2", features = ["rt-multi-thread", "macros"] }
153153
zstd = "0.13"
154154
tls-rustls-0_23 = { package = "rustls", version = "0.23" } # add rustls 0.23 with default features to make aws_lc_rs work in tests
155155

156-
[lints]
157-
workspace = true
158-
159156
[[example]]
160157
name = "client"
161158
required-features = ["rustls-0_23-webpki-roots"]
159+
160+
[lints]
161+
workspace = true

awc/examples/client.rs

+22-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,39 @@
1-
use std::error::Error as StdError;
1+
//! Demonstrates construction and usage of a TLS-capable HTTP client.
2+
3+
extern crate tls_rustls_0_23 as rustls;
4+
5+
use std::{error::Error as StdError, sync::Arc};
6+
7+
use actix_tls::connect::rustls_0_23::webpki_roots_cert_store;
8+
use rustls::ClientConfig;
29

3-
/// If we want to make requests to addresses starting with `https`, we need to enable the rustls feature of awc
4-
/// `awc = { version = "3.5.0", features = ["rustls"] }`
510
#[actix_rt::main]
611
async fn main() -> Result<(), Box<dyn StdError>> {
712
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
813

9-
// construct request builder
10-
let client = awc::Client::new();
14+
let mut config = ClientConfig::builder()
15+
.with_root_certificates(webpki_roots_cert_store())
16+
.with_no_client_auth();
17+
18+
let protos = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
19+
config.alpn_protocols = protos;
20+
21+
// construct request builder with TLS support
22+
let client = awc::Client::builder()
23+
.connector(awc::Connector::new().rustls_0_23(Arc::new(config)))
24+
.finish();
1125

1226
// configure request
1327
let request = client
1428
.get("https://www.rust-lang.org/")
15-
.append_header(("User-Agent", "Actix-web"));
29+
.append_header(("User-Agent", "awc/3.0"));
1630

17-
println!("Request: {:?}", request);
31+
println!("Request: {request:?}");
1832

1933
let mut response = request.send().await?;
2034

2135
// server response head
22-
println!("Response: {:?}", response);
36+
println!("Response: {response:?}");
2337

2438
// read response body
2539
let body = response.body().await?;

awc/src/client/connector.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,8 @@ where
548548
let h2 = sock
549549
.ssl()
550550
.selected_alpn_protocol()
551-
.map_or(false, |protos| protos.windows(2).any(|w| w == H2));
551+
.is_some_and(|protos| protos.windows(2).any(|w| w == H2));
552+
552553
if h2 {
553554
(Box::new(sock), Protocol::Http2)
554555
} else {
@@ -587,7 +588,8 @@ where
587588
.get_ref()
588589
.1
589590
.alpn_protocol()
590-
.map_or(false, |protos| protos.windows(2).any(|w| w == H2));
591+
.is_some_and(|protos| protos.windows(2).any(|w| w == H2));
592+
591593
if h2 {
592594
(Box::new(sock), Protocol::Http2)
593595
} else {
@@ -621,7 +623,8 @@ where
621623
.get_ref()
622624
.1
623625
.alpn_protocol()
624-
.map_or(false, |protos| protos.windows(2).any(|w| w == H2));
626+
.is_some_and(|protos| protos.windows(2).any(|w| w == H2));
627+
625628
if h2 {
626629
(Box::new(sock), Protocol::Http2)
627630
} else {
@@ -658,7 +661,8 @@ where
658661
.get_ref()
659662
.1
660663
.alpn_protocol()
661-
.map_or(false, |protos| protos.windows(2).any(|w| w == H2));
664+
.is_some_and(|protos| protos.windows(2).any(|w| w == H2));
665+
662666
if h2 {
663667
(Box::new(sock), Protocol::Http2)
664668
} else {
@@ -692,7 +696,8 @@ where
692696
.get_ref()
693697
.1
694698
.alpn_protocol()
695-
.map_or(false, |protos| protos.windows(2).any(|w| w == H2));
699+
.is_some_and(|protos| protos.windows(2).any(|w| w == H2));
700+
696701
if h2 {
697702
(Box::new(sock), Protocol::Http2)
698703
} else {

awc/src/ws.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ struct Host<'a> {
452452
port: Option<http::uri::Port<&'a str>>,
453453
}
454454

455-
impl<'a> fmt::Display for Host<'a> {
455+
impl fmt::Display for Host<'_> {
456456
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
457457
f.write_str(self.hostname)?;
458458

justfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ test-msrv: downgrade-for-msrv (test msrv_rustup)
5151
test toolchain="":
5252
cargo {{ toolchain }} test --lib --tests -p=actix-web-codegen --all-features
5353
cargo {{ toolchain }} test --lib --tests -p=actix-multipart-derive --all-features
54-
cargo {{ toolchain }} nextest run -p=actix-router --no-default-features
55-
cargo {{ toolchain }} nextest run --workspace --exclude=actix-web-codegen --exclude=actix-multipart-derive {{ all_crate_features }} --filter-expr="not test(test_reading_deflate_encoding_large_random_rustls)"
54+
cargo {{ toolchain }} nextest run --no-tests=warn -p=actix-router --no-default-features
55+
cargo {{ toolchain }} nextest run --no-tests=warn --workspace --exclude=actix-web-codegen --exclude=actix-multipart-derive {{ all_crate_features }} --filter-expr="not test(test_reading_deflate_encoding_large_random_rustls)"
5656

5757
# Test workspace docs.
5858
test-docs toolchain="": && doc
@@ -64,7 +64,7 @@ test-all toolchain="": (test toolchain) (test-docs toolchain)
6464
# Test workspace and collect coverage info.
6565
[private]
6666
test-coverage toolchain="":
67-
cargo {{ toolchain }} llvm-cov nextest --no-report {{ all_crate_features }}
67+
cargo {{ toolchain }} llvm-cov nextest --no-tests=warn --no-report {{ all_crate_features }}
6868
cargo {{ toolchain }} llvm-cov --doc --no-report {{ all_crate_features }}
6969

7070
# Test workspace and generate Codecov report.

0 commit comments

Comments
 (0)