redirector 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 63dab49a33d2664b3722c5240d71328cd50ec1ba
4
- data.tar.gz: 7baceb65e027c70c8db19a9b62d8e598a3c27e32
2
+ SHA256:
3
+ metadata.gz: 48575a6f084332c0f16720d2398e8674fced3f96add66675947fc820c47070bc
4
+ data.tar.gz: 1a4e1e61f2abdcc1d39c655e0d155e707769738b380408a942447bc79bc60feb
5
5
  SHA512:
6
- metadata.gz: 209ce7d1b98f706a3e44dd6262c732545b36b8e62fdde2e5261a0292b36105f71ee8d5fbc7f43d66ce7c8c1cac2a582ad82b7c97a26172492d1866531f2fdffe
7
- data.tar.gz: 26d3ca13b233ea6e2882c6e2aaf5750cc1402d31cd74343cabe6dffb3d5a10e2a428340a46edf51eae594876038951f42beb2978fdad4353d6da0fca91e1e91f
6
+ metadata.gz: a4b89eaeb9e03e7ff035ce0233285f44107545f301c5807765cf9076e6af17de6c8fd1eeadae130584c9c965a2853e152eeae307cebb337250f56d6a9d94a374
7
+ data.tar.gz: 3d693e87e63e0b554fba58be2eeb5d5bc7990eaa4a6dd3f3451b6a3d30787c73a633286008143825b27c03e5490e2d8b911a808ee0c28c3edef6151ea517855b
@@ -64,6 +64,10 @@ module Redirector
64
64
  env['HTTP_HOST'].split(':').first
65
65
  end
66
66
 
67
+ def request_scheme
68
+ env['rack.url_scheme']
69
+ end
70
+
67
71
  def request_port
68
72
  @request_port ||= begin
69
73
  if env['HTTP_HOST'].include?(':')
@@ -86,7 +90,7 @@ module Redirector
86
90
 
87
91
  def redirect_uri
88
92
  destination_uri.tap do |uri|
89
- uri.scheme ||= 'http'
93
+ uri.scheme ||= request_scheme
90
94
  uri.host ||= request_host
91
95
  uri.port ||= request_port if request_port.present?
92
96
  uri.query ||= env['QUERY_STRING'] if Redirector.preserve_query
@@ -1,3 +1,3 @@
1
1
  module Redirector
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -5,7 +5,7 @@ development:
5
5
  database: redirector_dummy_development
6
6
  pool: 5
7
7
  username: root
8
- password: eli
8
+ password:
9
9
 
10
10
  test:
11
11
  adapter: mysql2
@@ -14,4 +14,4 @@ test:
14
14
  database: redirector_dummy_test
15
15
  pool: 5
16
16
  username: root
17
- password: eli
17
+ password:
@@ -3,3 +3,34 @@ Connecting to database specified by database.yml
3
3
  Migrating to CreateRedirectRules (20120815212612)
4
4
  Migrating to CreateRequestEnvironmentRules (20120823163756)
5
5
   (0.2ms) SELECT `schema_migrations`.`version` FROM `schema_migrations`
