Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: d46ead6941
...
compare: 70cc227381
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
View
22 Gemfile.lock
@@ -1,17 +1,27 @@
PATH
remote: .
specs:
- rack-block (0.1.0)
+ rack-block (0.1.1)
rack (>= 1.3)
GEM
remote: http://rubygems.org/
specs:
+ coderay (0.9.8)
diff-lcs (1.1.3)
- guard (0.8.8)
+ ffi (1.0.11)
+ guard (0.9.4)
+ ffi (>= 0.5.0)
thor (~> 0.14.6)
- guard-rspec (0.5.9)
+ guard-rspec (0.5.10)
guard (>= 0.8.4)
+ method_source (0.6.7)
+ ruby_parser (>= 2.3.1)
+ pry (0.9.7.4)
+ coderay (~> 0.9.8)
+ method_source (~> 0.6.7)
+ ruby_parser (>= 2.3.1)
+ slop (~> 2.1.0)
rack (1.3.5)
rack-protection (1.1.4)
rack
@@ -26,10 +36,14 @@ GEM
rspec-expectations (2.7.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.7.0)
+ ruby_parser (2.3.1)
+ sexp_processor (~> 3.0)
+ sexp_processor (3.0.9)
sinatra (1.3.1)
rack (~> 1.3, >= 1.3.4)
rack-protection (~> 1.1, >= 1.1.2)
tilt (~> 1.3, >= 1.3.3)
+ slop (2.1.0)
thor (0.14.6)
tilt (1.3.3)
@@ -37,7 +51,9 @@ PLATFORMS
ruby
DEPENDENCIES
+ bundler (~> 1.1.rc)
guard-rspec
+ pry
rack-block!
rack-test (> 0)
rake (> 0)
View
8 Rakefile
@@ -16,4 +16,10 @@ begin
rescue LoadError
end
-
+desc "running pry console with rack-block gem and console helpers loaded"
+task :pry do
+ $LOAD_PATH.unshift('./lib')
+ require 'pry'
+ require 'rack-block'
+ Pry.start
+end
View
1  lib/rack/block.rb
@@ -17,6 +17,7 @@ def initialize(app, &b)
@app = app
end
+ attr_reader :app
attr_accessor :ua_matchers, :ip_matchers
def call(env)
View
2  lib/rack/block/version.rb
@@ -1,5 +1,5 @@
module Rack
class Block
- VERSION = "0.1.0"
+ VERSION = "0.1.1"
end
end
View
2  rack-block.gemspec
@@ -20,6 +20,8 @@ Gem::Specification.new do |s|
s.add_runtime_dependency "rack", '>= 1.3'
+ s.add_development_dependency "bundler", '~> 1.1.rc'
+ s.add_development_dependency "pry"
s.add_development_dependency "rake", '> 0'
s.add_development_dependency "rspec", '>= 2'
s.add_development_dependency "rack-test", '> 0'
View
25 spec/integrations/normally_passes_access.rb
@@ -0,0 +1,25 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+require File.expand_path(File.dirname(__FILE__) + '/mock_app_helper')
+
+describe "Passing through accesses" do
+ describe "Normal browser's access" do
+
+ it "should pass the server response" do
+ mock_app {
+ use Rack::Block do
+ bot_access do
+ halt 404
+ end
+ end
+ run DEFAULT_APP
+ }
+
+ header "User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)"
+ ['/', '/any', '/path/blocked'].each do |path|
+ get path
+ last_response.should be_ok
+ last_response.body.should match /It is summer/
+ end
+ end
+ end
+end

No commit comments for this range

Something went wrong with that request. Please try again.