Skip to content

Commit 791408d

Browse files
authored
Do not close connection if headers received for closed stream (#38)
1 parent 6592063 commit 791408d

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

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.3.0] - 2024-10-26
4+
5+
* Do not close connection if headers received for closed stream
6+
37
## [1.2.0] - 2024-10-16
48

59
* Better error handling

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ntex-h2"
3-
version = "1.2.0"
3+
version = "1.3.0"
44
license = "MIT OR Apache-2.0"
55
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
66
description = "An HTTP/2 client and server"

src/connection.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,15 +436,13 @@ impl RecvHalfConnection {
436436
Ok(item) => Ok(item.map(move |msg| (stream, msg))),
437437
Err(kind) => Err(Either::Right(StreamErrorInner::new(stream, kind))),
438438
}
439+
} else if self.0.local_reset_ids.borrow().contains(&id) {
440+
self.encode(frame::Reset::new(id, frame::Reason::STREAM_CLOSED));
441+
Ok(None)
439442
} else if id < self.0.next_stream_id.get() {
440443
Err(Either::Left(ConnectionError::InvalidStreamId(
441444
"Received headers",
442445
)))
443-
} else if self.0.local_reset_ids.borrow().contains(&id) {
444-
Err(Either::Left(ConnectionError::StreamClosed(
445-
id,
446-
"Received headers",
447-
)))
448446
} else {
449447
// refuse stream if connection is preparing for disconnect
450448
if self

0 commit comments

Comments
 (0)