fix(network): modernize WebDAV date parsing - #2138
Draft
joshtrichards wants to merge 5 commits into
Draft
Conversation
Replace the legacy multi-format SimpleDateFormat parser with thread-local, non-lenient parsers for current Nextcloud HTTP and Share API date formats. Require complete input consumption and interpret HTTP dates in UTC while preserving the existing millisecond-based date model. Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Replace legacy SimpleDateFormat parsing with strict, thread-safe DateTimeFormatter instances for current WebDAV and Share API date formats. Signed-off-by: Josh <josh.t.richards@gmail.com>
Add RFC 850 and ANSI C asctime() parsing to preserve compatibility with obsolete but valid HTTP-date representations, including the RFC-defined handling of two-digit years. Signed-off-by: Josh <josh.t.richards@gmail.com>
Add unit tests for IMF-fixdate, RFC 850, and ANSI C asctime() parsing, including strict validation, null and empty inputs, and RFC 850 compatibility. Also verify dedicated Share API expiration parsing, 24-hour timestamps, invalid dates, and rejection of HTTP-date values. Assisted-by: Copilot:gpt-5.6-luna Signed-off-by: Josh <josh.t.richards@gmail.com>
Contributor
Collaborator
|
stable34-IT test failed: https://www.kaminsky.me/nc-dev/android-library-integrationTests/2138-IT-stable34-16-16/debug/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace legacy
SimpleDateFormatparsing with strict, thread-safeDateTimeFormatterinstances for WebDAV and Share API date formats.The change also separates HTTP/WebDAV date parsing from Share API expiration parsing.
Retains support for legacy HTTP date formats, though I nearly left it out, as I highly doubt that part is really needed.
Changes:
SimpleDateFormatarray.asctime()HTTP dates.ShareXMLParserto use the Share API-specific parser.The previous implementation tried a shared list of unrelated formats in sequence, synchronized access to mutable
SimpleDateFormatinstances, and used exceptions for normal format probing. This was especially inefficient for Share API expiration values, whose matching format appeared near the end of the list.Dedicated immutable formatters now select the appropriate HTTP/WebDAV or Share API format directly, avoiding unnecessary parse attempts, exception overhead, and lock contention.
🤖 AI (if applicable)