Sha256: e967fda38b0942c9cedfe179b69fe86ab9b079837d4a113e87ae6e36d85286b1

Contents?: true

Size: 581 Bytes

Versions: 2

Compression:

Stored size: 581 Bytes

Contents

module LocalPac
  class FileServer < Sinatra::Base
    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

2 entries across 2 versions & 1 rubygems

Version Path
local_pac-0.0.6 lib/local_pac/file_server.rb
local_pac-0.0.5 lib/local_pac/file_server.rb