data_collector 0.25.0 → 0.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/data_collector/input/rpc.rb +1 -1
- data/lib/data_collector/input.rb +16 -5
- data/lib/data_collector/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 057dac92f5a83458b244a962ef0518fa093365a38c2388582de0556ac7b884ca
|
4
|
+
data.tar.gz: 9aebb908d52dda01dc3efce7dcda3e40c8b4f45e718cef94052c9d37fca604eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa91e78ec3aef0010553886539284af4aafb3ed7014ef35e6f7094377bf9ad2efb7f6025bc7f8715d4558d8a5a1242325761a12a6e696590828fa1752c579198
|
7
|
+
data.tar.gz: 7309cc34f3d022d212ab9870558909ab84be3c6550160ce822808f98edb259c96669899247a7faefec6365068ac5aa68a6d5b43f279591156f47c9f02d0e182c
|
data/lib/data_collector/input.rb
CHANGED
@@ -31,7 +31,7 @@ module DataCollector
|
|
31
31
|
raise DataCollector::Error 'from_uri expects a scheme like file:// of https://' unless source =~ /:\/\//
|
32
32
|
|
33
33
|
scheme, path = source.split('://')
|
34
|
-
source="#{scheme}://#{URI.
|
34
|
+
source="#{scheme}://#{URI.encode_www_form_component(path)}"
|
35
35
|
uri = URI(source)
|
36
36
|
begin
|
37
37
|
data = nil
|
@@ -41,7 +41,7 @@ module DataCollector
|
|
41
41
|
when 'https'
|
42
42
|
data = from_https(uri, options)
|
43
43
|
when 'file'
|
44
|
-
absolute_path = File.absolute_path("#{URI.
|
44
|
+
absolute_path = File.absolute_path("#{URI.decode_www_form_component("#{uri.host}#{uri.path}")}")
|
45
45
|
if File.directory?(absolute_path)
|
46
46
|
#raise DataCollector::Error, "#{uri.host}/#{uri.path} not found" unless File.exist?("#{uri.host}/#{uri.path}")
|
47
47
|
return from_dir(uri, options)
|
@@ -80,7 +80,7 @@ module DataCollector
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def from_https(uri, options = {})
|
83
|
-
uri = URI.
|
83
|
+
uri = URI.decode_www_form_component("#{uri.to_s}")
|
84
84
|
data = nil
|
85
85
|
if options.with_indifferent_access.include?(:logging) && options.with_indifferent_access[:logging]
|
86
86
|
HTTP.default_options = HTTP::Options.new(features: { logging: { logger: @logger } })
|
@@ -102,6 +102,16 @@ module DataCollector
|
|
102
102
|
http = HTTP.auth(bearer)
|
103
103
|
end
|
104
104
|
|
105
|
+
if options.key?(:cookies)
|
106
|
+
@logger.debug "Set cookies"
|
107
|
+
http = http.cookies( options[:cookies] )
|
108
|
+
end
|
109
|
+
|
110
|
+
if options.key?(:headers)
|
111
|
+
@logger.debug "Set http headers"
|
112
|
+
http = http.headers( options[:headers] )
|
113
|
+
end
|
114
|
+
|
105
115
|
if options.key?(:verify_ssl) && uri.scheme.eql?('https')
|
106
116
|
@logger.warn "Disabling SSL verification. "
|
107
117
|
#shouldn't use this but we all do ...
|
@@ -109,10 +119,11 @@ module DataCollector
|
|
109
119
|
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
110
120
|
|
111
121
|
http_response = http.follow.get(escape_uri(uri), ssl_context: ctx)
|
122
|
+
|
112
123
|
else
|
113
124
|
http_response = http.follow.get(escape_uri(uri))
|
114
125
|
end
|
115
|
-
|
126
|
+
|
116
127
|
case http_response.code
|
117
128
|
when 200..299
|
118
129
|
@raw = data = http_response.body.to_s
|
@@ -235,7 +246,7 @@ module DataCollector
|
|
235
246
|
end
|
236
247
|
|
237
248
|
def normalize_uri(uri)
|
238
|
-
"#{URI.
|
249
|
+
"#{URI.decode_www_form_component(uri.host)}#{URI.decode_www_form_component(uri.path)}"
|
239
250
|
end
|
240
251
|
end
|
241
252
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_collector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mehmet Celik
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|