protocol-rack 0.4.0 → 0.5.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: 7aabc09a18a32e49d2a964c0b736d1e8613532d21a814dd1301be60a4963c057
4
- data.tar.gz: b229ee85cca50e1803421ef4cf831b15258210d93d1613ef3bd864861a5762d9
3
+ metadata.gz: e9ac7ef853c3b25a46b06d630fc29921d76e8ee0213554d94afa19efdb9ccd87
4
+ data.tar.gz: ce65dd607e37ee33c6f20ecd4b0fa5976634be40869ac9d0add4e197d43d8cd7
5
5
  SHA512:
6
- metadata.gz: 2989f0116da4d5c66cc776f9fda9cc6e67e92744af61d7ab8cb326611829dd372bf10b8610cc3f61dc88e8d8989222a02adb787a3bd763986c057e0b213203ae
7
- data.tar.gz: b0a371f9ec89ed91f2745a7590a601ddb62591d3e14161d16c24881aff90c08e43d46a4ca881916204e1819d47a4f3a5ab24620cc333a807c1b8a81a5a9806fc
6
+ metadata.gz: 7ea217d520678401acc7d89d5a592e958bc47bcffc07439c02f4f52e2df89c0cf0391e2f6fbb6c6a94be7e2f31a0b2757d2ccc389a7ae72311e3f7a30f388c47
7
+ data.tar.gz: a9e4587094746830e41a449892bc19c9fb43c7d5625529f321f8e5e72e0422908703719b0bdd983f96ea18f1a13f6697dbd06e254aa62e554cabf3356d97ba61
checksums.yaml.gz.sig CHANGED
Binary file
@@ -17,6 +17,11 @@ module Protocol
17
17
  self.new(app)
18
18
  end
19
19
 
20
+ def self.parse_file(...)
21
+ # This is the old interface, which was changed in Rack 3.
22
+ ::Rack::Builder.parse_file(...).first
23
+ end
24
+
20
25
  # Initialize the rack adaptor middleware.
21
26
  # @parameter app [Object] The rack middleware.
22
27
  def initialize(app)
@@ -26,9 +31,9 @@ module Protocol
26
31
  end
27
32
 
28
33
  def logger
29
- Console.logger
34
+ Console
30
35
  end
31
-
36
+
32
37
  # Unwrap raw HTTP headers into the CGI-style expected by Rack middleware.
33
38
  #
34
39
  # Rack separates multiple headers with the same key, into a single field with multiple lines.
@@ -74,6 +79,7 @@ module Protocol
74
79
  end
75
80
 
76
81
  if request.respond_to?(:hijack?) and request.hijack?
82
+ env[RACK_IS_HIJACK] = true
77
83
  env[RACK_HIJACK] = proc{request.hijack!.io.dup}
78
84
  end
79
85
 
@@ -115,7 +121,7 @@ module Protocol
115
121
 
116
122
  return Response.wrap(env, status, headers, meta, body, request)
117
123
  rescue => exception
118
- Console.logger.error(self) {exception}
124
+ Console.error(self, exception)
119
125
 
120
126
  body&.close if body.respond_to?(:close)
121
127
 
@@ -17,9 +17,6 @@ module Protocol
17
17
  RACK_MULTIPROCESS = 'rack.multiprocess'
18
18
  RACK_RUN_ONCE = 'rack.run_once'
19
19
 
20
- RACK_IS_HIJACK = 'rack.hijack?'
21
- RACK_HIJACK = 'rack.hijack'
22
-
23
20
  def self.wrap(app)
24
21
  Rewindable.new(self.new(app))
25
22
  end
@@ -90,7 +87,7 @@ module Protocol
90
87
 
91
88
  return Response.wrap(env, status, headers, meta, body, request)
92
89
  rescue => exception
93
- Console.logger.error(self) {exception}
90
+ Console.error(self, exception)
94
91
 
95
92
  body&.close if body.respond_to?(:close)
96
93
 
@@ -15,6 +15,10 @@ module Protocol
15
15
  self.new(app)
16
16
  end
17
17
 
18
+ def self.parse_file(...)
19
+ ::Rack::Builder.parse_file(...)
20
+ end
21
+
18
22
  def make_environment(request)
19
23
  request_path, query_string = request.path.split('?', 2)
20
24
  server_name, server_port = (request.authority || '').split(':', 2)
@@ -24,6 +24,10 @@ module Protocol
24
24
  def self.make_response(env, response)
25
25
  IMPLEMENTATION.make_response(env, response)
26
26
  end
27
+
28
+ def self.parse_file(...)
29
+ IMPLEMENTATION.parse_file(...)
30
+ end
27
31
  end
28
32
  end
29
33
  end
@@ -36,5 +36,9 @@ module Protocol
36
36
  RACK_URL_SCHEME = 'rack.url_scheme'
37
37
  RACK_PROTOCOL = 'rack.protocol'
38
38
  RACK_RESPONSE_FINISHED = 'rack.response_finished'
39
+
40
+ # Rack hijack support:
41
+ RACK_IS_HIJACK = 'rack.hijack?'
42
+ RACK_HIJACK = 'rack.hijack'
39
43
  end
40
44
  end
@@ -43,7 +43,7 @@ module Protocol
43
43
  ignored = headers.extract(HOP_HEADERS)
44
44
 
45
45
  unless ignored.empty?
46
- Console.logger.warn(self, "Ignoring protocol-level headers: #{ignored.inspect}")
46
+ Console.warn(self, "Ignoring hop headers!", ignored: ignored)
47
47
  end
48
48
 
49
49
  if hijack_body = meta['rack.hijack']
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module Rack
8
- VERSION = "0.4.0"
8
+ VERSION = "0.5.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-rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.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: 2023-12-11 00:00:00.000000000 Z
41
+ date: 2024-04-03 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: protocol-http
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  requirements: []
113
- rubygems_version: 3.4.22
113
+ rubygems_version: 3.5.3
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: An implementation of the Rack protocol/specification.
metadata.gz.sig CHANGED
Binary file