rackup 0.2.1 → 0.2.3

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: e589967d4da7b87597335726bbd0770d44f345eef83706d2b1886a86f4f09a0a
4
- data.tar.gz: 22c3c0a2ae836b3bc7d7ef3ccaf2fcd7e0afe91cb95d00da88249594e87c7d58
3
+ metadata.gz: 23caa71b03397adf9344168de947fca289d1e4df6c577678e8b7fc8285c522e9
4
+ data.tar.gz: e39027a50a3f54eb0928d6cef394f79cdd52c71da06854f2fcf5ba3a5722c083
5
5
  SHA512:
6
- metadata.gz: e9be340c56bb382ec01f9a6953a1fdf78f70bdd29e168970ca450ba61de1f01dfe1d6ccea74cfa8843dd9a3557ed08db21fae5e9d0a95a259d2b8aaa99ee2c31
7
- data.tar.gz: f4f9dc54cd4e33282d75a95b490f30aeffebbe879ea9a6fd21dee9395e0d637e8cd4a12e5be11c9c5f4077eb00b0f646674bfb3bb03c4895379155f141ec6dcb
6
+ metadata.gz: be73868bc8995d73ae90f9e70bc6b8141ff5b0c26276cfcb8c010376cf3b7bdfc97d3836afad0524de61cee8c9cb910f16806becae671569fbb3484702c84e6c
7
+ data.tar.gz: fdad77f1c5b70d027c67a893db852bb825631772854df4bfdfc08d3d5ab2a2c40212375bc318f276695ce659014b7f72a2c80d62b0c0c73a0f6069649f21c845
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ Released under the MIT license.
2
+
3
+ Copyright, 2007-2021, by [Leah Neukirchen](https://leahneukirchen.org).
4
+ Copyright, 2022, by [Samuel G. D. Williams](https://www.codeotaku.com).
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
data/lib/rack/handler.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  warn "Rack::Handler is deprecated and replaced by Rackup::Handler"
2
4
  require_relative '../rackup/handler'
3
5
  module Rack
data/lib/rack/server.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  warn "Rack::Server is deprecated and replaced by Rackup::Server"
2
4
  require_relative '../rackup/server'
3
5
  module Rack
@@ -93,18 +93,26 @@ module Rackup
93
93
 
94
94
  status, headers, body = @app.call(env)
95
95
  begin
96
- res.status = status.to_i
97
- io_lambda = nil
96
+ res.status = status
97
+
98
+ if value = headers[RACK_HIJACK]
99
+ io_lambda = value
100
+ elsif !body.respond_to?(:to_path) && !body.respond_to?(:each)
101
+ io_lambda = body
102
+ end
103
+
104
+ if value = headers.delete('set-cookie')
105
+ res.cookies.concat(Array(value))
106
+ end
107
+
98
108
  headers.each { |key, value|
99
- if key == RACK_HIJACK
100
- io_lambda = value
101
- elsif key == "set-cookie"
102
- res.cookies.concat(Array(value))
103
- else
104
- # Since WEBrick won't accept repeated headers,
105
- # merge the values per RFC 1945 section 4.2.
106
- res[key] = Array(value).join(", ")
107
- end
109
+ # Skip keys starting with rack., per Rack SPEC
110
+ next if key.start_with?('rack.')
111
+
112
+ # Since WEBrick won't accept repeated headers,
113
+ # merge the values per RFC 1945 section 4.2.
114
+ value = value.join(", ") if Array === value
115
+ res[key] = value
108
116
  }
109
117
 
110
118
  if io_lambda
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Rackup
24
- VERSION = "0.2.1"
24
+ VERSION = "0.2.3"
25
25
  end
data/lib/rackup.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'rackup/handler'
2
4
  require_relative 'rackup/server'
3
5
  require_relative 'rackup/version'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rackup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rack Contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-09 00:00:00.000000000 Z
11
+ date: 2022-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -115,6 +115,7 @@ executables:
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
+ - LICENSE.md
118
119
  - bin/rackup
119
120
  - lib/rack/handler.rb
120
121
  - lib/rack/server.rb