protocol-rack 0.15.0 → 0.16.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0994443c638a7cf147afcb7a8b88a1a6e5e8ab607071c10792d65c912fb9b37
4
- data.tar.gz: 22a6c27089e34db868a7af15fac1061979791872c811aef51762b68435fb9346
3
+ metadata.gz: 6d1c1680392355d0bf9a1aa9b6b76f2267f9d1f612e4ae194fe5933a95fb4486
4
+ data.tar.gz: 8401fd53bbe49d9547f187f06a23ba334eae3814570f041b333c8c3c30aa317b
5
5
  SHA512:
6
- metadata.gz: 60caa82495eb534bfb3367009b7567304c1c36b2db646fbee99d7c68eaba810c9913ad8c847c7939e0d60bb29bd049bdfb67ff365f68f9142b65d6cf7a7bf8f8
7
- data.tar.gz: 63313385d9603b0bdaddeb39410dbcf7a3485652478d886ffbb5e8ea926a1b5006bcbd21bdc3b6a3851e43f1f601ded523021d700cd00dd0d2ab252b529378fa
6
+ metadata.gz: 7e3194c1c3ae772b58d15126fa918150b3e04791bfcf24a25ef6314d573392c3b8fdfca9efd7bab47a17ab1fd99d2b9a32323699014c900840024368fdfcabcd
7
+ data.tar.gz: ebbcaf7b1368633de01b261c1ad8c6f741f798b74d28070e33d4023887b306acb9a86df5b243f2b3bef737a148663c45a94bd981e6cf3d9757ce82048c4be830
checksums.yaml.gz.sig CHANGED
Binary file
@@ -114,7 +114,7 @@ module Protocol
114
114
 
115
115
  if request.respond_to?(:hijack?) and request.hijack?
116
116
  env[RACK_IS_HIJACK] = true
117
- env[RACK_HIJACK] = proc{request.hijack!.io.dup}
117
+ env[RACK_HIJACK] = proc{request.hijack!.io}
118
118
  end
119
119
 
120
120
  # HTTP/2 prefers `:authority` over `host`, so we do this for backwards compatibility.
@@ -188,7 +188,7 @@ module Protocol
188
188
  # This is the newer mechanism for protocol upgrade:
189
189
  if env["rack.protocol"]
190
190
  headers["rack.protocol"] = protocol
191
-
191
+
192
192
  # Older mechanism for protocol upgrade:
193
193
  elsif env[CGI::HTTP_UPGRADE]
194
194
  headers["upgrade"] = protocol
@@ -44,7 +44,7 @@ module Protocol
44
44
  RACK_INPUT => Input.new(request.body),
45
45
  RACK_ERRORS => $stderr,
46
46
  RACK_LOGGER => self.logger,
47
-
47
+
48
48
  # The HTTP request method, such as "GET" or "POST". This cannot ever be an empty string, and so is always required.
49
49
  CGI::REQUEST_METHOD => request.method,
50
50
 
@@ -55,7 +55,7 @@ module Protocol
55
55
  CGI::PATH_INFO => request_path,
56
56
  CGI::REQUEST_PATH => request_path,
57
57
  CGI::REQUEST_URI => request.path,
58
-
58
+
59
59
  # The portion of the request URL that follows the ?, if any. May be empty, but is always required!
60
60
  CGI::QUERY_STRING => query_string || "",
61
61
 
@@ -68,7 +68,7 @@ module Protocol
68
68
  # I'm not sure what sane defaults should be here:
69
69
  CGI::SERVER_NAME => server_name,
70
70
  }
71
-
71
+
72
72
  # SERVER_PORT is optional but must not be set if it is not present.
73
73
  if server_port
74
74
  env[CGI::SERVER_PORT] = server_port
@@ -100,7 +100,7 @@ module Protocol
100
100
  def stream?
101
101
  !@body.respond_to?(:each)
102
102
  end
103
-
103
+
104
104
  # Stream the response body to the given stream.
105
105
  # The body is automatically closed after streaming.
106
106
  #
@@ -112,7 +112,7 @@ module Protocol
112
112
  ensure
113
113
  self.close(error)
114
114
  end
115
-
115
+
116
116
  # Read the next chunk from the response body.
117
117
  # Returns nil when there are no more chunks.
118
118
  #
@@ -23,13 +23,13 @@ module Protocol
23
23
  def self.[](env)
24
24
  env["protocol.http.request"] ||= new(env)
25
25
  end
26
-
26
+
27
27
  # Initialize a new Request instance from a Rack environment.
28
28
  #
29
29
  # @parameter env [Hash] The Rack environment hash.
30
30
  def initialize(env)
31
31
  @env = env
32
-
32
+
33
33
  super(
34
34
  @env["rack.url_scheme"],
35
35
  @env["HTTP_HOST"],
@@ -41,7 +41,7 @@ module Protocol
41
41
  self.class.protocol(@env)
42
42
  )
43
43
  end
44
-
44
+
45
45
  # Extract the protocol list from the Rack environment.
46
46
  # Checks both `rack.protocol` and `HTTP_UPGRADE` headers.
47
47
  #
@@ -54,7 +54,7 @@ module Protocol
54
54
  return protocols.split(/\s*,\s*/)
55
55
  end
56
56
  end
57
-
57
+
58
58
  # Extract HTTP headers from the Rack environment.
59
59
  # Converts Rack's `HTTP_*` environment variables to proper HTTP headers.
60
60
  #
@@ -68,7 +68,7 @@ module Protocol
68
68
  headers[key[5..-1].gsub("_", "-").downcase] = value
69
69
  end
70
70
  end
71
-
71
+
72
72
  return headers
73
73
  end
74
74
  end
@@ -45,11 +45,11 @@ module Protocol
45
45
  unless ignored.empty?
46
46
  Console.warn(self, "Ignoring hop headers!", ignored: ignored)
47
47
  end
48
-
48
+
49
49
  if hijack_body = meta["rack.hijack"]
50
50
  body = hijack_body
51
51
  end
52
-
52
+
53
53
  body = Body.wrap(env, status, headers, body, request&.body, request&.head?)
54
54
 
55
55
  protocol = meta[RACK_PROTOCOL]
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module Rack
8
- VERSION = "0.15.0"
8
+ VERSION = "0.16.0"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -67,6 +67,10 @@ run proc{|env|
67
67
 
68
68
  Please see the [project releases](https://socketry.github.io/protocol-rack/releases/index) for all releases.
69
69
 
70
+ ### v0.16.0
71
+
72
+ - Hijacked IO is no longer duped, as it's not retained by the original connection, and `SSLSocket` does not support duping.
73
+
70
74
  ### v0.15.0
71
75
 
72
76
  - Use `IO::Stream::Readable` for the input body, which is a better tested and more robust interface.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.16.0
4
+
5
+ - Hijacked IO is no longer duped, as it's not retained by the original connection, and `SSLSocket` does not support duping.
6
+
3
7
  ## v0.15.0
4
8
 
5
9
  - Use `IO::Stream::Readable` for the input body, which is a better tested and more robust interface.
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.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file