protocol-rack 0.11.2 → 0.12.0
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
- checksums.yaml.gz.sig +0 -0
- data/lib/protocol/rack/body.rb +25 -3
- data/lib/protocol/rack/version.rb +2 -2
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 253756f1f94918a43327d8f107e1a614414b6c7eee787d876135454697f3f108
|
4
|
+
data.tar.gz: bfe5453d726e362ac82c06a723d941991da8d6663749a924f8a81c919f6ca798
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 990b93f88c80068cdcf57c36ed0ff8bfeeb0e79044dab843668bf93db4eff71ce4117da113b0cac812625d178603c815ca121d8b233945772a0af289690e053c
|
7
|
+
data.tar.gz: f84b64ec28519ab67db3770d6e2dce6ee86387cbc730a283fe7fa83811da2bb0d6ff831fd05f41ca5c2e8f15b33c92e7864e6ab17ad8335ba965ff3be24505a2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/protocol/rack/body.rb
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
require_relative "body/streaming"
|
7
7
|
require_relative "body/enumerable"
|
8
|
+
require_relative "constants"
|
8
9
|
require "protocol/http/body/completable"
|
9
10
|
|
10
11
|
module Protocol
|
@@ -12,6 +13,10 @@ module Protocol
|
|
12
13
|
module Body
|
13
14
|
CONTENT_LENGTH = "content-length"
|
14
15
|
|
16
|
+
def self.no_content?(status)
|
17
|
+
status == 204 or status == 205 or status == 304
|
18
|
+
end
|
19
|
+
|
15
20
|
def self.wrap(env, status, headers, body, input = nil)
|
16
21
|
# In no circumstance do we want this header propagating out:
|
17
22
|
if length = headers.delete(CONTENT_LENGTH)
|
@@ -33,12 +38,29 @@ module Protocol
|
|
33
38
|
end
|
34
39
|
elsif body.respond_to?(:each)
|
35
40
|
body = Body::Enumerable.wrap(body, length)
|
36
|
-
|
41
|
+
elsif body
|
37
42
|
body = Body::Streaming.new(body, input)
|
43
|
+
else
|
44
|
+
Console.warn(self, "Rack response body was nil, ignoring!")
|
38
45
|
end
|
39
46
|
|
40
|
-
if
|
41
|
-
body
|
47
|
+
if body and no_content?(status)
|
48
|
+
unless body.empty?
|
49
|
+
Console.warn(self, "Rack response body was not empty, and status code indicates no content!", body: body, status: status)
|
50
|
+
end
|
51
|
+
|
52
|
+
body.close
|
53
|
+
body = nil
|
54
|
+
end
|
55
|
+
|
56
|
+
response_finished = env[RACK_RESPONSE_FINISHED]
|
57
|
+
|
58
|
+
if response_finished&.any?
|
59
|
+
if body
|
60
|
+
body = ::Protocol::HTTP::Body::Completable.new(body, completion_callback(response_finished, env, status, headers))
|
61
|
+
else
|
62
|
+
completion_callback(response_finished, env, status, headers).call(nil)
|
63
|
+
end
|
42
64
|
end
|
43
65
|
|
44
66
|
return body
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocol-rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -38,7 +38,7 @@ cert_chain:
|
|
38
38
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
39
39
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
40
40
|
-----END CERTIFICATE-----
|
41
|
-
date: 2025-
|
41
|
+
date: 2025-04-29 00:00:00.000000000 Z
|
42
42
|
dependencies:
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: protocol-http
|
@@ -104,7 +104,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
104
|
requirements:
|
105
105
|
- - ">="
|
106
106
|
- !ruby/object:Gem::Version
|
107
|
-
version: '3.
|
107
|
+
version: '3.2'
|
108
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
110
|
- - ">="
|
metadata.gz.sig
CHANGED
Binary file
|