Sync signed in with Basic only, so a server that takes Digest only (Apache
mod_auth_digest, some NAS and nginx setups) answered 401 and magpie said
the password was wrong. digestTransport (RFC 7616, qop=auth, -sess too)
wraps the dav client: a 401 with a Digest challenge is sent again with a
Digest header made from the same user name and password, SHA-256 chosen
over MD5 when both are offered, and the challenge is kept, so the
requests after it carry Digest with a rising nc and Basic is not sent to
that server again. A PUT's body is made again from GetBody. A Basic
server is untouched.
Run: go test ./internal/davsync under mote-run, ok; vet darwin, linux
nogui and windows on the package. New: TestDAVDigest (MD5, SHA-256 against
a fake Digest-only server that checks response, nc replay, opaque, uri and
the PUT body), TestDAVDigestWrongPassword (still reads as a wrong
password; a Basic server is left alone).
Broken by hand: newDAV without the transport, TestDAVDigest red with
"refused the user name or password (HTTP 401)".
Not tried: a real Digest server (only the fake, built from the RFC's
formula); auth-int and SHA-512-256 are not answered. The first request of
a connection still carries Basic, as before, so a Digest-only server over
plain http sees the password once; nothing else was changed in that path.