fluent-plugin-http_file_upload 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88a08ae937ffe1f6228d11fe7bf4ed23a15d45ee
4
- data.tar.gz: 068c8202a24f5dd6f7f35cbe4bea0c682887f846
3
+ metadata.gz: 0cb521ea46eb171c55738684699c1c0fcab783d0
4
+ data.tar.gz: 1f295a8b92872c2b8b8fae9da62df78f77469b47
5
5
  SHA512:
6
- metadata.gz: 64f269fe87976baa9430356bc71a0baaf30be8069e14537276457a19ec7610913e1b1634dd6642d75a09571fe30a0c9258bf4d9d57d544562e6ab4fc4bafb482
7
- data.tar.gz: 2e849b8d82591776d85c12c8f9a920b74d81a72f527a1defffd8f510858edc465b2e98eda80c875247534197a43e55597bb10b3b1baa5a31d0508ce5a587cda2
6
+ metadata.gz: 83b6afb1fc68b7a87a9b5d21fe104da18d765d8afe7a6ab38557f672d6f614d06683b9388356385b793bd29eedf4b17bd4ab44c595ebec0d2a378ef93d8c642b
7
+ data.tar.gz: f258aa9ac4d5fffd33306814a3c822e97e1e66aee622d0c086461cc60ae872cd296d9b457777f4e94a9d0d22c60352b9004a1730a7a8d1e3dcd66eeef5f7ad4c
data/README.md CHANGED
@@ -34,6 +34,8 @@ Fluentd with this configuration will format records to plain text file as 1-line
34
34
 
35
35
  * uri (string)
36
36
  * Endpoint URI to send POST request (http or https) [required]
37
+ * ssl\_verify\_mode (string)
38
+ * Boolean whether client will verify server certificates over SSL (none or peer) [default: peer]
37
39
  * param_name
38
40
  * POST request parameter name used for file uploading [default: `file`]
39
41
  * user_agent
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "fluent-plugin-http_file_upload"
5
- spec.version = "0.1.0"
5
+ spec.version = "0.1.1"
6
6
  spec.authors = ["TAGOMORI Satoshi"]
7
7
  spec.email = ["tagomoris@gmail.com"]
8
8
 
@@ -1,6 +1,7 @@
1
1
  require 'fluent/output'
2
2
  require 'fluent/mixin'
3
3
 
4
+ require 'openssl'
4
5
  require 'uri'
5
6
  require 'httpclient'
6
7
 
@@ -25,6 +26,15 @@ module Fluent
25
26
  config_param :headers, :hash, default: {}, desc: "Additional header fields for requests"
26
27
  config_param :parameters, :hash, default: {}, desc: "Additional form parameters (key-value pairs) for requests"
27
28
 
29
+ config_param :ssl_verify_mode, default: OpenSSL::SSL::VERIFY_PEER do |value|
30
+ case value.strip
31
+ when "none" then OpenSSL::SSL::VERIFY_NONE
32
+ when "peer" then OpenSSL::SSL::VERIFY_PEER
33
+ else
34
+ raise Fluent::ConfigError, "Unknown ssl_verify_mode '#{value.strip}' [none, peer]"
35
+ end
36
+ end
37
+
28
38
  desc "Filename in upload requests, formats for strftime available"
29
39
  config_param :filename, :string, default: "data.%Y-%m-%d-%M-%H-%S"
30
40
 
@@ -38,8 +48,11 @@ module Fluent
38
48
 
39
49
  @formatter = Plugin.new_formatter(@format)
40
50
  @formatter.configure(conf)
41
- @client = HTTPClient.new(agent_name: @user_agent)
51
+ @client = HTTPClient.new(agent_name: @user_agent, default_header: @headers)
42
52
  # @client.debug_dev = $stderr
53
+ if @uri.start_with?("https://")
54
+ @client.ssl_config.verify_mode = @ssl_verify_mode
55
+ end
43
56
  end
44
57
 
45
58
  def format(tag, time, record)
@@ -54,7 +67,7 @@ module Fluent
54
67
  unless @parameters.empty?
55
68
  postdata = @parameters.merge(postdata)
56
69
  end
57
- @client.post(@uri, postdata, @headers)
70
+ @client.post(@uri, postdata)
58
71
  end
59
72
  end
60
73
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-http_file_upload
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TAGOMORI Satoshi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-25 00:00:00.000000000 Z
11
+ date: 2016-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd