Sha256: 07f73918e2ae5e91ca17b4cd0f81ee86386b5c84a1d8acf07561d90a92fa4bd3

Contents?: true

Size: 983 Bytes

Versions: 139

Compression:

Stored size: 983 Bytes

Contents

require File.expand_path('../spec_helper.rb', __FILE__)

describe Rack::Protection::RemoteReferrer do
  it_behaves_like "any rack application"

  it "accepts post requests with no referrer" do
    post('/').should be_ok
  end

  it "does not accept post requests with no referrer if allow_empty_referrer is false" do
    mock_app do
      use Rack::Protection::RemoteReferrer, :allow_empty_referrer => false
      run DummyApp
    end
    post('/').should_not be_ok
  end

  it "should allow post request with a relative referrer" do
    post('/', {}, 'HTTP_REFERER' => '/').should be_ok
  end

  it "accepts post requests with the same host in the referrer" do
    post('/', {}, 'HTTP_REFERER' => 'http://example.com/foo', 'HTTP_HOST' => 'example.com')
    last_response.should be_ok
  end

  it "denies post requests with a remote referrer" do
    post('/', {}, 'HTTP_REFERER' => 'http://example.com/foo', 'HTTP_HOST' => 'example.org')
    last_response.should_not be_ok
  end
end

Version data entries

139 entries across 134 versions & 23 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/rack-protection-1.5.5/spec/remote_referrer_spec.rb