-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace ServeStream
with ServeContent
#20903
Conversation
I guess the question is if we think this is a significant slowdown because of this? A possibility might be to use ServeFile to somehow avoid it if necessary. |
Co-authored-by: delvh <dev.lh@web.de>
Yes. The best solution is if https://cs.opensource.google/go/go/+/refs/tags/go1.19:src/net/http/fs.go;drc=8d57f4dcef5d69a0a3f807afaa9625018569010b;bpv=1;bpt=1;l=221 would be exported. Then we could simply pass the content size and the seek would just occur if it is needed because of the http range header. It's just unnecessary work at the moment. |
I wonder if we can instead refactor to use ServeFile instead but I'm not certain how worth it it would be |
Codecov Report
@@ Coverage Diff @@
## main #20903 +/- ##
=======================================
Coverage ? 46.84%
=======================================
Files ? 993
Lines ? 136758
Branches ? 0
=======================================
Hits ? 64059
Misses ? 64836
Partials ? 7863
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
* upstream/main: Add whitespace removal inside template curly brackes (go-gitea#20853) Only show relevant repositories on explore page (go-gitea#19361) Replace `ServeStream` with `ServeContent` (go-gitea#20903) Update JS dependencies (go-gitea#20950) chore: remove broken gitea-format-imports (go-gitea#20952)
* Replace ServeStream with ServeContent. * Update modules/timeutil/timestamp.go Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Signed-off-by: Andrew Thornton <art27@cantab.net>
PR from Discord
Replace
ServeStream
withServeContent
which enabled HTTP range support for downloads. Only the package registry and the repo archiver useServeStream
.A possible downside may be that
http.ServeContent
uses theSeek
method to get the length of the stream. Sadly there is no way to pass the size as parameter even if we know it.