6
+  (0.4ms) SET NAMES utf8, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
7
+  (71.1ms) CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL PRIMARY KEY) ENGINE=InnoDB
8
+  (36.0ms) CREATE TABLE `ar_internal_metadata` (`key` varchar(255) NOT NULL PRIMARY KEY, `value` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
9
+  (0.5ms) SELECT GET_LOCK('3013211720225074515', 0)
10
+  (0.2ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
11
+ Migrating to CreateRedirectRules (20120815212612)
12
+  (0.4ms) SELECT RELEASE_LOCK('3013211720225074515')
13
+  (0.3ms) SET NAMES utf8, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
14
+  (0.1ms) SELECT GET_LOCK('3013211720225074515', 0)
15
+  (0.2ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
16
+ Migrating to CreateRedirectRules (20120815212612)
17
+  (25.4ms) CREATE TABLE `redirect_rules` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `source` varchar(255) NOT NULL, `source_is_regex` tinyint(1) DEFAULT 0 NOT NULL, `source_is_case_sensitive` tinyint(1) DEFAULT 0 NOT NULL, `destination` varchar(255) NOT NULL, `active` tinyint(1) DEFAULT 0, `created_at` datetime, `updated_at` datetime) ENGINE=InnoDB
18
+  (19.9ms) CREATE INDEX `index_redirect_rules_on_source` ON `redirect_rules` (`source`) 
19
+  (17.8ms) CREATE INDEX `index_redirect_rules_on_active` ON `redirect_rules` (`active`) 
20
+  (17.0ms) CREATE INDEX `index_redirect_rules_on_source_is_regex` ON `redirect_rules` (`source_is_regex`) 
21
+  (14.0ms) CREATE INDEX `index_redirect_rules_on_source_is_case_sensitive` ON `redirect_rules` (`source_is_case_sensitive`) 
22
+  (0.2ms) BEGIN
23
+ SQL (0.3ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20120815212612')
24
+  (0.5ms) COMMIT
25
+ Migrating to CreateRequestEnvironmentRules (20120823163756)
26
+  (23.4ms) CREATE TABLE `request_environment_rules` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `redirect_rule_id` int NOT NULL, `environment_key_name` varchar(255) NOT NULL, `environment_value` varchar(255) NOT NULL, `environment_value_is_regex` tinyint(1) DEFAULT 0 NOT NULL, `environment_value_is_case_sensitive` tinyint(1) DEFAULT 1 NOT NULL, `created_at` datetime, `updated_at` datetime) ENGINE=InnoDB
27
+  (17.4ms) CREATE INDEX `index_request_environment_rules_on_redirect_rule_id` ON `request_environment_rules` (`redirect_rule_id`) 
28
+  (0.3ms) BEGIN
29
+ SQL (0.5ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20120823163756')
30
+  (0.6ms) COMMIT
31
+ ActiveRecord::InternalMetadata Load (0.4ms) SELECT `ar_internal_metadata`.* FROM `ar_internal_metadata` WHERE `ar_internal_metadata`.`key` = 'environment' LIMIT 1
32
+  (0.8ms) BEGIN
33
+ SQL (0.3ms) INSERT INTO `ar_internal_metadata` (`key`, `value`, `created_at`, `updated_at`) VALUES ('environment', 'development', '2018-06-05 15:16:51', '2018-06-05 15:16:51')
34
+  (0.2ms) COMMIT
35
+  (0.1ms) SELECT RELEASE_LOCK('3013211720225074515')
36
+  (0.2ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
@@ -11554,3 +11554,164 @@ ActionController::RoutingError (No route matches [GET] "/my_custom_url/20"):
11554
11554
   (2.7ms) TRUNCATE TABLE `request_environment_rules`;
11555
11555
   (0.1ms) SET FOREIGN_KEY_CHECKS = 1
11556
11556
   (0.1ms) ROLLBACK
11557
+  (1.3ms) SET NAMES utf8, @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
11558
+  (0.5ms) BEGIN
11559
+  (0.2ms) SELECT @@FOREIGN_KEY_CHECKS
11560
+  (0.2ms) SET FOREIGN_KEY_CHECKS = 0
11561
+  (0.9ms) select table_name from information_schema.views where table_schema = 'redirector_dummy_test'
11562
+  (0.4ms) SET FOREIGN_KEY_CHECKS = 1
11563
+  (0.4ms) ROLLBACK
11564
+  (0.4ms) BEGIN
11565
+  (0.5ms) SELECT @@FOREIGN_KEY_CHECKS
11566
+  (0.3ms) SET FOREIGN_KEY_CHECKS = 0
11567
+  (0.2ms) SET FOREIGN_KEY_CHECKS = 1
11568
+  (0.1ms) ROLLBACK
11569
+  (0.2ms) BEGIN
11570
+  (0.8ms) SELECT @@FOREIGN_KEY_CHECKS
11571
+  (0.9ms) SET FOREIGN_KEY_CHECKS = 0
11572
+  (0.4ms) SET FOREIGN_KEY_CHECKS = 1
11573
+  (0.7ms) ROLLBACK
11574
+  (0.2ms) BEGIN
11575
+  (0.3ms) SELECT @@FOREIGN_KEY_CHECKS
11576
+  (0.2ms) SET FOREIGN_KEY_CHECKS = 0
11577
+  (0.2ms) SET FOREIGN_KEY_CHECKS = 1
11578
+  (0.2ms) ROLLBACK
11579
+  (0.2ms) BEGIN
11580
+  (0.3ms) SELECT @@FOREIGN_KEY_CHECKS
11581
+  (0.4ms) SET FOREIGN_KEY_CHECKS = 0
11582
+  (0.2ms) SET FOREIGN_KEY_CHECKS = 1
11583
+  (0.2ms) ROLLBACK
11584
+  (0.2ms) BEGIN
11585
+  (0.4ms) SELECT @@FOREIGN_KEY_CHECKS
11586
+  (0.3ms) SET FOREIGN_KEY_CHECKS = 0
11587
+  (0.2ms) SET FOREIGN_KEY_CHECKS = 1
11588
+  (0.2ms) ROLLBACK
11589
+  (0.3ms) BEGIN
11590
+  (0.2ms) SELECT @@FOREIGN_KEY_CHECKS
11591
+  (0.3ms) SET FOREIGN_KEY_CHECKS = 0
11592
+  (0.2ms) SET FOREIGN_KEY_CHECKS = 1
11593
+  (0.2ms) ROLLBACK
11594
+  (0.2ms) BEGIN
11595
+  (0.4ms) SELECT @@FOREIGN_KEY_CHECKS
11596
+  (0.3ms) SET FOREIGN_KEY_CHECKS = 0
11597
+  (0.4ms) SET FOREIGN_KEY_CHECKS = 1
11598
+  (0.3ms) ROLLBACK
11599
+  (0.2ms) BEGIN
11600
+  (0.5ms) SELECT @@FOREIGN_KEY_CHECKS
11601
+  (0.4ms) SET FOREIGN_KEY_CHECKS = 0
11602
+  (0.3ms) SET FOREIGN_KEY_CHECKS = 1
11603
+  (0.2ms) ROLLBACK
11604
+  (0.2ms) BEGIN
11605
+  (0.3ms) ROLLBACK
11606
+  (0.3ms) BEGIN
11607
+  (0.4ms) ROLLBACK
11608
+  (0.3ms) BEGIN
11609
+  (0.3ms) ROLLBACK
11610
+  (0.2ms) BEGIN
11611
+  (0.4ms) ROLLBACK
11612
+  (0.2ms) BEGIN
11613
+  (0.5ms) ROLLBACK
11614
+  (1.0ms) BEGIN
11615
+  (0.2ms) ROLLBACK
11616
+  (0.3ms) BEGIN
11617
+  (0.4ms) ROLLBACK
11618
+  (0.3ms) BEGIN
11619
+  (0.2ms) ROLLBACK
11620
+  (0.2ms) BEGIN
11621
+  (0.4ms) ROLLBACK
11622
+  (0.7ms) BEGIN
11623
+  (0.4ms) ROLLBACK
11624
+  (0.2ms) BEGIN
11625
+  (0.4ms) ROLLBACK
11626
+  (0.2ms) BEGIN
11627
+  (0.2ms) ROLLBACK
11628
+  (0.3ms) BEGIN
11629
+  (0.5ms) ROLLBACK
11630
+  (0.2ms) BEGIN
11631
+  (0.2ms) ROLLBACK
11632
+  (0.2ms) BEGIN
11633
+  (0.2ms) ROLLBACK
11634
+  (0.2ms) BEGIN
11635
+  (0.2ms) ROLLBACK
11636
+  (0.4ms) BEGIN
11637
+  (0.3ms) ROLLBACK
11638
+  (0.2ms) BEGIN
11639
+  (0.2ms) ROLLBACK
11640
+  (0.2ms) BEGIN
11641
+  (0.2ms) ROLLBACK
11642
+  (0.4ms) BEGIN
11643
+  (0.3ms) ROLLBACK
11644
+  (0.2ms) BEGIN
11645
+  (0.5ms) ROLLBACK
11646
+  (0.3ms) BEGIN
11647
+  (0.1ms) ROLLBACK
11648
+  (0.1ms) BEGIN
11649
+  (0.2ms) ROLLBACK
11650
+  (0.3ms) BEGIN
11651
+  (0.3ms) ROLLBACK
11652
+  (0.3ms) BEGIN
11653
+  (0.5ms) ROLLBACK
11654
+  (0.9ms) BEGIN
11655
+  (0.3ms) ROLLBACK
11656
+  (0.3ms) BEGIN
11657
+  (0.4ms) ROLLBACK
11658
+  (0.4ms) BEGIN
11659
+  (0.3ms) ROLLBACK
11660
+  (0.2ms) BEGIN
11661
+  (0.2ms) ROLLBACK
11662
+  (0.2ms) BEGIN
11663
+  (0.2ms) ROLLBACK
11664
+  (0.3ms) BEGIN
11665
+  (0.3ms) ROLLBACK
11666
+  (0.7ms) BEGIN
11667
+  (0.8ms) ROLLBACK
11668
+  (0.2ms) BEGIN
11669
+  (0.2ms) ROLLBACK
11670
+  (0.1ms) BEGIN
11671
+  (0.3ms) ROLLBACK
11672
+  (0.6ms) BEGIN
11673
+  (0.3ms) ROLLBACK
11674
+  (0.2ms) BEGIN
11675
+  (0.2ms) ROLLBACK
11676
+  (0.1ms) BEGIN
11677
+  (0.2ms) ROLLBACK
11678
+  (0.3ms) BEGIN
11679
+  (0.6ms) ROLLBACK
11680
+  (0.2ms) BEGIN
11681
+  (0.2ms) ROLLBACK
11682
+  (0.2ms) BEGIN
11683
+  (0.2ms) ROLLBACK
11684
+  (0.3ms) BEGIN
11685
+  (0.2ms) ROLLBACK
11686
+  (0.2ms) BEGIN
11687
+  (0.2ms) ROLLBACK
11688
+  (0.3ms) BEGIN
11689
+  (0.2ms) ROLLBACK
11690
+  (0.3ms) BEGIN
11691
+  (0.2ms) ROLLBACK
11692
+  (0.2ms) BEGIN
11693
+  (0.2ms) ROLLBACK
11694
+  (0.2ms) BEGIN
11695
+  (0.4ms) ROLLBACK
11696
+  (0.2ms) BEGIN
11697
+  (0.4ms) ROLLBACK
11698
+  (0.2ms) BEGIN
11699
+  (0.2ms) ROLLBACK
11700
+  (0.2ms) BEGIN
11701
+  (0.3ms) ROLLBACK
11702
+  (0.3ms) BEGIN
11703
+  (0.4ms) ROLLBACK
11704
+  (0.2ms) BEGIN
11705
+  (0.2ms) ROLLBACK
11706
+  (0.3ms) BEGIN
11707
+  (0.3ms) ROLLBACK
11708
+  (0.3ms) BEGIN
11709
+  (0.1ms) ROLLBACK
11710
+  (0.3ms) BEGIN
11711
+  (0.3ms) ROLLBACK
11712
+  (0.5ms) BEGIN
11713
+  (0.2ms) ROLLBACK
11714
+  (0.2ms) BEGIN
11715
+  (0.3ms) ROLLBACK
11716
+  (0.2ms) BEGIN
11717
+  (0.2ms) ROLLBACK
@@ -60,6 +60,13 @@ describe 'Redirector middleware', :type => :feature do
60
60
  expect(current_url).to eq('http://example.com:3000/news/5')
61
61
  end
62
62
 
63
+ it 'handles https requests' do
64
+ Capybara.app_host = 'https://example.com'
65
+
66
+ visit '/my_custom_url'
67
+ expect(current_url).to eq('https://example.com/news/5')
68
+ end
69
+
63
70
  it 'foregoes search if ignored path pattern is detected' do
64
71
  original_option = Redirector.ignored_patterns
65
72
  Redirector.ignored_patterns = [/^\/my_custom_url\/.+/]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redirector
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Landau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-05 00:00:00.000000000 Z
11
+ date: 2018-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -245,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
245
  version: '0'
246
246
  requirements: []
247
247
  rubyforge_project:
248
- rubygems_version: 2.5.1
248
+ rubygems_version: 2.7.6
249
249
  signing_key:
250
250
  specification_version: 4
251
251
  summary: A Rails engine that adds a piece of middleware to the top of your middleware