fluent-plugin-http_shadow 0.0.5 → 0.0.6

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: 432423d0f4953a8ae5c7efb44e4ad5340ef32cf2
4
- data.tar.gz: ab0ba60220b359a4208319d35d36459b09bc2f59
3
+ metadata.gz: b2bf86074d008d420732cff063ba4d60194f2821
4
+ data.tar.gz: 6084d42dea51d2a209e896f0c57b6cffa0281dc7
5
5
  SHA512:
6
- metadata.gz: 6eab790e3e9203f1af7c5c0cc7200324a7a8955cea70396804f8f7db7074cc7900e0b69a9e790efcf17895d998e93c0344be5f7caf6e7236d9c84da17189205d
7
- data.tar.gz: ea99cb8163843fcab9f72258764c522e607227a63a0bf44690c56af70e977b038d00c7007287a44f164c7f3966bbaf73ed42415f929b968810936961e4e757ca
6
+ metadata.gz: 0c9943abae79ef3051bfc71327078ce5f02aebc8fa8d2cf1fbc84eeea960b0fc8c2458636dfcd6dd27d41420b9e0e3c00dcf45066441787d8bb81381d6b8cfb1
7
+ data.tar.gz: d282840b1e1edb304e6e419c6070d20d3d1ee7afbcf3efd81e765cf6b2fc8e2fdad28331a3ad49d8b1a762f531239dd36cb2d87b0666318ead5244a4f9c6096b
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "fluent-plugin-http_shadow"
5
- gem.version = "0.0.5"
5
+ gem.version = "0.0.6"
6
6
  gem.summary = %q{copy http request. use shadow proxy server.}
7
7
  gem.description = %q{copy http request. use shadow proxy server.}
8
8
  gem.license = "MIT"
@@ -22,6 +22,7 @@ module Fluent
22
22
  config_param :username, :string, :default => nil
23
23
  config_param :password, :string, :default => nil
24
24
  config_param :rate, :integer, :default => 100
25
+ config_param :replace_hash, :hash, :default => nil
25
26
 
26
27
  def configure(conf)
27
28
  super
@@ -78,11 +79,13 @@ module Fluent
78
79
  def get_request(host, record)
79
80
  method = (record[@method_key] || 'get').downcase.to_sym
80
81
  path = @path_format.result(binding)
82
+ path = replace_string(path) if @replace_hash
81
83
 
82
84
  url = "http://" + host + path
83
85
  uri = Addressable::URI.parse(url)
84
86
  params = uri.query_values
85
87
  params.merge(record[@params_key]) unless record[@params_key].nil?
88
+ params = replace_params(params) if @replace_hash && params
86
89
 
87
90
  option = {
88
91
  timeout: @timeout,
@@ -115,6 +118,18 @@ module Fluent
115
118
  header
116
119
  end
117
120
 
121
+ def replace_string(str)
122
+ return nil if str.nil?
123
+ @replace_hash.each do |k, v|
124
+ str = str.gsub(k, v)
125
+ end
126
+ str
127
+ end
128
+
129
+ def replace_params(params)
130
+ Hash[params.map { |k,v| [k, replace_string(v)] }]
131
+ end
132
+
118
133
  def get_cookie_string(record)
119
134
  @cookies.map{|k, v|
120
135
  "#{k}=#{v.result(binding)}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-http_shadow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Toyama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-20 00:00:00.000000000 Z
11
+ date: 2015-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus