aboutsummaryrefslogtreecommitdiff
path: root/http/response/html/html.go
diff options
context:
space:
mode:
authorGravatar Romain de Laage <romain.delaage@rdelaage.ovh> 2023-02-25 09:36:19 +0100
committerGravatar Frédéric Guillot <f@miniflux.net> 2023-02-25 15:57:59 -0800
commit2c2700a31d7349f67016a3786125597f9ee38c56 (patch)
tree9a9cef0c5d6a17946be70e709cf1d0349d05bc77 /http/response/html/html.go
parent8f9ccc6540be9d637b812985936f064bada8fcf3 (diff)
downloadv2-2c2700a31d7349f67016a3786125597f9ee38c56.tar.gz
v2-2c2700a31d7349f67016a3786125597f9ee38c56.tar.zst
v2-2c2700a31d7349f67016a3786125597f9ee38c56.zip
Proxy support for several media types
closes #615 closes #635
Diffstat (limited to 'http/response/html/html.go')
-rw-r--r--http/response/html/html.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/http/response/html/html.go b/http/response/html/html.go
index f529d4aa..c7bf1faf 100644
--- a/http/response/html/html.go
+++ b/http/response/html/html.go
@@ -72,3 +72,16 @@ func NotFound(w http.ResponseWriter, r *http.Request) {
func Redirect(w http.ResponseWriter, r *http.Request, uri string) {
http.Redirect(w, r, uri, http.StatusFound)
}
+
+// RequestedRangeNotSatisfiable sends a range not satisfiable error to the client.
+func RequestedRangeNotSatisfiable(w http.ResponseWriter, r *http.Request, contentRange string) {
+ logger.Error("[HTTP:Range Not Satisfiable] %s", r.URL)
+
+ builder := response.New(w, r)
+ builder.WithStatus(http.StatusRequestedRangeNotSatisfiable)
+ builder.WithHeader("Content-Type", "text/html; charset=utf-8")
+ builder.WithHeader("Cache-Control", "no-cache, max-age=0, must-revalidate, no-store")
+ builder.WithHeader("Content-Range", contentRange)
+ builder.WithBody("Range Not Satisfiable")
+ builder.Write()
+}