mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 16:24:14 +00:00
caldav: set content length header for HEAD/GET requests
Now that the backend can supply this value, use it for explicitly setting the header in GET/HEAD responses if available.
This commit is contained in:
parent
491af8e42c
commit
757a615e9f
@ -7,6 +7,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/emersion/go-ical"
|
"github.com/emersion/go-ical"
|
||||||
@ -321,6 +322,9 @@ func (b *backend) HeadGet(w http.ResponseWriter, r *http.Request) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", ical.MIMEType)
|
w.Header().Set("Content-Type", ical.MIMEType)
|
||||||
|
if co.ContentLength > 0 {
|
||||||
|
w.Header().Set("Content-Length", strconv.FormatInt(co.ContentLength, 10))
|
||||||
|
}
|
||||||
if co.ETag != "" {
|
if co.ETag != "" {
|
||||||
w.Header().Set("ETag", internal.ETag(co.ETag).String())
|
w.Header().Set("ETag", internal.ETag(co.ETag).String())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user