Skip to content

Commit

Permalink
Transform header names to lowercase (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
mosuem committed Jun 7, 2023
1 parent 697ba8e commit c09f2c8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.1.0-dev

- Transform headers to lowercase.

## 2.1.0

- Require Dart `3.0.0`
Expand Down
5 changes: 4 additions & 1 deletion lib/src/hpack/hpack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ class Header {
Header(this.name, this.value, {this.neverIndexed = false});

factory Header.ascii(String name, String value) {
return Header(ascii.encode(name), ascii.encode(value));
// Specs: `However, header field names MUST be converted to lowercase prior
// to their encoding in HTTP/2. A request or response containing uppercase
// header field names MUST be treated as malformed (Section 8.1.2.6).`
return Header(ascii.encode(name.toLowerCase()), ascii.encode(value));
}
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: http2
version: 2.1.0
version: 2.1.0-dev
description: A HTTP/2 implementation in Dart.
repository: https://github.com/dart-lang/http2

Expand Down

0 comments on commit c09f2c8

Please sign in to comment.