Skip to content

Commit aa93fd5

Browse files
authored
Use new errors from ntex-http (#61)
1 parent 36ee0f9 commit aa93fd5

File tree

5 files changed

+16
-21
lines changed

5 files changed

+16
-21
lines changed

.github/workflows/CI.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ jobs:
1212
name: Check Style
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: Free Disk Space
16-
uses: jlumbroso/free-disk-space@main
17-
with:
18-
tool-cache: true
19-
2015
- name: Checkout
2116
uses: actions/checkout@v1
2217

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes
22

3+
## [1.12.0] - 2025-07-08
4+
5+
* Use new errors from ntex-http
6+
37
## [1.11.0] - 2025-07-01
48

59
* Allow to skip frames for unknown streams

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ntex-h2"
3-
version = "1.11.0"
3+
version = "1.12.0"
44
license = "MIT OR Apache-2.0"
55
authors = ["Nikolay Kim <[email protected]>"]
66
description = "An HTTP/2 client and server"
@@ -25,7 +25,7 @@ features = []
2525
[dependencies]
2626
ntex-net = "2"
2727
ntex-io = "2.13"
28-
ntex-http = "0.1"
28+
ntex-http = "0.1.14"
2929
ntex-bytes = "0.1"
3030
ntex-codec = "0.6"
3131
ntex-service = "3.5"

src/client/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! Http2 client
2+
use std::rc::Rc;
23

34
mod connector;
45
mod pool;
@@ -17,7 +18,7 @@ pub use self::stream::{RecvStream, SendStream};
1718
pub enum ClientError {
1819
/// Protocol error
1920
#[error("Protocol error: {0}")]
20-
Protocol(Box<ConnectionError>),
21+
Protocol(Rc<ConnectionError>),
2122
/// Operation error
2223
#[error("Operation error: {0}")]
2324
Operation(#[from] OperationError),
@@ -29,15 +30,15 @@ pub enum ClientError {
2930
HandshakeTimeout,
3031
/// Connect error
3132
#[error("Connect error: {0}")]
32-
Connect(Box<ntex_net::connect::ConnectError>),
33+
Connect(Rc<ntex_net::connect::ConnectError>),
3334
/// Peer disconnected
3435
#[error("Peer disconnected err: {0}")]
3536
Disconnected(#[from] std::io::Error),
3637
}
3738

3839
impl From<ConnectionError> for ClientError {
3940
fn from(err: ConnectionError) -> Self {
40-
Self::Protocol(Box::new(err))
41+
Self::Protocol(Rc::new(err))
4142
}
4243
}
4344

@@ -49,7 +50,7 @@ impl From<ntex_util::channel::Canceled> for ClientError {
4950

5051
impl From<ntex_net::connect::ConnectError> for ClientError {
5152
fn from(err: ntex_net::connect::ConnectError) -> Self {
52-
Self::Connect(Box::new(err))
53+
Self::Connect(Rc::new(err))
5354
}
5455
}
5556

src/hpack/decoder.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{cmp, collections::VecDeque, io::Cursor, str::Utf8Error};
22

33
use ntex_bytes::{Buf, ByteString, Bytes, BytesMut};
4-
use ntex_http::{error, header, Method, StatusCode};
4+
use ntex_http::{compat, header, Method, StatusCode};
55

66
use super::{huffman, Header};
77

@@ -578,41 +578,36 @@ impl Table {
578578

579579
impl From<Utf8Error> for DecoderError {
580580
fn from(_: Utf8Error) -> DecoderError {
581-
// TODO: Better error?
582581
DecoderError::InvalidUtf8
583582
}
584583
}
585584

586585
impl From<()> for DecoderError {
587586
fn from(_: ()) -> DecoderError {
588-
// TODO: Better error?
589587
DecoderError::InvalidUtf8
590588
}
591589
}
592590

593591
impl From<header::InvalidHeaderValue> for DecoderError {
594592
fn from(_: header::InvalidHeaderValue) -> DecoderError {
595-
// TODO: Better error?
596593
DecoderError::InvalidUtf8
597594
}
598595
}
599596

600597
impl From<header::InvalidHeaderName> for DecoderError {
601598
fn from(_: header::InvalidHeaderName) -> DecoderError {
602-
// TODO: Better error
603599
DecoderError::InvalidUtf8
604600
}
605601
}
606602

607-
impl From<error::InvalidMethod> for DecoderError {
608-
fn from(_: error::InvalidMethod) -> DecoderError {
609-
// TODO: Better error
603+
impl From<compat::InvalidMethod> for DecoderError {
604+
fn from(_: compat::InvalidMethod) -> DecoderError {
610605
DecoderError::InvalidUtf8
611606
}
612607
}
613608

614-
impl From<error::InvalidStatusCode> for DecoderError {
615-
fn from(_: error::InvalidStatusCode) -> DecoderError {
609+
impl From<compat::InvalidStatusCode> for DecoderError {
610+
fn from(_: compat::InvalidStatusCode) -> DecoderError {
616611
// TODO: Better error
617612
DecoderError::InvalidUtf8
618613
}

0 commit comments

Comments
 (0)