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 +4 -4
- data/lib/dimscan.rb +0 -6
- data/lib/dimscan/http_byte_enumerator.rb +7 -25
- data/lib/dimscan/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3441a1b94f5047db0f891a7931822388ded85a19
|
4
|
+
data.tar.gz: 0f62edc855f0e7e6ce7008b0fcbc943c3cdf35a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0355987ad4974e33ac634ac2e4cc91d6561e0577b01353821729d68f70387991d4227dcb1b57de29c74ef0ce2ce47dec3bb8aa3f9bc864e9484f228b1f2aefec
|
7
|
+
data.tar.gz: e93916bce380e2b828d4928da908e58c0c088460dcc47b41a8d8628f3c0efcc3f5bdf5f8a48306bac3d92be0e3ef05326df53a0f9eb9a6c96dffeef38ae7a8b3
|
data/lib/dimscan.rb
CHANGED
@@ -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
|
-
|
35
|
-
@uri.host, @uri.port, @uri.scheme == 'https'
|
36
|
-
)
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
|
data/lib/dimscan/version.rb
CHANGED