Sha256: e0c0891d338415b67b8fcddc012cc5549e56688ea2f648b141178a1b1e6c92a6
Contents?: true
Size: 647 Bytes
Versions: 42
Compression:
Stored size: 647 Bytes
Contents
require 'uri' # This class is for https://github.com/pact-foundation/pact_broker/issues/101 # curl -i "http://127.0.0.1:9292/<script>" module Rack module PactBroker class InvalidUriProtection def initialize app @app = app end def call env if valid_uri? env @app.call(env) else [404, {}, []] end end def valid_uri? env begin parse(::Rack::Request.new(env).url) true rescue URI::InvalidURIError, ArgumentError false end end def parse uri URI.parse(uri) end end end end
Version data entries
42 entries across 42 versions & 1 rubygems