fluent-plugin-http_shadow 0.0.7 → 0.0.8
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/README.md +1 -0
- data/fluent-plugin-http_shadow.gemspec +1 -1
- data/lib/fluent/plugin/out_http_shadow.rb +7 -2
- 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: 6cd7508da92015ce2c17fb88b0885ae03f398762
|
4
|
+
data.tar.gz: 3b2422ae678f2d72dfa0f0565e3d2d32e23c0681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3c7ff02fcb4f8676562c8e49cf38484bc9913752813d5f31f2dfcbd4643fd2774de04c3bc19a21a64d003a328b222d0538ee7e416c199139c3f76cc1a0bd5c9
|
7
|
+
data.tar.gz: da4d65b41b113bd1c9fa19864a5e7085f8b9ff7a3d539582c95e467de156617ecffc484a63e96ebbca878fc26c7fa2687f4edd98a0ac09878897b268441661fc
|
data/README.md
CHANGED
@@ -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.8"
|
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"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Fluent
|
2
2
|
class HttpShadowOutput < Fluent::BufferedOutput
|
3
3
|
Fluent::Plugin.register_output('http_shadow', self)
|
4
|
+
SUPPORT_PROTOCOLS = ['http', 'https']
|
4
5
|
|
5
6
|
def initialize
|
6
7
|
super
|
@@ -24,6 +25,7 @@ module Fluent
|
|
24
25
|
config_param :password, :string, :default => nil
|
25
26
|
config_param :rate, :integer, :default => 100
|
26
27
|
config_param :replace_hash, :hash, :default => nil
|
28
|
+
config_param :protocol_format, :string, :default => 'http'
|
27
29
|
|
28
30
|
def configure(conf)
|
29
31
|
super
|
@@ -36,6 +38,7 @@ module Fluent
|
|
36
38
|
super
|
37
39
|
@regexp = /\$\{([^}]+)\}/
|
38
40
|
@path_format = ERB.new(@path_format.gsub(@regexp, "<%=record['" + '\1' + "'] %>"))
|
41
|
+
@protocol_format = ERB.new(@protocol_format.gsub(@regexp, "<%=record['" + '\1' + "'] %>"))
|
39
42
|
|
40
43
|
@headers = get_formatter(@header_hash)
|
41
44
|
@cookies = get_formatter(@cookie_hash)
|
@@ -81,8 +84,10 @@ module Fluent
|
|
81
84
|
method = (record[@method_key] || 'get').downcase.to_sym
|
82
85
|
path = @path_format.result(binding)
|
83
86
|
path = replace_string(path) if @replace_hash
|
87
|
+
protocol = @protocol_format.result(binding)
|
88
|
+
protocol = SUPPORT_PROTOCOLS.include?(protocol) ? protocol : 'http'
|
84
89
|
|
85
|
-
url = "
|
90
|
+
url = "#{protocol}://" + host + path
|
86
91
|
uri = Addressable::URI.parse(url)
|
87
92
|
params = uri.query_values
|
88
93
|
params.merge(record[@params_key]) unless record[@params_key].nil?
|
@@ -97,7 +102,7 @@ module Fluent
|
|
97
102
|
}
|
98
103
|
option[:userpwd] = "#{@username}:#{@password}" if @username
|
99
104
|
|
100
|
-
Typhoeus::Request.new("
|
105
|
+
Typhoeus::Request.new("#{protocol}://" + host + uri.path, option)
|
101
106
|
end
|
102
107
|
|
103
108
|
def get_formatter(hash)
|
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.8
|
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-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|