Skip to content

Fix RFC 850 two-digit year parsing - #1951

Open
medz wants to merge 4 commits into
dart-lang:masterfrom
medz:fix/rfc850-two-digit-year
Open

Fix RFC 850 two-digit year parsing#1951
medz wants to merge 4 commits into
dart-lang:masterfrom
medz:fix/rfc850-two-digit-year

Conversation

@medz

@medz medz commented Jul 10, 2026

Copy link
Copy Markdown

Summary

  • resolve RFC 850 two-digit years relative to the current UTC year
  • apply RFC 9110's 50-year rollover rule
  • add a regression test for the reported 2026 date
  • update the API documentation and changelog

Root cause

parseHttpDate() always added 1900 to RFC 850's two-digit year, so 26 was parsed as 1926 regardless of the current year.

Impact

RFC 850 timestamps such as those used in Retry-After headers now resolve to the correct century instead of potentially being treated as expired.

Closes #1939

Validation

  • dart format --output=none --set-exit-if-changed .
  • dart analyze --fatal-infos
  • dart test --platform vm
  • dart test --platform chrome
  • dart test --platform chrome --compiler dart2wasm

@medz
medz marked this pull request as ready for review July 10, 2026 03:00
@github-actions

Copy link
Copy Markdown

PR Health

Unused Dependencies ✔️
Package Status
http_parser ✔️ All dependencies utilized correctly.

For details on how to fix these, see dependency_validator.

This check can be disabled by tagging the PR with skip-unused-dependencies-check.

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
http_parser None 4.1.2 4.1.3-wip 4.1.3-wip ✔️

This check can be disabled by tagging the PR with skip-breaking-check.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbol Leaking sources

This check can be disabled by tagging the PR with skip-leaking-check.

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

Coverage ✔️
File Coverage
pkgs/http_parser/lib/src/http_date.dart 💚 100 %

This check for test coverage is informational (issues shown here will not fail the PR).

This check can be disabled by tagging the PR with skip-coverage-check.

License Headers ✔️
// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/cupertino_http/example/example.dart
pkgs/http/example/main.dart
pkgs/http_multi_server/test/cert.dart

This check can be disabled by tagging the PR with skip-license-check.

Comment thread pkgs/http_parser/lib/src/http_date.dart
Comment thread pkgs/http_parser/CHANGELOG.md Outdated
medz and others added 2 commits July 21, 2026 12:39
@medz
medz requested a review from brianquinlan July 21, 2026 04:43
@brianquinlan

Copy link
Copy Markdown
Collaborator

Could you fix the lint so that I can merge this?

@medz

medz commented Aug 4, 2026

Copy link
Copy Markdown
Author

Could you fix the lint so that I can merge this?

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[http_parser] parseHttpDate does not apply RFC 850 two-digit year rule

2 participants