protocol-http 0.35.0 → 0.36.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: b60538bc2a8f661748e6a70b92bf46932440e56f69e0cb22348fa14b0c59706f
4
- data.tar.gz: 9a6629a169c0afff229eed8b660fc94c918cc9f0a953e5251b5f5f283e4e28fa
3
+ metadata.gz: c826c247a1168e14cb7b5e0b216019b622574c801852cda2a4102f0a041d0694
4
+ data.tar.gz: 9661992d2f755a4743b8998889e84c3ff3c826769256ccfc8a48f697ddc0463b
5
5
  SHA512:
6
- metadata.gz: 707f195fa9b7b2bfe446b6a2132dfe608570ec8fed696c8df558686e80da07c5026fac90941109dc7d743e3806daf8fdfb4d28ce051ba1412242b8fde4f45a99
7
- data.tar.gz: 41a940d1dee93bc30d90fc0ae63fa34103d82379862c502a2ec11ec6f06521491e8eb6586ef43707957ff8ebc7f7016e893ad3b88751e93fdcf14976de8227d2
6
+ metadata.gz: 7c37d338e02b8b9dc2540be13bad83d37df2f07a6082f3ace8aadc3f7dd357c0b77bae9508bd7a7f2ff4aecf51ef99efa7a94fa09214a510f1616ca34b9f16c0
7
+ data.tar.gz: f3588dde1d19541c9e5ee9e8c3d13d7f42d7976419f7cf3d0af2e7451445619d79c7f897699e1d20fd5569afed5c7cf7ec9b15e6c5d6a05647422dff6a38b508
checksums.yaml.gz.sig CHANGED
Binary file
@@ -59,6 +59,8 @@ module Protocol
59
59
  # Ensure that future reads return nil, but allow for rewinding.
60
60
  def close(error = nil)
61
61
  @index = @chunks.length
62
+
63
+ return nil
62
64
  end
63
65
 
64
66
  def clear
@@ -90,6 +92,10 @@ module Protocol
90
92
  end
91
93
  end
92
94
 
95
+ def discard
96
+ self.close
97
+ end
98
+
93
99
  def write(chunk)
94
100
  @chunks << chunk
95
101
  end
@@ -133,6 +133,16 @@ module Protocol
133
133
  Buffered.read(self)
134
134
  end
135
135
 
136
+ # Discard the body as efficiently as possible.
137
+ #
138
+ # The default implementation simply reads all chunks until the body is empty.
139
+ #
140
+ # Useful for discarding the body when it is not needed, but preserving the underlying connection.
141
+ def discard
142
+ while chunk = self.read
143
+ end
144
+ end
145
+
136
146
  def as_json(...)
137
147
  {
138
148
  class: self.class.name,
@@ -40,6 +40,14 @@ module Protocol
40
40
  end
41
41
  end
42
42
 
43
+ # Discard the body as efficiently as possible.
44
+ def discard
45
+ if body = @body
46
+ @body = nil
47
+ body.discard
48
+ end
49
+ end
50
+
43
51
  # Buffer the entire request/response body.
44
52
  # @returns [Reader] itself.
45
53
  def buffered!
@@ -59,6 +59,10 @@ module Protocol
59
59
  @body.read
60
60
  end
61
61
 
62
+ def discard
63
+ @body.discard
64
+ end
65
+
62
66
  def as_json(...)
63
67
  {
64
68
  class: self.class.name,
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module HTTP
8
- VERSION = "0.35.0"
8
+ VERSION = "0.36.0"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.35.0
4
+ version: 0.36.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -47,7 +47,7 @@ cert_chain:
47
47
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
48
48
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
49
49
  -----END CERTIFICATE-----
50
- date: 2024-09-16 00:00:00.000000000 Z
50
+ date: 2024-09-17 00:00:00.000000000 Z
51
51
  dependencies: []
52
52
  description:
53
53
  email:
metadata.gz.sig CHANGED
Binary file