Коммит b1bd0d22 создал по автору Kamil Trzcinski's avatar Kamil Trzcinski
Просмотр файлов

Support download acceleration using X-Sendfile

владелец bce3d33c
......@@ -293,7 +293,15 @@ def present_file!(path, filename, content_type = 'application/octet-stream')
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
......
......@@ -95,7 +95,6 @@ class Builds < Grape::API
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
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать