method

quick

ruby latest stable - Class: Gem::Server
quick(req, res)
public

No documentation available.

# File lib/rubygems/server.rb, line 569
  def quick(req, res)
    reset_gems

    res['content-type'] = 'text/plain'
    add_date res

    case req.request_uri.path
    when %^/quick/(Marshal.#{Regexp.escape Gem.marshal_version}/)?(.*?)\.gemspec\.rz$| then
      marshal_format, full_name = $1, $2
      specs = Gem::Specification.find_all_by_full_name(full_name)

      selector = full_name.inspect

      if specs.empty? then
        res.status = 404
        res.body = "No gems found matching #{selector}"
      elsif specs.length > 1 then
        res.status = 500
        res.body = "Multiple gems found matching #{selector}"
      elsif marshal_format then
        res['content-type'] = 'application/x-deflate'
        res.body << Gem.deflate(Marshal.dump(specs.first))
      end
    else
      raise WEBrick::HTTPStatus::NotFound, "`#{req.path}' not found."
    end
  end