fix(nc/webdav): drop Content-Length on HEAD when body is empty
handle_head was declaring `Content-Length: file.size` while writing
`Body::empty()` — on a keep-alive connection the client waits forever
for N bytes that never come. Hyper now derives Content-Length: 0 from
the actual body, which is honest about what's on the wire.
RFC 7231 §4.3.2 suggests HEAD return the same headers as GET, but
lying about Content-Length is worse than omitting it: NC and Sabre
clients use PROPFIND for size anyway, and curl -I (and any client
applying HEAD semantics) gets the same ETag/MIME/Last-Modified it
needs. Caught by the F6b test which uses `curl -X HEAD` to read the
current ETag before a conditional PUT.
Also adds `nc_status_propfind_depth0` to lib/dav_helpers.sh so the
F11/F11b assertions ("did the intermediate parent get auto-created?")
can compile.
This commit is contained in:
@@ -84,6 +84,14 @@ dav_curl() {
|
||||
curl -s -H "Authorization: Bearer $TOKEN" "$@"
|
||||
}
|
||||
|
||||
# Return the HTTP status code of a `PROPFIND Depth: 0` against the
|
||||
# given NC URL. Used by existence assertions ("did this collection
|
||||
# silently get auto-created?") where the only thing the caller cares
|
||||
# about is the status (404 → absent, 207 → present).
|
||||
nc_status_propfind_depth0() {
|
||||
nc_curl -o /dev/null -w "%{http_code}" -X PROPFIND -H "Depth: 0" "$1"
|
||||
}
|
||||
|
||||
# Count `<d:response>` (or `<D:response>`) children in a multistatus
|
||||
# body. Case-insensitive on the namespace prefix because OxiCloud's
|
||||
# two DAV surfaces use different cases: the NC handler emits
|
||||
|
||||
Reference in New Issue
Block a user