Sha256: d2aa022295ce8a5200a57d804e3583233685d3b10286e0085d8704fd41ac0cbc

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 Bytes

Contents

module LocalPac
  class FileServer < Sinatra::Base
    use Rack::Deflater

    configure do
      mime_type :proxy_pac_file, 'application/x-ns-proxy-autoconfig'
    end

    not_found do
      "Sorry, but I cant' find proxy-pac-file \"#{env['sinatra.error'].message}\"."
    end

    get '/' do
      redirect to('/v1/pac/proxy.pac')
    end

    get '/v1/pac/:name' do
      content_type :proxy_pac_file

      manager = PacManager.new
      file = manager.find(params[:name])

      if file.nil?
        fail Sinatra::NotFound, params[:name]
      else
        file.content 
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
local_pac-0.0.7 lib/local_pac/file_server.rb