Skip to content

fix: tidy up leftovers from #1470 and #1471 - #1508

Open
pjfanning wants to merge 1 commit into
apache:mainfrom
pjfanning:tidy-1470-1471
Open

pjfanning wants to merge 1 commit into
apache:mainfrom
pjfanning:tidy-1470-1471

Conversation

@pjfanning

Copy link
Copy Markdown
Member

Motivation:
A couple of loose ends from #1470 and #1471, found when re-reading them after merge.

Modification:

Result:
Content-Type and Link share one media-type grammar, and Encoder, Decoder and HttpMessage.encoding treat a raw Content-Encoding header the same way. The parser always produces the modeled Content-Encoding, so the encoding change only matters for messages built by hand.

Tests:

  • http-core/testOnly HttpHeaderSpec HeaderSpec HttpMessageSpec HttpHeaderParserCRLFSpec HttpHeaderParserLFSpec: 210 passed. New: Link with empty slots in type, and HttpMessage.encoding with no, modeled, raw and unparseable raw headers.
  • http-tests/testOnly CodingDirectivesSpec CodersSpec: 86 passed. New: decodeRequestWith(Gzip) decodes a request with a raw Content-Encoding: gzip.
  • http-core/mimaReportBinaryIssues, http/mimaReportBinaryIssues: passed

References:
Refs #1470, #1471. The related Decoder.decodeMessage issue (decoding regardless of the header value) is #1507.

🤖 Generated with Claude Code

Motivation:
apache#1471 accepted empty parameter slots in Content-Type by copying the
media-type grammar, so the shared rule, which the Link header's `type`
parameter uses, stayed strict. apache#1470 made Encoder and Decoder recognise
a raw Content-Encoding header, but HttpMessage.encoding (and so
requestEncodedWith and decodeRequestWith) still only saw the modeled
header.

Modification:
- Allow empty parameter slots in the shared `media-type` rule and use it
  for Content-Type again, so Link's `type` parameter accepts them too.
- Drop the http-model.md paragraph about empty slots, which describes
  standard parser behaviour users can't configure.
- HttpMessage.encoding reads a raw Content-Encoding header when there is
  no modeled one. A value that doesn't parse is reported as a custom
  encoding, not identity, so the encoded entity can't pass as unencoded.

Result:
Content-Type and Link share one media-type grammar, and a raw
Content-Encoding header is treated the same by Encoder, Decoder and
HttpMessage.encoding.

Tests:
- http-core/testOnly HttpHeaderSpec HeaderSpec HttpMessageSpec
  HttpHeaderParserCRLFSpec HttpHeaderParserLFSpec: 210 passed
- http-tests/testOnly CodingDirectivesSpec CodersSpec: 86 passed
- http-core/mimaReportBinaryIssues, http/mimaReportBinaryIssues: passed

References:
Refs apache#1470, apache#1471
@pjfanning pjfanning added this to the 2.1.0 milestone Nov 18, 2026
@pjfanning
pjfanning requested a review from He-Pin November 18, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant