rack-xframe-options 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/VERSION +1 -1
- data/lib/rack/xframe-options.rb +5 -5
- data/rack-xframe-options.gemspec +2 -2
- data/test/test_rack-xframe-options.rb +2 -2
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -12,11 +12,11 @@ gem "rack-xframe-options"
|
|
12
12
|
|
13
13
|
|
14
14
|
= Usage
|
15
|
-
use Rack::XFrameOptions ("
|
15
|
+
use Rack::XFrameOptions ("SAMEORIGIN" is default)
|
16
16
|
|
17
17
|
or
|
18
18
|
|
19
|
-
use Rack::XFrameOptions, "
|
19
|
+
use Rack::XFrameOptions, "DENY"
|
20
20
|
|
21
21
|
|
22
22
|
== Note on Patches/Pull Requests
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/rack/xframe-options.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
module Rack
|
2
2
|
class XFrameOptions
|
3
3
|
|
4
|
-
def initialize(app, value = "
|
4
|
+
def initialize(app, value = "SAMEORIGIN")
|
5
5
|
@app = app
|
6
|
-
@value = value
|
6
|
+
@value = value.upcase
|
7
7
|
end
|
8
8
|
|
9
9
|
def call(env)
|
10
10
|
status, headers, body = @app.call(env)
|
11
|
+
|
11
12
|
if headers['Content-Type'] =~ /html/
|
12
13
|
headers['X-Frame-Options'] = ["DENY", "SAMEORIGIN"].include?(@value) ? @value : "DENY"
|
13
|
-
[status, headers, body]
|
14
|
-
else
|
15
|
-
@app.call(env)
|
16
14
|
end
|
15
|
+
|
16
|
+
[status, headers, body]
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/rack-xframe-options.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rack-xframe-options}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tomasz Mazur"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-28}
|
13
13
|
s.description = %q{The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a <frame> or <iframe>}
|
14
14
|
s.email = %q{defkode@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -14,7 +14,7 @@ class TestRackXframeOptions < Test::Unit::TestCase
|
|
14
14
|
setup do
|
15
15
|
def app
|
16
16
|
Rack::Builder.new do
|
17
|
-
use Rack::XFrameOptions
|
17
|
+
use Rack::XFrameOptions, "DENY"
|
18
18
|
run SampleApp.new
|
19
19
|
end
|
20
20
|
end
|
@@ -30,7 +30,7 @@ class TestRackXframeOptions < Test::Unit::TestCase
|
|
30
30
|
setup do
|
31
31
|
def app
|
32
32
|
Rack::Builder.new do
|
33
|
-
use Rack::XFrameOptions
|
33
|
+
use Rack::XFrameOptions
|
34
34
|
run SampleApp.new
|
35
35
|
end
|
36
36
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-xframe-options
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tomasz Mazur
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-28 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|