robworley-rack-noie 1.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ a favor: it shows the way out of your website to poor souls out there using Inte
5
5
 
6
6
  # installation
7
7
 
8
- sudo gem install robworley-rack-noie
8
+ sudo gem install robworley-rack-noie -s http://gemcutter.org
9
9
 
10
10
  # usage
11
11
 
@@ -24,7 +24,7 @@ module Rack
24
24
 
25
25
  def is_ie?(ua_string)
26
26
  # We need at least one digit to be able to get the version, hence the \d
27
- ua_string.match(/MSIE \d/) ? true : false
27
+ ua_string.match(/MSIE \d/) && !ua_string.match(/MS Web Services Client Protocol/) ? true : false
28
28
  end
29
29
 
30
30
  def ie_version(ua_string)
@@ -32,7 +32,7 @@ module Rack
32
32
  end
33
33
 
34
34
  def kick_it
35
- [301, {'Location' => @options[:redirect]}, ['Fail browser is fail']]
35
+ [301, {'Location' => @options[:redirect]}, ['User agent not permitted.']]
36
36
  end
37
37
 
38
38
  def enforce_noie?(env)
@@ -39,6 +39,12 @@ class NoieTest < Test::Unit::TestCase
39
39
  assert_equal "Hi Internets!", response.body
40
40
  end
41
41
 
42
+ def test_dotnet_soap_client_is_not_considered_ie
43
+ request = Rack::MockRequest.new(Rack::NoIE.new(TestApp.new, {:redirect => 'http://slashdot.org'}))
44
+ response = request.get('/', {'HTTP_USER_AGENT' => 'Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.3615)'})
45
+ assert_equal "Hi Internets!", response.body
46
+ end
47
+
42
48
  def test_allows_if_UA_version_greater_than_minimum
43
49
  request = Rack::MockRequest.new(Rack::NoIE.new(TestApp.new, {:redirect => 'http://slashdot.org'}))
44
50
  response = request.get('/', {'HTTP_USER_AGENT' => 'Mozilla/4.0 (compatible; MSIE 8.0; Windows XP)'})
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: robworley-rack-noie
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- version: "1.0"
9
+ - 1
10
+ version: 1.0.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Julio Cesar Ody