Repository navigation
feat(webdav): download from WebDAV servers with resume - #583
Merged
Merged
Conversation
Add library:webdav with WebDavDownloadSource for webdav(s):// and dav(s):// links: PROPFIND for size, ETag and modification time (folders refused, plain HTTP headers when PROPFIND is refused), segmented ranged GETs, resume that fails with FileChanged when the file changed, and Digest (RFC 7616) or Basic sign-in from the link or an Authorization: Basic header. Add HttpEngine.request for requests other than downloads, implemented by KtorHttpEngine and the network engines, and make httpConnectionSpec and observeExchanges public. Register the source in the apps, CLI and server, recognize the links in the apps, and document it.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c3f76584e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…rects Send If-Match with the probe's strong ETag, else If-Unmodified-Since, with every segment GET, and fail a 412 with FileChanged, so a file replaced mid-download is never stitched from two versions. Resume compares strong ETags only, falling back to Last-Modified; a weak tag is never compared, and a file with neither validator starts over. HttpReply now reports the URL that answered, and the WebDAV client moves to the target of a same-origin redirect, so Digest answers name the path the server checks.
Contributor
# Conflicts: # AGENTS.md # README.de.md # README.es.md # README.fr.md # README.ja.md # README.md # README.zh-CN.md
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.
Implements the WebDAV roadmap item: download files from WebDAV servers (Nextcloud, ownCloud, a NAS, Apache
mod_dav, IIS…), with parallel connections and resume.What changed
New
library:webdavmodule (same targets as core) withWebDavDownloadSource(httpEngine):webdav:///dav://over HTTP,webdavs:///davs://over HTTPS.PROPFIND(Depth: 0) for size,getetag,getlastmodified, content type andresourcetype. Folders are refused. Servers answering403/405/501(or takingPROPFINDforGET) are read from their headers instead.SegmentedDownloadHelper, with the watchdog, throttling and live connection reporting as for HTTP. Content of unknown size is streamed.FileChangedwhen the ETag (weak prefix and quotes ignored), else the modification time, or the size differs.Authorization: Basicheader (what the apps' Sign in adds). Nothing is sent before a401. Digest (RFC 7616: SHA-256 or MD5,-sess,qop=auth,userhash) is used when offered, else Basic, with a warning over plain HTTP. A nonce that expires mid-download is answered again once. Missing or refused credentials giveAuthenticationFailed.Core and Ktor
HttpEngine.request(method, url, headers, body, maxBodyBytes): HttpReplyfor requests other than downloads. It returns the status and headers of any status, so callers can readWWW-Authenticate. Its default throwsUnsupportedOperationException. It is implemented byKtorHttpEngine(same redirect and header rules as other requests; never reads aHEADbody) and passed on byMultiNetworkHttpEngineandConfigurableNetworkHttpEngine.httpConnectionSpecandobserveExchangesare now public, so sources outside core can report connections like HTTP does.Apps, CLI, server
ketch <url>,--list-files,server,mcp --standalone) and the native-desktop prototype.LinkKind.WebDavmakes pasted and typed links parse, quick add and work in the palette.Docs: new
docs/webdav.md. Also updated: the README and its five translations (feature added, roadmap item removed),docs/api.md,docs/developers.md,docs/architecture.mdandAGENTS.md.Testing
:library:webdav:allTests: JVM, Android host, JS and WasmWasi. Covers the RFC 2617 and RFC 7616 Digest vectors, challenge parsing, XML and multistatus parsing, URL handling, and the source againstFakeDavServer(segments, no ranges, unknown size, Digest, stale nonce, Basic header, bearer passthrough, wrong credentials, resume, changed file, emptied local file).WebDavIntegrationTest(jvmTest): a JDKHttpServerrequiring Digest, driven throughKtorHttpEngineand a realKetch. Covers a segmented download, pause/resume from the right byte with a rotated nonce, a changed file, a wrong password, a folder, and a link with unencoded spaces and CJK characters.:library:core:jvmTestand:library:ktor:jvmTest(5 new tests forrequest) pass, as do theLinkParserTestandIntakeProblemsTestapp tests.:cli,:app:desktop,:app:android(direct debug),:app:sharedfor iOS simulator, and the webdav module's iOS tests.Limits
One file per link (no collection downloads), no NTLM/Negotiate, and no Digest
auth-int.