Skip to content

Commit

Permalink
Disable chunked transfer encoding in rss endpoint (#3901)
Browse files Browse the repository at this point in the history
Signed-off-by: Sergio Castaño Arteaga <tegioz@icloud.com>
  • Loading branch information
tegioz authored Jun 25, 2024
1 parent c96f698 commit 143a70e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/handlers/pkg/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,17 @@ func (h *Handlers) RssFeed(w http.ResponseWriter, r *http.Request) {
return vj.LessThan(vi)
})
}
rss, err := feed.ToRss()
if err != nil {
h.logger.Error().Err(err).Str("method", "RssFeed").Send()
helpers.RenderErrorJSON(w, err)
return
}

data := []byte(rss)
w.Header().Set("Cache-Control", helpers.BuildCacheControlHeader(helpers.DefaultAPICacheMaxAge))
_ = feed.WriteRss(w)
w.Header().Set("Content-Length", strconv.Itoa(len(data)))
_, _ = w.Write(data)
}

// Search is an http handler used to search for packages in the hub database.
Expand Down

0 comments on commit 143a70e

Please sign in to comment.