dart-lang / http

A composable API for making HTTP requests in Dart.
https://pub.dev/packages/http
BSD 3-Clause "New" or "Revised" License
1.02k stars 353 forks source link

[http_client_conformance_tests] Add flag to skip tests for folded headers #1219

Closed Anikate-De closed 4 months ago

Anikate-De commented 4 months ago

According to the current internet standard (RFC 9110: HTTP Semantics), "\r\n" is invalid

Field values containing CR, LF, or NUL characters are invalid and dangerous, due to the varying ways that implementations might parse and interpret those characters; a recipient of CR, LF, or NUL within a field value MUST either reject the message or replace each of those characters with SP before further processing or forwarding of that message.

OkHttp (please see this) and many modern web frameworks (like Flask) reject Header values which contain such illegal characters.

However, the server headers folded headers test group adds rigidity by forcing clients to replace invalid characters with space.

I (thanks to @brianquinlan) suggest adding a boolean flag supportsFoldedHeaders to testResponseHeaders() which ultimately lets us skip the test: folded headers

Clients rejecting headers with illegal values can also be considered to be conformant to the HTTP Standard.

Anikate-De commented 4 months ago

I'm willing to take up this issue as it will be beneficial for making the upcoming package ok_http more conformant.