franz 2.1.12 → 2.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Readme.md +1 -0
  3. data/VERSION +1 -1
  4. data/lib/franz/output/http.rb +43 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3212bbf41902b0ff5e82c125c017b4f75337219d
4
- data.tar.gz: 2d9df298998b543aed11c8468f01efa9a22ab4c6
3
+ metadata.gz: 3f73e7c48b1586fc31206d974b83892099094426
4
+ data.tar.gz: 9db0d0aa43c00025b0182c12c7bf2c45a9abf8de
5
5
  SHA512:
6
- metadata.gz: 05a3ed6849e5cb9d2b42dd5e4f316ff56ac271a7fce20a7744edd0e4e4a9558da0b2607f1f0a30a2320320cf49aa0989104adb6fde655041a9e9720ff18a581b
7
- data.tar.gz: 83b8446bbec4d46f24002b5828fa084688ceec37376d6812885df8307b8a26697b259a35c6b28364986078f4d29ed898be006dbb48316e975fdd6714d8629dc6
6
+ metadata.gz: 80f80638c8332388e3926ddda89eb21f5671bc1b7de7f306aa8734954cc9b32ae161c75747be117fdb071ff8b81bb7b565d6bf7c0a5fe135141ed9cdcc73444c
7
+ data.tar.gz: 3abe87523d476163aa6c3dee6616206df2d3662f62f5c9b7df60035bb4f1c25ee4113bbb11d154d08dff7fd7854b428aa23d3a6886291b452110d23e64f2d084
data/Readme.md CHANGED
@@ -238,6 +238,7 @@ for Chef.
238
238
  - Add `FNM_EXTGLOB` flag for better glob matching
239
239
  - Handle `EACCESS` on `IO.read` gracefully
240
240
  - New `HTTP` output (experimental)
241
+ - Support for SSL with `HTTP` output (experimental)
241
242
  - Allow for `nil` or `false` multiline configs
242
243
  - Implement missing (yet documented) "tags" feature
243
244
  - Remove default line limit
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.12
1
+ 2.1.13
@@ -1,4 +1,5 @@
1
1
  require 'net/http'
2
+ require 'net/https'
2
3
  require 'thread'
3
4
  require 'fiber'
4
5
  require 'json'
@@ -25,7 +26,13 @@ module Franz
25
26
  output: {
26
27
  server: 'http://localhost:3000',
27
28
  flush_size: 500,
28
- flush_interval: 10
29
+ flush_interval: 10,
30
+ ssl: {
31
+ cert_file: nil,
32
+ key_file: nil,
33
+ ca_file: nil,
34
+ verify_mode: nil
35
+ }
29
36
  }
30
37
  }.deep_merge!(opts)
31
38
 
@@ -39,6 +46,9 @@ module Franz
39
46
 
40
47
  server = opts[:output].delete :server
41
48
  @uri = URI(server)
49
+ @ssl = if @uri.scheme =~ /https/
50
+ opts[:output].delete :ssl
51
+ end
42
52
  open_uri
43
53
 
44
54
  @flush_size = opts[:output][:flush_size]
@@ -103,6 +113,38 @@ module Franz
103
113
 
104
114
  def open_uri
105
115
  @http = Net::HTTP.new(@uri.host, @uri.port)
116
+
117
+ if @ssl
118
+ @http.use_ssl = true
119
+
120
+ if cert_file = @ssl['cert_file']
121
+ cert = File.read cert_file
122
+ @http.cert = OpenSSL::X509::Certificate.new(cert)
123
+ end
124
+
125
+ if key_file = @ssl['key_file']
126
+ key = File.read key_file
127
+ @http.key = OpenSSL::PKey::RSA.new(key)
128
+ end
129
+
130
+ if @ssl['ca_file']
131
+ @http.ca_file = @ssl['ca_file']
132
+ end
133
+
134
+ case @ssl['verify_mode']
135
+ when 'verify_peer'
136
+ @http.verify_mode = OpenSSL::SSL::VERIFY_PEER
137
+ when 'verify_none'
138
+ @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
139
+ when 'verify_client_once'
140
+ @http.verify_mode = OpenSSL::SSL::VERIFY_CLIENT_ONCE
141
+ when 'verify_fail_if_no_peer_cert'
142
+ @http.verify_mode = OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
143
+ when nil
144
+ else
145
+ raise 'Invalid "verify_mode" specified'
146
+ end
147
+ end
106
148
  end
107
149
 
108
150
  def enqueue event
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: franz
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.12
4
+ version: 2.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Clemmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-16 00:00:00.000000000 Z
11
+ date: 2015-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slog