From b0c59cdea16d7a5795169bd6434d2de188ce96a0 Mon Sep 17 00:00:00 2001 From: Conrad Hoffmann Date: Fri, 20 May 2022 15:58:52 +0200 Subject: [PATCH] carddav/caldav: use 308 for .well-known redirects This makes it a little less ambiguous (and, in case of Go clients, a lot easier) that clients should follow the redirect by sending the same PROPFIND request, including body, to the new location. See also the documentation of [http.Client.Do()][1] and the comments in [http.redirectBehavior()][2]. Confirmed to not make a difference for Evolution and Thunderbird clients. [1]: https://pkg.go.dev/net/http#Client.Do [2]: https://cs.opensource.google/go/go/+/refs/tags/go1.18.2:src/net/http/client.go;drc=d8762b2f4532cc2e5ec539670b88bbc469a13938;l=502 --- caldav/server.go | 2 +- carddav/server.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/caldav/server.go b/caldav/server.go index f98d06e..f713174 100644 --- a/caldav/server.go +++ b/caldav/server.go @@ -58,7 +58,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - http.Redirect(w, r, principalPath, http.StatusMovedPermanently) + http.Redirect(w, r, principalPath, http.StatusPermanentRedirect) return } diff --git a/carddav/server.go b/carddav/server.go index 0e3be6c..81ae875 100644 --- a/carddav/server.go +++ b/carddav/server.go @@ -57,7 +57,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - http.Redirect(w, r, principalPath, http.StatusMovedPermanently) + http.Redirect(w, r, principalPath, http.StatusPermanentRedirect) return }