813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
|
# File 'lib/libgems/server.rb', line 813
def specs(req, res)
@source_index.refresh!
add_date res
specs = @source_index.sort.map do |_, spec|
platform = spec.original_platform
platform = LibGems::Platform::RUBY if platform.nil?
[spec.name, spec.version, platform]
end
specs = Marshal.dump specs
if req.path =~ /\.gz$/ then
specs = LibGems.gzip specs
res['content-type'] = 'application/x-gzip'
else
res['content-type'] = 'application/octet-stream'
end
if req.request_method == 'HEAD' then
res['content-length'] = specs.length
else
res.body << specs
end
end
|