protocol-rack 0.2.0 → 0.2.1
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/adapter/rack2.rb +24 -0
- data/lib/protocol/rack/response.rb +4 -0
- data/lib/protocol/rack/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- 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: c5cd531684b517c9695d07dfaa9f4301e3e77fcf52389b471f1f89aaa2227227
|
4
|
+
data.tar.gz: aa8f85b68326ca7f646d4c9e15bbdf0f6165bb969fad7345e933a8232e5263fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27afe33758a33782b67f9f569e65a828304296c63f21f892b9f27413c71c7021fceb2e57e02c21ce3f7e9f9abcac444626d64aaf73743d7be3b4119cea4c7893
|
7
|
+
data.tar.gz: 72089305ac61d33065352316385def71c940d1578c7739df08a4ea27704b494576d8830703b462c078ebb0e5a1f61a39be381e2a34496868c1057d8281f511f9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -33,6 +33,7 @@ module Protocol
|
|
33
33
|
RACK_MULTITHREAD => false,
|
34
34
|
RACK_MULTIPROCESS => true,
|
35
35
|
RACK_RUN_ONCE => false,
|
36
|
+
RACK_IS_HIJACK => true,
|
36
37
|
|
37
38
|
PROTOCOL_HTTP_REQUEST => request,
|
38
39
|
|
@@ -73,6 +74,29 @@ module Protocol
|
|
73
74
|
return env
|
74
75
|
end
|
75
76
|
|
77
|
+
# Build a rack `env` from the incoming request and apply it to the rack middleware.
|
78
|
+
#
|
79
|
+
# @parameter request [Protocol::HTTP::Request] The incoming request.
|
80
|
+
def call(request)
|
81
|
+
env = self.make_environment(request)
|
82
|
+
|
83
|
+
status, headers, body = @app.call(env)
|
84
|
+
|
85
|
+
headers, meta = self.wrap_headers(headers)
|
86
|
+
|
87
|
+
if hijack_body = meta[RACK_HIJACK]
|
88
|
+
body = hijack_body
|
89
|
+
end
|
90
|
+
|
91
|
+
return Response.wrap(env, status, headers, meta, body, request)
|
92
|
+
rescue => exception
|
93
|
+
Console.logger.error(self) {exception}
|
94
|
+
|
95
|
+
body&.close if body.respond_to?(:close)
|
96
|
+
|
97
|
+
return failure_response(exception)
|
98
|
+
end
|
99
|
+
|
76
100
|
# Process the rack response headers into into a {Protocol::HTTP::Headers} instance, along with any extra `rack.` metadata.
|
77
101
|
# @returns [Tuple(Protocol::HTTP::Headers, Hash)]
|
78
102
|
def wrap_headers(fields)
|
@@ -46,6 +46,10 @@ module Protocol
|
|
46
46
|
Console.logger.warn(self, "Ignoring protocol-level headers: #{ignored.inspect}")
|
47
47
|
end
|
48
48
|
|
49
|
+
if hijack_body = meta['rack.hijack']
|
50
|
+
body = hijack_body
|
51
|
+
end
|
52
|
+
|
49
53
|
body = Body.wrap(env, status, headers, body, request&.body)
|
50
54
|
|
51
55
|
if request&.head?
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|