arturobernalg opened a new pull request, #1104: URL: https://github.com/apache/tomcat/pull/1104
Section 5.6.7 of RFC 9110 requires a recipient of an rfc850-date timestamp, which uses a two-digit year, to interpret a timestamp that appears to be more than 50 years in the future as the most recent year in the past that had the same last two digits. `FastHttpDateFormat` parsed that format with the default `SimpleDateFormat` window, which runs from 80 years in the past to 20 years in the future. A two-digit year that is between 20 and 50 years ahead was therefore read as a past year. For example, `Tuesday, 15-Jun-66 12:30:15 GMT` was read as 1966 when it is 2066 according to the RFC. `ConcurrentDateFormat` gets a `parse(String, Date)` method that sets the start of the 100 year period for that call only and restores it afterwards, so the shared formatters keep no state. `FastHttpDateFormat` uses it for the rfc850 format with a period that starts 50 years ago, which is what the RFC describes. `TestFastHttpDateFormat` has a new test that is relative to the current date. Without the change it fails (`expected:<3043830615000> but was:<-111929385000>`) and with it it passes. `TestConcurrentDateFormat` covers the new method. Checked over HTTP with `If-Modified-Since` and `getDateHeader()`: 66 gives 2066, 76 gives 1976, 99 gives 1999. The tests of the date handling pass (`TestRequest`, `TestExpiresFilter`, `TestDefaultServletRangeRequests`, `TestDefaultServletRfc9110Section13`, `TestCookies`) and Checkstyle reports nothing for the changed files. This is an obsolete format, so the practical impact is small. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
