ritm 0.0.2 → 0.1.0

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
2
  SHA1:
3
- metadata.gz: 9f58ad7ec7b60adcb6d5644582b19da348fee831
4
- data.tar.gz: 2e024c04e5527f91864055141e5cf39cbe18e326
3
+ metadata.gz: dfb89d29700be9091b25f9134b25edf93e7ae313
4
+ data.tar.gz: db8b9d6abeeda4efc2a3c9edccf6284c2c2dbd17
5
5
  SHA512:
6
- metadata.gz: 72464b798fc3fa1ee83ebc4f3a3865a9e1d0f77a4e5ee2161475c4659f392cff87395201090ace9f7006043adefbb30972ac709e130663005dc38a6557fbd031
7
- data.tar.gz: a0cdb6a6999fee1e099706541f4ace66b2217ea6d005452cb5cf72937e819058f661e55b6b6b3678bc03a8e3e67d0d974d4017aacec533b355785d9d9f0c6a58
6
+ metadata.gz: 9e1a13a985ffafa3a5c066e89c3d23fe5b81fb1bed5d90fa2513c40ed73ec6d5a7e526b8a8eba2465364be7780dffd0a58ff1f6336e9dacf8090d28930409e02
7
+ data.tar.gz: f8eafca5d1c73d7e480c896771eea5e922b2a302598298bb47314dad8eb10ed0d1a3a003b1f2fab5d5682a3a7a296ad244c1d66c5d1223bfc2803fec2eef88c6
@@ -18,6 +18,7 @@ module Ritm
18
18
  key: nil
19
19
  }
20
20
  },
21
+
21
22
  intercept: {
22
23
  enabled: true,
23
24
  request: {
@@ -33,7 +34,12 @@ module Ritm
33
34
  update_content_length: true
34
35
  },
35
36
  process_chunked_encoded_transfer: true
37
+ },
38
+
39
+ misc: {
40
+ ssl_pass_through: []
36
41
  }
42
+
37
43
  }.freeze
38
44
 
39
45
  def initialize(settings = {})
@@ -46,7 +52,15 @@ module Ritm
46
52
  end
47
53
 
48
54
  def method_missing(m, *args, &block)
49
- @settings.send(m, *args, &block)
55
+ if @settings.respond_to?(m)
56
+ @settings.send(m, *args, &block)
57
+ else
58
+ super
59
+ end
60
+ end
61
+
62
+ def respond_to_missing?(method_name, _include_private = false)
63
+ @settings.respond_to?(method_name) || super
50
64
  end
51
65
 
52
66
  # Re-enable interception
@@ -8,9 +8,9 @@ module Ritm
8
8
  # Launches the Proxy server and the SSL Reverse Proxy with the given settings
9
9
  class Launcher
10
10
  # By default settings are read from Ritm::Configuration but you can override some via these named arguments:
11
+ # interface [String]: the host/address to bind the main proxy
11
12
  # proxy_port [Fixnum]: the port where the main proxy listens (the one to be configured in the client)
12
13
  # ssl_reverse_proxy_port [Fixnum]: the port where the reverse proxy for ssl traffic interception listens
13
- # interface [String]: the host/address to bind the main proxy
14
14
  # ca_crt_path [String]: the path to the certification authority certificate
15
15
  # ca_key_path [String]: the path to the certification authority private key
16
16
  # request_interceptor [Proc |request|]: the handler for request interception
@@ -19,8 +19,7 @@ module Ritm
19
19
  # Override
20
20
  # Patches the destination address on HTTPS connections to go via the HTTPS Reverse Proxy
21
21
  def do_CONNECT(req, res)
22
- req.class.send(:attr_accessor, :unparsed_uri)
23
- req.unparsed_uri = @config[:https_forward]
22
+ req.unparsed_uri = @config[:https_forward] unless ssl_pass_through? req.unparsed_uri
24
23
  super
25
24
  end
26
25
 
@@ -44,6 +43,20 @@ module Ritm
44
43
  # Response modifier handler
45
44
  intercept_response(@config[:response_interceptor], req, res)
46
45
  end
46
+
47
+ private
48
+
49
+ def ssl_pass_through?(destination)
50
+ Ritm.conf.misc.ssl_pass_through.each do |matcher|
51
+ case matcher
52
+ when String
53
+ return true if destination == matcher
54
+ when Regexp
55
+ return true if destination =~ matcher
56
+ end
57
+ end
58
+ false
59
+ end
47
60
  end
48
61
  end
49
62
  end
@@ -1,4 +1,4 @@
1
1
  # Ritm version
2
2
  module Ritm
3
- VERSION = '0.0.2'.freeze
3
+ VERSION = '0.1.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ritm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastián Tello
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-25 00:00:00.000000000 Z
11
+ date: 2016-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '11.1'
153
+ - !ruby/object:Gem::Dependency
154
+ name: httpclient
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '2.8'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '2.8'
153
167
  description: HTTP(S) Intercept Proxy
154
168
  email: argos83+ritm@gmail.com
155
169
  executables: []