aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/packages/rubygems
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-11-17 18:55:15 +0100
committerGitHub <noreply@github.com>2022-11-18 01:55:15 +0800
commit43ab9324c579a393f778d6842c577a872d0e4265 (patch)
tree0895b0e0e6d7e4182fd193459d0ac3ee0a30fb40 /routers/api/packages/rubygems
parentc144942b23eb6e05a60526cc6d2b88b488ca75dd (diff)
downloadgitea-43ab9324c579a393f778d6842c577a872d0e4265.tar.gz
gitea-43ab9324c579a393f778d6842c577a872d0e4265.zip
Fix setting HTTP headers after write (#21833)
The headers can't be modified after it was send to the client.
Diffstat (limited to 'routers/api/packages/rubygems')
-rw-r--r--routers/api/packages/rubygems/rubygems.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/routers/api/packages/rubygems/rubygems.go b/routers/api/packages/rubygems/rubygems.go
index eeae21146c..4adfb15731 100644
--- a/routers/api/packages/rubygems/rubygems.go
+++ b/routers/api/packages/rubygems/rubygems.go
@@ -77,7 +77,9 @@ func enumeratePackages(ctx *context.Context, filename string, pvs []*packages_mo
})
}
- ctx.SetServeHeaders(filename + ".gz")
+ ctx.SetServeHeaders(&context.ServeHeaderOptions{
+ Filename: filename + ".gz",
+ })
zw := gzip.NewWriter(ctx.Resp)
defer zw.Close()
@@ -115,7 +117,9 @@ func ServePackageSpecification(ctx *context.Context) {
return
}
- ctx.SetServeHeaders(filename)
+ ctx.SetServeHeaders(&context.ServeHeaderOptions{
+ Filename: filename,
+ })
zw := zlib.NewWriter(ctx.Resp)
defer zw.Close()