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 +4 -4
- data/fluent-plugin-http_shadow.gemspec +1 -1
- data/lib/fluent/plugin/out_http_shadow.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b2bf86074d008d420732cff063ba4d60194f2821
|
|
4
|
+
data.tar.gz: 6084d42dea51d2a209e896f0c57b6cffa0281dc7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
+
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.
|
|
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-
|
|
11
|
+
date: 2015-06-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: typhoeus
|