dimscan 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 7d23ddb35aeff44c2ee1146b91d8b9b909bccbf9
4
- data.tar.gz: d5e250c9f69895d437337cbc733b6c8a1687cb49
3
+ metadata.gz: 3441a1b94f5047db0f891a7931822388ded85a19
4
+ data.tar.gz: 0f62edc855f0e7e6ce7008b0fcbc943c3cdf35a7
5
5
  SHA512:
6
- metadata.gz: c12df6b388957fdf2867a44e86851acdfa39b41bc3e219af5fdb929735aef914ba8c207e9415e4db64e8e5439739f0b97dbaa4b43fe45ea988b98f327d2d8897
7
- data.tar.gz: 78ccee05a9a10ea415fb4104d61c9cf14a774eeaccc40c56917384332dc425b87f9a2c5ae86ad72da1e0467564c1ac1c62ad562f0ae660f61fcdbc139819ace4
6
+ metadata.gz: 0355987ad4974e33ac634ac2e4cc91d6561e0577b01353821729d68f70387991d4227dcb1b57de29c74ef0ce2ce47dec3bb8aa3f9bc864e9484f228b1f2aefec
7
+ data.tar.gz: e93916bce380e2b828d4928da908e58c0c088460dcc47b41a8d8628f3c0efcc3f5bdf5f8a48306bac3d92be0e3ef05326df53a0f9eb9a6c96dffeef38ae7a8b3
@@ -1,12 +1,6 @@
1
1
  require 'dimscan/version'
2
2
  require 'dimscan/jpeg_scanner'
3
3
  require 'dimscan/png_scanner'
4
- require 'dimscan/http_byte_enumerator'
5
4
 
6
5
  module Dimscan
7
- class << self
8
- def close_connections
9
- HTTPByteEnumerator.close_connections
10
- end
11
- end
12
6
  end
@@ -4,25 +4,6 @@ require 'net/http'
4
4
  module Dimscan
5
5
  # A utility class for enumerating over the bytes of a http response body
6
6
  class HTTPByteEnumerator
7
- @connections = {}
8
- class << self
9
- def open_connection(host, port, ssl)
10
- @connections[host] ||= {}
11
- @connections[host][port] ||= {}
12
- @connections[host][port][ssl] ||= Net::HTTP.start(
13
- host, port, use_ssl: ssl
14
- )
15
- end
16
-
17
- def close_connections
18
- @connections.values.each do |ports|
19
- ports.values.each do |connections|
20
- connections.values.each(&:finish)
21
- end
22
- end
23
- end
24
- end
25
-
26
7
  def initialize(url)
27
8
  @uri = URI(url)
28
9
  fail ArgumentError, 'invalid scheme' unless @uri.scheme =~ /^https?$/
@@ -31,12 +12,13 @@ module Dimscan
31
12
  def each(&block)
32
13
  return to_enum(__callee__) unless block_given?
33
14
  request = Net::HTTP::Get.new(@uri)
34
- http = self.class.open_connection(
35
- @uri.host, @uri.port, @uri.scheme == 'https'
36
- )
37
- http.request(request) do |response|
38
- fail response.body if error?(response)
39
- enumerate_response(response, &block)
15
+ Net::HTTP.start(
16
+ @uri.host, @uri.port, use_ssl: @uri.scheme == 'https'
17
+ ) do |http|
18
+ http.request(request) do |response|
19
+ fail response.body if error?(response)
20
+ enumerate_response(response, &block)
21
+ end
40
22
  end
41
23
  end
42
24
 
@@ -1,4 +1,4 @@
1
1
  # Version string
2
2
  module Dimscan
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.2.1'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dimscan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joakim Reinert