mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 16:24:14 +00:00
carddav/server: set ETag and Last-Modified if available
Some clients (e.g. Evolution) will not work properly without this. It is up to the underlying backend to actually provide this data, the headers will only be set if it is available.
This commit is contained in:
parent
0f6744ede8
commit
dc57b81662
@ -262,7 +262,12 @@ func (b *backend) HeadGet(w http.ResponseWriter, r *http.Request) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", vcard.MIMEType)
|
w.Header().Set("Content-Type", vcard.MIMEType)
|
||||||
// TODO: set ETag, Last-Modified
|
if ao.ETag != "" {
|
||||||
|
w.Header().Set("ETag", internal.ETag(ao.ETag).String())
|
||||||
|
}
|
||||||
|
if !ao.ModTime.IsZero() {
|
||||||
|
w.Header().Set("Last-Modified", ao.ModTime.UTC().Format(http.TimeFormat))
|
||||||
|
}
|
||||||
|
|
||||||
if r.Method != http.MethodHead {
|
if r.Method != http.MethodHead {
|
||||||
return vcard.NewEncoder(w).Encode(ao.Card)
|
return vcard.NewEncoder(w).Encode(ao.Card)
|
||||||
|
Loading…
Reference in New Issue
Block a user