Skip to content

obs-fold HTTP header fields are not parsed correctly #53185

@brianquinlan

Description

@brianquinlan

Dart 3.2

With folded headers, the RFC2616 says:

   HTTP/1.1 header field values can be folded onto multiple lines if the
   continuation line begins with a space or horizontal tab. All linear
   white space, including folding, has the same semantics as SP. A
   recipient MAY replace any linear white space with a single SP before
   interpreting the field value or forwarding the message downstream.

Existing tests verify incorrect behavior:

    request = """
POST /test HTTP/1.1\r
Header-A:   AA\r
 A\r
X-Header-B:           b\r
  b\r
\t    b\r
\r
""";

    headers = new Map();
    headers["header-a"] = "AAA";
    headers["x-header-b"] = "bbb";
    _testParseRequestLean(request, "POST", "/test", expectedHeaders: headers);

The correct header values should not have the middle whitespace stripped e.g.

    headers["header-a"] = "A A A";
    headers["x-header-b"] = "b b b";

Folded header values are obsolete according to RFC-7230 so maybe we should remove support for them?

Metadata

Metadata

Assignees

Labels

area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-io

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions