You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(net-http-headers): accept the obsolete HTTP-date forms, and stop reading a short year as 94 AD (#2130)
The shared parser accepted only the preferred IMF-fixdate form. RFC 9110 5.6.7
requires a RECIPIENT to accept three.
#2125 was right on both counts: neither obsolete form had ever been accepted
here, so its full-consumption repair could not have narrowed one away, and
closing the gap "is a WIDENING and belongs to #2130, which is deferred because
/rv is absent". It is not absent now, and the answer is yes -- HttpDateParser
.TryParse tries strict "r" and then twenty-one format strings, four of them
RFC 850 and one ANSI C asctime.
All three required forms now parse, and a test asserts they denote the SAME
instant rather than checking each separately.
THE WIDENING UNCOVERED A LATENT DEFECT, and it is the most valuable thing here.
"Sun, 06 Nov 94 08:49:37 GMT" was not rejected: the %d conversion read 94
literally, so the parser reported the year 94 AD. A silently wrong instant, off
by nineteen centuries, and no test had noticed. .NET accepts the same text and
reads 1994. That row is therefore a CORRECTION, not a widening -- the port's
answer was wrong rather than merely strict.
The two-digit-year window is .NET's, not the naive 1900+yy:
DateTimeFormatInfo.InvariantInfo's calendar has TwoDigitYearMax == 2029, so
00..29 are 2000..2029 and 30..99 are 1930..1999. Both ends are pinned and the
naive window is caught by a mutation. Only an exactly-two-digit token is
expanded, so a four-digit year keeps meaning what it says.
The obsolete forms obey every rule the preferred form does: #2125's
full-consumption rule and the embedded-NUL guard both apply, and a mutation
catches RFC 850 skipping the consumption check.
Sixteen further .NET formats are deliberately NOT adopted and are pinned as
such. They are leniency rather than required forms; each carries its own
ambiguity -- a bare time is only UTC because .NET assumes it is, and an RFC 5322
offset means the value is NOT UTC, which every consumer of this parser currently
assumes it is. That is ticket #2360.
+4 tests, the gated pin replaced. Five mutations, all caught.
Gate: 17,251 run, 0 failed, 38 executables -- green.
Record: docs/Migration-HttpDateObsoleteFormats.md.
0 commit comments