Mola-maker opened a new pull request, #9050:
URL: https://github.com/apache/opendal/pull/9050

   # Which issue does this PR close?
   
   Closes #9049.
   
   # Rationale for this change
   
   `parse_last_modified` accepts only the IMF-fixdate format. RFC 9110 ยง5.6.7 
requires recipients to also accept the obsolete RFC 850 and asctime formats. 
When a server sends one of those, `stat` and `read` fail with `Unexpected`.
   
   # What changes are included in this PR?
   
   - `parse_last_modified` now calls a private `parse_http_date`, which tries 
RFC 2822 first. If that fails, it tries `%A, %d-%b-%y %H:%M:%S GMT` (RFC 850) 
and then `%a %b %e %H:%M:%S %Y` (asctime), and reads both as UTC. If all three 
fail, it returns the original RFC 2822 error.
   - A test covers all three formats and one invalid value.
   
   Notes:
   
   - jiff's `%y` maps two-digit years to 1969โ€“2068. RFC 9110's 50-year rule 
would read `69`โ€“`76` as 2069โ€“2076. The two only differ for `Last-Modified` 
values more than 43 years in the future.
   - jiff checks the weekday against the date, so a mismatched weekday is still 
rejected.
   
   Verification (Windows 11, rustc 1.99.1):
   
   - `cargo test -p opendal-core --lib`: 516 passed. The new test fails against 
the old implementation.
   - `cargo test -p opendal-service-http -p opendal-service-webdav --lib`: 28 
and 61 passed.
   - `cargo clippy -p opendal-core --all-targets -- -D warnings`: clean for the 
Windows host and `--target x86_64-unknown-linux-gnu`.
   - End to end, `services::Http` against a local server that sends each 
format: `stat` and `read` now succeed for all three and report 
`1994-11-06T08:49:37Z`.
   
   # Are there any user-facing changes?
   
   Objects whose `Last-Modified` header uses the RFC 850 or asctime format can 
now be stat'ed and read.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - Harness: Claude Code
   - Model: Anthropic Claude
   - Effort: default
   - Role: Found the bug by checking the header parsers against RFC 9110, 
reproduced it with the http service against a local server, wrote the fix and 
the test, and ran the checks above. A separate review pass checked jiff's `%y`, 
`%e` and whitespace handling and the other `parse_rfc2822` callers.
   
   ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to