protocol-http 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/protocol/http/body/file.rb +2 -2
- data/lib/protocol/http/body/readable.rb +0 -10
- data/lib/protocol/http/methods.rb +5 -5
- data/lib/protocol/http/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50cafe21c0b3f5ed6b29fe6d7099cb3597c08c6082cc76919280671b4f4c0c6d
|
4
|
+
data.tar.gz: 361cad94d3eec69321daa40e05f6c1aaa5c49fa474387e97e8b1a19e724e4692
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc2805fc35956abf21aebdf26e461d50bcc712702f67c66fb12e408e8bea1e3fa4b301d4af65ff6c6c5fe814358451694db88f7ba5656a8295aa53e5ad48385a
|
7
|
+
data.tar.gz: 1f7df6fdde7bb8a5dee4318d3df256981726cdbba8d1e2aeec149e94699200782b86cb496a85ac63ca1e69b3b6e0e5c63db894600ff5f0957d8331d726e11da0
|
@@ -28,8 +28,8 @@ module Protocol
|
|
28
28
|
BLOCK_SIZE = Async::IO::BLOCK_SIZE
|
29
29
|
MODE = ::File::RDONLY | ::File::BINARY
|
30
30
|
|
31
|
-
def self.open(path, *
|
32
|
-
self.new(::File.open(path, MODE), *
|
31
|
+
def self.open(path, *arguments, **options)
|
32
|
+
self.new(::File.open(path, MODE), *arguments, **options)
|
33
33
|
end
|
34
34
|
|
35
35
|
def initialize(file, range = nil, size: file.size, block_size: BLOCK_SIZE)
|
@@ -67,16 +67,6 @@ module Protocol
|
|
67
67
|
self.close($!)
|
68
68
|
end
|
69
69
|
|
70
|
-
# def call(stream)
|
71
|
-
# # Flushing after every chunk is inefficient, but it's also a safe default.
|
72
|
-
# self.each do |chunk|
|
73
|
-
# stream.write(chunk)
|
74
|
-
# stream.flush
|
75
|
-
# end
|
76
|
-
# ensure
|
77
|
-
# stream.close
|
78
|
-
# end
|
79
|
-
|
80
70
|
# Read all remaining chunks into a single binary string using `#each`.
|
81
71
|
def join
|
82
72
|
buffer = String.new.force_encoding(Encoding::BINARY)
|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
module Protocol
|
24
24
|
module HTTP
|
25
|
-
# HTTP
|
25
|
+
# All supported HTTP methods
|
26
26
|
class Methods
|
27
27
|
GET = 'GET'
|
28
28
|
POST = 'POST'
|
@@ -39,7 +39,7 @@ module Protocol
|
|
39
39
|
def self.valid?(name)
|
40
40
|
const_defined?(name)
|
41
41
|
rescue NameError
|
42
|
-
# Ruby will raise an exception if
|
42
|
+
# Ruby will raise an exception if the name is not valid for a constant.
|
43
43
|
return false
|
44
44
|
end
|
45
45
|
|
@@ -50,10 +50,10 @@ module Protocol
|
|
50
50
|
end
|
51
51
|
|
52
52
|
# Use Methods.constants to get all constants.
|
53
|
-
self.each do |name,
|
54
|
-
define_method(
|
53
|
+
self.each do |name, value|
|
54
|
+
define_method(name.downcase) do |location, headers = [], body = nil|
|
55
55
|
self.call(
|
56
|
-
Request[
|
56
|
+
Request[value, location.to_str, Headers[headers], body]
|
57
57
|
)
|
58
58
|
end
|
59
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocol-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: covered
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
|
-
rubygems_version: 3.0.
|
131
|
+
rubygems_version: 3.0.4
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: Provides abstractions to handle HTTP protocols.
|