x/net/webdav: MOVE
without an Overwrite
header does not default to T
#66059
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
go version go1.22.0 darwin/amd64
Output of
go env
in your module/workspace:What did you do?
I have a simple WebDAV server:
I'm using the builtin macOS WebDAV client (from Finder.app:
Go > Network
). I then connect to the WebDAV and try to move a file to a destination that already exists (ie overwriting the destination file with the source file).What did you see happen?
What did you expect to see?
It should overwrite the destination file with the source file and remove the source file. There should be no error.
I did some investigation and discovered that the macOS WebDAV client doesn't appear to set the
Overwrite
header when doing aMOVE
operation. I grabbed the traffic with WireShark:According to the WebDAV spec:
However, the current implementation doesn't seem to do this. Instead it returns a 412 because it seems to assume the
Overwrite
header will always exist.I think one solution would be to replace
r.Header.Get("Overwrite") == "T"
withr.Header.Get("Overwrite") != "F"
. I forkedx/net
and it seemed to work for me—if you're happy with this as a solution I'm happy to raise a PR.However, it's also worth noting that the specification says:
I interpret this to mean "any value for
Overwrite
other thatT
orF
should be rejected". I guess this means that the use ofr.Header.Get("Overwrite") != "F"
would also be technically incorrect too but it'd seem unlikely to cause any problems(?).Also as an aside the "
Overwite
should default toT
" behavior appears in the WebDAV modules for Apache and nginx.The text was updated successfully, but these errors were encountered: