rack-secure_only 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -13,6 +13,7 @@ begin
13
13
  gem.add_development_dependency "rspec", ">= 1.2.9"
14
14
  gem.add_development_dependency "rack-test", ">= 0.5.3"
15
15
  gem.add_dependency "rack", ">= 1.1.0"
16
+ gem.autorequire = "lib/rack/secure-only"
16
17
  end
17
18
  Jeweler::GemcutterTasks.new
18
19
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
@@ -16,11 +16,12 @@ module Rack
16
16
  opts = { :secure => true }.merge(opts)
17
17
  @app = app
18
18
  @secure = opts[:secure]
19
+ @redirect_status_code = 301
19
20
  end
20
21
 
21
22
  def call(env)
22
23
  should_redirect, to_path = redirect?(env)
23
- return [307, { 'Content-Type' => 'text/plain', 'Location' => to_path }, ["Redirect"]] if should_redirect
24
+ return [@redirect_status_code, { 'Content-Type' => 'text/plain', 'Location' => to_path }, ["Redirect"]] if should_redirect
24
25
  @app.call(env)
25
26
  end
26
27
 
@@ -5,11 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rack-secure_only}
8
- s.version = "0.1.1"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Klaas Speller"]
12
- s.date = %q{2010-05-21}
12
+ s.autorequire = %q{lib/rack/secure-only}
13
+ s.date = %q{2010-05-22}
13
14
  s.description = %q{Redirect http to https and the other way around}
14
15
  s.email = %q{klaasspeller@gmail.com}
15
16
  s.extra_rdoc_files = [
@@ -51,8 +51,8 @@ describe Rack::SecureOnly do
51
51
  before(:each) do
52
52
  @response = @request.get('http://www.example.com/secure')
53
53
  end
54
- it "should respond with status 307 redirect" do
55
- @response.status.should == 307
54
+ it "should respond with status 301 redirect" do
55
+ @response.status.should == 301
56
56
  end
57
57
 
58
58
  it "should set location to https://www.example.com/secure" do
@@ -87,8 +87,8 @@ describe Rack::SecureOnly do
87
87
 
88
88
  describe "when requesting https://www.example.com/notsecure" do
89
89
 
90
- it "should respond with status 307 redirect" do
91
- @response.status.should == 307
90
+ it "should respond with status 301 redirect" do
91
+ @response.status.should == 301
92
92
  end
93
93
 
94
94
  it "should set location to http://www.example.com/notsecure" do
metadata CHANGED
@@ -4,17 +4,17 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 1
9
- version: 0.1.1
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Klaas Speller
13
- autorequire:
13
+ autorequire: lib/rack/secure-only
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-21 00:00:00 +02:00
17
+ date: 2010-05-22 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency