Skip to content
Snippets Groups Projects
Commit b1bd0d22 authored by Kamil Trzcińśki's avatar Kamil Trzcińśki
Browse files

Support download acceleration using X-Sendfile

parent bce3d33c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -293,7 +293,15 @@ module API
header['Content-Disposition'] = "attachment; filename=#{filename}"
header['Content-Transfer-Encoding'] = 'binary'
content_type content_type
file FileStreamer.new(path)
# Support download acceleration
case headers['X-Sendfile-Type']
when 'X-Sendfile'
header['X-Sendfile'] = path
body
else
file FileStreamer.new(path)
end
end
 
private
Loading
Loading
Loading
Loading
@@ -95,7 +95,6 @@ module Ci
not_found!
end
 
# TODO: this is slow, because it doesn't support Rack::Sendfile
present_file!(build.artifact_file.path, build.artifact_file.filename)
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment