rangeclient 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/er +6 -0
- data/lib/rangeclient.rb +8 -2
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a792c858319fda71de0b824b3a7783657c643d538d0ac66df22af819f92de6f0
|
4
|
+
data.tar.gz: a54cfff00491cfa3c7a9c5592e063cd03aefde6723aea7af026462e7f4eeb250
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0763352a40f4254a055d5576e4151e06ff7dfef37b5ca71bac84a3a5dc3abb0bc6db40c4fe30cabd4fa65567227a549f68d2b0dc97367d69a53e6573c4d70715
|
7
|
+
data.tar.gz: f21f1b175c991b31639a09784ce19278934585827d4eb4d345cd769fed89b0b5c2f1b6ec7d07b4219a8bf75d48a104ae0b38bac76618ae906bdde5e19d2da2a0
|
data/bin/er
CHANGED
@@ -25,6 +25,12 @@ optparse = OptionParser.new do |opts|
|
|
25
25
|
opts.on('-p', '--port 80', 'Port to use when connecting') do |arg|
|
26
26
|
options[:port] = arg
|
27
27
|
end
|
28
|
+
opts.on('--[no-]ssl', 'Enable SSL') do |ssl|
|
29
|
+
options[:ssl] = ssl
|
30
|
+
end
|
31
|
+
opts.on('--ca-file FILE', 'PEM-formatted CA certificates to validate against when SSL is enabled') do |cafile|
|
32
|
+
options[:ca_file] = cafile
|
33
|
+
end
|
28
34
|
opts.on('-t', '--timeout TIMEOUT', "Wait this long for a response") do |arg|
|
29
35
|
options[:timeout] = arg.to_i
|
30
36
|
end
|
data/lib/rangeclient.rb
CHANGED
@@ -29,15 +29,21 @@ class Range::Client
|
|
29
29
|
@ssl = ENV['RANGE_SSL'] =~ (/(1|true)/i)
|
30
30
|
@ssl = options[:ssl] if options.member?(:ssl)
|
31
31
|
|
32
|
+
@ca_file = ENV['RANGE_CA_FILE'] if ENV.has_key?('RANGE_CA_FILE')
|
33
|
+
@ca_file = options[:ca_file] if options.member?(:ca_file)
|
34
|
+
|
32
35
|
@timeout = 60
|
33
36
|
@timeout = options[:timeout] if options.member?(:timeout)
|
34
37
|
end
|
35
38
|
|
36
39
|
def expand(arg)
|
37
|
-
escaped_arg = URI.
|
40
|
+
escaped_arg = URI.encode_www_form_component arg
|
38
41
|
http = Net::HTTP.new(@host, @port)
|
39
42
|
http.read_timeout = @timeout
|
40
|
-
|
43
|
+
if @ssl
|
44
|
+
http.use_ssl = true
|
45
|
+
http.ca_file = @ca_file
|
46
|
+
end
|
41
47
|
req = Net::HTTP::Get.new('/range/list?' + escaped_arg)
|
42
48
|
resp = http.request(req)
|
43
49
|
raise QueryException.new(resp.body) unless resp.is_a?(Net::HTTPSuccess)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rangeclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Miller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Use with range from https://github.com/square/libcrange
|
14
14
|
email:
|
@@ -49,8 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: 1.3.6
|
51
51
|
requirements: []
|
52
|
-
|
53
|
-
rubygems_version: 2.5.2.3
|
52
|
+
rubygems_version: 3.3.5
|
54
53
|
signing_key:
|
55
54
|
specification_version: 4
|
56
55
|
summary: Simple range client for ruby.
|