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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8065c0d1b54cf1c39be5cfcb70a4fae1f33b02021182c75538ed03e73393d35a
4
- data.tar.gz: 879054ad24b178f08bfea7914c5fbc593c32c611bd4e3ad833869a3e5b36d5b1
3
+ metadata.gz: 057dac92f5a83458b244a962ef0518fa093365a38c2388582de0556ac7b884ca
4
+ data.tar.gz: 9aebb908d52dda01dc3efce7dcda3e40c8b4f45e718cef94052c9d37fca604eb
5
5
  SHA512:
6
- metadata.gz: 390ac889c52055cfd8f5326c6e7c1549faee6b8c41af4535b9fc5d3038701f62c441caaf41895d7ad64b4941e609fdee32ac745255b9cb2fbc0981d787b00847
7
- data.tar.gz: dbc57c97f30e5659ccfebba0850e99eee24ecada4a5e9a136ae6b036f19b587a4d66460e509c32d36be13cd4d745ed89f9a73e11a32b1b15fe800036c1836bea
6
+ metadata.gz: aa91e78ec3aef0010553886539284af4aafb3ed7014ef35e6f7094377bf9ad2efb7f6025bc7f8715d4558d8a5a1242325761a12a6e696590828fa1752c579198
7
+ data.tar.gz: 7309cc34f3d022d212ab9870558909ab84be3c6550160ce822808f98edb259c96669899247a7faefec6365068ac5aa68a6d5b43f279591156f47c9f02d0e182c
@@ -55,7 +55,7 @@ module DataCollector
55
55
  parse_uri
56
56
  server.rabbitmq_url = @bunny_uri.to_s
57
57
  server.rabbitmq_exchange = @bunny_channel
58
- server.logger = DataCollector::Core.logger
58
+ #server.logger = DataCollector::Core.logger
59
59
  end
60
60
  end
61
61
 
@@ -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.encode_uri_component(path)}"
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.decode_uri_component("#{uri.host}#{uri.path}")}")
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.decode_uri_component("#{uri.to_s}")
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.decode_uri_component(uri.host)}#{URI.decode_uri_component(uri.path)}"
249
+ "#{URI.decode_www_form_component(uri.host)}#{URI.decode_www_form_component(uri.path)}"
239
250
  end
240
251
  end
241
252
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module DataCollector
3
- VERSION = "0.25.0"
3
+ VERSION = "0.26.0"
4
4
  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.25.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-07-31 00:00:00.000000000 Z
11
+ date: 2023-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport