Skip to content

feat: add partial update support#331

Open
janlay wants to merge 1 commit into
hacdias:mainfrom
janlay:add-partial-put-support
Open

feat: add partial update support#331
janlay wants to merge 1 commit into
hacdias:mainfrom
janlay:add-partial-put-support

Conversation

@janlay

@janlay janlay commented May 16, 2026

Copy link
Copy Markdown

Summary

Adds partial update support for WebDAV clients that require range-based writes, especially webdavfs.

This includes support for:

  • PATCH with X-Update-Range
  • PUT with Content-Range
  • advertising sabredav-partialupdate via the DAV response header
  • exposing Accept-Patch: application/x-sabredav-partialupdate

Motivation

Some WebDAV clients, such as miquels/webdavfs, probe for PUT range support before mounting read-write. Without partial update support, they fall back to read-only mode with:

no PUT Range support, mounting read-only

Advertising and implementing SabreDAV-style partial updates allows these clients to mount read-write.

Changes

  • Intercept OPTIONS to advertise partial update capability.
  • Handle partial updates before delegating to golang.org/x/net/webdav.
  • Add PATCH permission handling equivalent to PUT.
  • Add CORS defaults for PATCH, Content-Range, and X-Update-Range.
  • Add tests for:
    • OPTIONS partial update headers
    • PATCH partial writes
    • sparse partial file creation
    • PUT with Content-Range

Testing

go test ./...
go build -o webdav .

Also manually verified with webdavfs on Debian:

sudo mount -t webdavfs -o"username=user,password=pass,allow_other,rw" http://10.0.0.2:6065 /mnt/test

The mount succeeds as read-write and no longer reports missing PUT range support. A mounted-file partial overwrite test also passed.

@hacdias

hacdias commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Hi @janlay! Could you open this PR to add the partial update support on the upstream library: https://cs.opensource.google/go/x/net/+/master:webdav/?

@janlay

janlay commented Jun 5, 2026

Copy link
Copy Markdown
Author

Hi @hacdias, this repo is more application-oriented than the official one, making it easier to implement; whereas that repo implementation is very low level and requires quite a long time. I’m trying to build on the existing code in that repo and achieve partial update capability with as few changes as possible. And I can’t estimate how long it will take to complete.

So, I hope to merge it here first, so that users can enjoy the full-featured WebDAV server. In the future, if the improvements are accepted in the official repo, then we can simplify this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants