rackup 2.0.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rackup/handler/webrick.rb +61 -41
- data/lib/rackup/stream.rb +199 -0
- data/lib/rackup/version.rb +1 -1
- data/lib/rackup.rb +13 -3
- data/license.md +12 -11
- data/readme.md +35 -2
- data/releases.md +24 -0
- metadata +67 -91
- data/lib/rack/handler.rb +0 -10
- data/lib/rack/server.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f990d6a3b6103f23a015bacb051fd97d92b81abe5ecf57dc327c7b260d1514e
|
4
|
+
data.tar.gz: 92844c4a1bd05547a93a0b4742c20cf6c41b05a67f43d90fc38a17bb147d8fe0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ba5437ff800937391e10b6018de1097eb6022329820e6588d34324c35d78a606dc0bdfb17299ee2e9f251a474f765fc87b954bf58ea5ea1754b7848cc8db174
|
7
|
+
data.tar.gz: 68c499a29127a5989a4d893cdd64706850d03a30b257ad1b3f3745507652d5678a83eecb18aa398e8c4bfcfd18a2891e1f718e7dc969033d068584d03cfe7128
|
@@ -11,28 +11,11 @@ require 'rack/constants'
|
|
11
11
|
require_relative '../handler'
|
12
12
|
require_relative '../version'
|
13
13
|
|
14
|
-
|
15
|
-
# through WEBrick::HTTPResponse if rack is set to true.
|
16
|
-
class WEBrick::HTTPResponse
|
17
|
-
attr_accessor :rack
|
18
|
-
|
19
|
-
alias _rack_setup_header setup_header
|
20
|
-
def setup_header
|
21
|
-
app_chunking = rack && @header['transfer-encoding'] == 'chunked'
|
22
|
-
|
23
|
-
@chunked = app_chunking if app_chunking
|
24
|
-
|
25
|
-
_rack_setup_header
|
26
|
-
|
27
|
-
@chunked = false if app_chunking
|
28
|
-
end
|
29
|
-
end
|
14
|
+
require_relative '../stream'
|
30
15
|
|
31
16
|
module Rackup
|
32
17
|
module Handler
|
33
18
|
class WEBrick < ::WEBrick::HTTPServlet::AbstractServlet
|
34
|
-
include Rack
|
35
|
-
|
36
19
|
def self.run(app, **options)
|
37
20
|
environment = ENV['RACK_ENV'] || 'development'
|
38
21
|
default_host = environment == 'development' ? 'localhost' : nil
|
@@ -73,43 +56,75 @@ module Rackup
|
|
73
56
|
@app = app
|
74
57
|
end
|
75
58
|
|
59
|
+
# This handles mapping the WEBrick request to a Rack input stream.
|
60
|
+
class Input
|
61
|
+
include Stream::Reader
|
62
|
+
|
63
|
+
def initialize(request)
|
64
|
+
@request = request
|
65
|
+
|
66
|
+
@reader = Fiber.new do
|
67
|
+
@request.body do |chunk|
|
68
|
+
Fiber.yield(chunk)
|
69
|
+
end
|
70
|
+
|
71
|
+
Fiber.yield(nil)
|
72
|
+
|
73
|
+
# End of stream:
|
74
|
+
@reader = nil
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def close
|
79
|
+
@request = nil
|
80
|
+
@reader = nil
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
# Read one chunk from the request body.
|
86
|
+
def read_next
|
87
|
+
@reader&.resume
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
76
91
|
def service(req, res)
|
77
|
-
res.rack = true
|
78
92
|
env = req.meta_vars
|
79
93
|
env.delete_if { |k, v| v.nil? }
|
80
94
|
|
81
|
-
|
82
|
-
rack_input.set_encoding(Encoding::BINARY)
|
95
|
+
input = Input.new(req)
|
83
96
|
|
84
97
|
env.update(
|
85
|
-
RACK_INPUT
|
86
|
-
RACK_ERRORS
|
87
|
-
RACK_URL_SCHEME
|
88
|
-
RACK_IS_HIJACK
|
98
|
+
::Rack::RACK_INPUT => input,
|
99
|
+
::Rack::RACK_ERRORS => $stderr,
|
100
|
+
::Rack::RACK_URL_SCHEME => ["yes", "on", "1"].include?(env[::Rack::HTTPS]) ? "https" : "http",
|
101
|
+
::Rack::RACK_IS_HIJACK => true,
|
89
102
|
)
|
90
103
|
|
91
|
-
env[QUERY_STRING] ||= ""
|
92
|
-
unless env[PATH_INFO] == ""
|
93
|
-
path, n = req.request_uri.path, env[SCRIPT_NAME].length
|
94
|
-
env[PATH_INFO] = path[n, path.length - n]
|
104
|
+
env[::Rack::QUERY_STRING] ||= ""
|
105
|
+
unless env[::Rack::PATH_INFO] == ""
|
106
|
+
path, n = req.request_uri.path, env[::Rack::SCRIPT_NAME].length
|
107
|
+
env[::Rack::PATH_INFO] = path[n, path.length - n]
|
95
108
|
end
|
96
|
-
env[REQUEST_PATH] ||= [env[SCRIPT_NAME], env[PATH_INFO]].join
|
109
|
+
env[::Rack::REQUEST_PATH] ||= [env[::Rack::SCRIPT_NAME], env[::Rack::PATH_INFO]].join
|
97
110
|
|
98
111
|
status, headers, body = @app.call(env)
|
99
112
|
begin
|
100
113
|
res.status = status
|
101
114
|
|
102
|
-
if value = headers[RACK_HIJACK]
|
115
|
+
if value = headers[::Rack::RACK_HIJACK]
|
103
116
|
io_lambda = value
|
117
|
+
body = nil
|
104
118
|
elsif !body.respond_to?(:to_path) && !body.respond_to?(:each)
|
105
119
|
io_lambda = body
|
120
|
+
body = nil
|
106
121
|
end
|
107
122
|
|
108
123
|
if value = headers.delete('set-cookie')
|
109
124
|
res.cookies.concat(Array(value))
|
110
125
|
end
|
111
126
|
|
112
|
-
headers.each
|
127
|
+
headers.each do |key, value|
|
113
128
|
# Skip keys starting with rack., per Rack SPEC
|
114
129
|
next if key.start_with?('rack.')
|
115
130
|
|
@@ -117,22 +132,27 @@ module Rackup
|
|
117
132
|
# merge the values per RFC 1945 section 4.2.
|
118
133
|
value = value.join(", ") if Array === value
|
119
134
|
res[key] = value
|
120
|
-
|
135
|
+
end
|
121
136
|
|
122
137
|
if io_lambda
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
138
|
+
protocol = headers['rack.protocol'] || headers['upgrade']
|
139
|
+
|
140
|
+
if protocol
|
141
|
+
# Set all the headers correctly for an upgrade response:
|
142
|
+
res.upgrade!(protocol)
|
143
|
+
end
|
144
|
+
res.body = io_lambda
|
127
145
|
elsif body.respond_to?(:to_path)
|
128
146
|
res.body = ::File.open(body.to_path, 'rb')
|
129
147
|
else
|
130
|
-
|
131
|
-
|
132
|
-
|
148
|
+
buffer = String.new
|
149
|
+
body.each do |part|
|
150
|
+
buffer << part
|
151
|
+
end
|
152
|
+
res.body = buffer
|
133
153
|
end
|
134
154
|
ensure
|
135
|
-
body.close if body.respond_to?
|
155
|
+
body.close if body.respond_to?(:close)
|
136
156
|
end
|
137
157
|
end
|
138
158
|
end
|
@@ -0,0 +1,199 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2023-2024, by Samuel Williams.
|
5
|
+
|
6
|
+
module Rackup
|
7
|
+
# The input stream is an IO-like object which contains the raw HTTP POST data. When applicable, its external encoding must be “ASCII-8BIT” and it must be opened in binary mode, for Ruby 1.9 compatibility. The input stream must respond to gets, each, read and rewind.
|
8
|
+
class Stream
|
9
|
+
def initialize(input = nil, output = Buffered.new)
|
10
|
+
@input = input
|
11
|
+
@output = output
|
12
|
+
|
13
|
+
raise ArgumentError, "Non-writable output!" unless output.respond_to?(:write)
|
14
|
+
|
15
|
+
# Will hold remaining data in `#read`.
|
16
|
+
@buffer = nil
|
17
|
+
@closed = false
|
18
|
+
end
|
19
|
+
|
20
|
+
attr :input
|
21
|
+
attr :output
|
22
|
+
|
23
|
+
# This provides a read-only interface for data, which is surprisingly tricky to implement correctly.
|
24
|
+
module Reader
|
25
|
+
# rack.hijack_io must respond to:
|
26
|
+
# read, write, read_nonblock, write_nonblock, flush, close, close_read, close_write, closed?
|
27
|
+
|
28
|
+
# read behaves like IO#read. Its signature is read([length, [buffer]]). If given, length must be a non-negative Integer (>= 0) or nil, and buffer must be a String and may not be nil. If length is given and not nil, then this method reads at most length bytes from the input stream. If length is not given or nil, then this method reads all data until EOF. When EOF is reached, this method returns nil if length is given and not nil, or “” if length is not given or is nil. If buffer is given, then the read data will be placed into buffer instead of a newly created String object.
|
29
|
+
# @param length [Integer] the amount of data to read
|
30
|
+
# @param buffer [String] the buffer which will receive the data
|
31
|
+
# @return a buffer containing the data
|
32
|
+
def read(length = nil, buffer = nil)
|
33
|
+
return '' if length == 0
|
34
|
+
|
35
|
+
buffer ||= String.new.force_encoding(Encoding::BINARY)
|
36
|
+
|
37
|
+
# Take any previously buffered data and replace it into the given buffer.
|
38
|
+
if @buffer
|
39
|
+
buffer.replace(@buffer)
|
40
|
+
@buffer = nil
|
41
|
+
else
|
42
|
+
buffer.clear
|
43
|
+
end
|
44
|
+
|
45
|
+
if length
|
46
|
+
while buffer.bytesize < length and chunk = read_next
|
47
|
+
buffer << chunk
|
48
|
+
end
|
49
|
+
|
50
|
+
# This ensures the subsequent `slice!` works correctly.
|
51
|
+
buffer.force_encoding(Encoding::BINARY)
|
52
|
+
|
53
|
+
# This will be at least one copy:
|
54
|
+
@buffer = buffer.byteslice(length, buffer.bytesize)
|
55
|
+
|
56
|
+
# This should be zero-copy:
|
57
|
+
buffer.slice!(length, buffer.bytesize)
|
58
|
+
|
59
|
+
if buffer.empty?
|
60
|
+
return nil
|
61
|
+
else
|
62
|
+
return buffer
|
63
|
+
end
|
64
|
+
else
|
65
|
+
while chunk = read_next
|
66
|
+
buffer << chunk
|
67
|
+
end
|
68
|
+
|
69
|
+
return buffer
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Read at most `length` bytes from the stream. Will avoid reading from the underlying stream if possible.
|
74
|
+
def read_partial(length = nil)
|
75
|
+
if @buffer
|
76
|
+
buffer = @buffer
|
77
|
+
@buffer = nil
|
78
|
+
else
|
79
|
+
buffer = read_next
|
80
|
+
end
|
81
|
+
|
82
|
+
if buffer and length
|
83
|
+
if buffer.bytesize > length
|
84
|
+
# This ensures the subsequent `slice!` works correctly.
|
85
|
+
buffer.force_encoding(Encoding::BINARY)
|
86
|
+
|
87
|
+
@buffer = buffer.byteslice(length, buffer.bytesize)
|
88
|
+
buffer.slice!(length, buffer.bytesize)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
return buffer
|
93
|
+
end
|
94
|
+
|
95
|
+
def gets
|
96
|
+
read_partial
|
97
|
+
end
|
98
|
+
|
99
|
+
def each
|
100
|
+
while chunk = read_partial
|
101
|
+
yield chunk
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def read_nonblock(length, buffer = nil)
|
106
|
+
@buffer ||= read_next
|
107
|
+
chunk = nil
|
108
|
+
|
109
|
+
unless @buffer
|
110
|
+
buffer&.clear
|
111
|
+
return
|
112
|
+
end
|
113
|
+
|
114
|
+
if @buffer.bytesize > length
|
115
|
+
chunk = @buffer.byteslice(0, length)
|
116
|
+
@buffer = @buffer.byteslice(length, @buffer.bytesize)
|
117
|
+
else
|
118
|
+
chunk = @buffer
|
119
|
+
@buffer = nil
|
120
|
+
end
|
121
|
+
|
122
|
+
if buffer
|
123
|
+
buffer.replace(chunk)
|
124
|
+
else
|
125
|
+
buffer = chunk
|
126
|
+
end
|
127
|
+
|
128
|
+
return buffer
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
include Reader
|
133
|
+
|
134
|
+
def write(buffer)
|
135
|
+
if @output
|
136
|
+
@output.write(buffer)
|
137
|
+
return buffer.bytesize
|
138
|
+
else
|
139
|
+
raise IOError, "Stream is not writable, output has been closed!"
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def write_nonblock(buffer)
|
144
|
+
write(buffer)
|
145
|
+
end
|
146
|
+
|
147
|
+
def <<(buffer)
|
148
|
+
write(buffer)
|
149
|
+
end
|
150
|
+
|
151
|
+
def flush
|
152
|
+
end
|
153
|
+
|
154
|
+
def close_read
|
155
|
+
@input&.close
|
156
|
+
@input = nil
|
157
|
+
end
|
158
|
+
|
159
|
+
# close must never be called on the input stream. huh?
|
160
|
+
def close_write
|
161
|
+
if @output.respond_to?(:close)
|
162
|
+
@output&.close
|
163
|
+
end
|
164
|
+
|
165
|
+
@output = nil
|
166
|
+
end
|
167
|
+
|
168
|
+
# Close the input and output bodies.
|
169
|
+
def close(error = nil)
|
170
|
+
self.close_read
|
171
|
+
self.close_write
|
172
|
+
|
173
|
+
return nil
|
174
|
+
ensure
|
175
|
+
@closed = true
|
176
|
+
end
|
177
|
+
|
178
|
+
# Whether the stream has been closed.
|
179
|
+
def closed?
|
180
|
+
@closed
|
181
|
+
end
|
182
|
+
|
183
|
+
# Whether there are any output chunks remaining?
|
184
|
+
def empty?
|
185
|
+
@output.empty?
|
186
|
+
end
|
187
|
+
|
188
|
+
private
|
189
|
+
|
190
|
+
def read_next
|
191
|
+
if @input
|
192
|
+
return @input.read
|
193
|
+
else
|
194
|
+
@input = nil
|
195
|
+
raise IOError, "Stream is not readable, input has been closed!"
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
data/lib/rackup/version.rb
CHANGED
data/lib/rackup.rb
CHANGED
@@ -1,11 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2022-
|
4
|
+
# Copyright, 2022-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require_relative 'rackup/handler'
|
7
7
|
require_relative 'rackup/server'
|
8
8
|
require_relative 'rackup/version'
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
begin
|
11
|
+
# Although webrick is gone from Ruby since 3.0, it still warns all the way
|
12
|
+
# through to 3.3. Only on 3.4 will requiring it not produce a warning anymore.
|
13
|
+
verbose, $VERBOSE = $VERBOSE, nil
|
14
|
+
require 'webrick'
|
15
|
+
# If the user happens to have webrick in their bundle, make the handler available.
|
16
|
+
require_relative 'rackup/handler/webrick'
|
17
|
+
rescue LoadError
|
18
|
+
# ¯\_(ツ)_/¯
|
19
|
+
ensure
|
20
|
+
$VERBOSE = verbose
|
21
|
+
end
|
data/license.md
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
Copyright, 2007-2009, by Leah Neukirchen.
|
4
4
|
Copyright, 2008, by Marc-André Cournoyer.
|
5
5
|
Copyright, 2009, by Aaron Pfeifer.
|
6
|
-
Copyright, 2009, by
|
6
|
+
Copyright, 2009-2010, by Megan Batty.
|
7
7
|
Copyright, 2009-2010, by Michael Fellinger.
|
8
8
|
Copyright, 2009, by Genki Takiuchi.
|
9
9
|
Copyright, 2009, by Joshua Peek.
|
10
|
-
Copyright, 2009, by Yehuda Katz
|
10
|
+
Copyright, 2009, by Yehuda Katz.
|
11
11
|
Copyright, 2009, by Carl Lerche.
|
12
12
|
Copyright, 2010, by Julik Tarkhanov.
|
13
13
|
Copyright, 2010-2016, by James Tucker.
|
@@ -16,7 +16,6 @@ Copyright, 2010, by Loren Segal.
|
|
16
16
|
Copyright, 2010, by Andrew Bortz.
|
17
17
|
Copyright, 2010, by John Barnette.
|
18
18
|
Copyright, 2010, by John Sumsion.
|
19
|
-
Copyright, 2010, by Graham.
|
20
19
|
Copyright, 2011-2018, by Aaron Patterson.
|
21
20
|
Copyright, 2011, by Konstantin Haase.
|
22
21
|
Copyright, 2011, by Blake Mizerany.
|
@@ -25,9 +24,9 @@ Copyright, 2012, by Jean Boussier.
|
|
25
24
|
Copyright, 2012, by Trevor Wennblom.
|
26
25
|
Copyright, 2012, by Anurag Priyam.
|
27
26
|
Copyright, 2012, by Hrvoje Šimić.
|
28
|
-
Copyright, 2013, by Uchio
|
27
|
+
Copyright, 2013, by Uchio Kondo.
|
29
28
|
Copyright, 2013, by Tim Moore.
|
30
|
-
Copyright, 2013, by
|
29
|
+
Copyright, 2013, by Hal Brodigan.
|
31
30
|
Copyright, 2013, by Bas Vodde.
|
32
31
|
Copyright, 2013, by Joe Fiorini.
|
33
32
|
Copyright, 2014, by Wyatt Pan.
|
@@ -35,30 +34,32 @@ Copyright, 2014, by Lenny Marks.
|
|
35
34
|
Copyright, 2014, by Igor Bochkariov.
|
36
35
|
Copyright, 2014, by Max Cantor.
|
37
36
|
Copyright, 2014, by David Celis.
|
38
|
-
Copyright, 2014, by Rafael
|
37
|
+
Copyright, 2014-2019, by Rafael França.
|
39
38
|
Copyright, 2014, by Jeremy Kemper.
|
40
39
|
Copyright, 2014, by Richard Schneeman.
|
41
40
|
Copyright, 2015, by Peter Wilmott.
|
42
41
|
Copyright, 2015, by Sean McGivern.
|
43
42
|
Copyright, 2015, by Tadashi Saito.
|
44
|
-
Copyright, 2015, by
|
43
|
+
Copyright, 2015, by Martin Hrdlicka.
|
45
44
|
Copyright, 2015, by Zachary Scott.
|
46
45
|
Copyright, 2016, by Sophie Deziel.
|
47
46
|
Copyright, 2016, by Kazuya Hotta.
|
48
47
|
Copyright, 2017, by Ryunosuke Sato.
|
49
|
-
Copyright, 2017-
|
48
|
+
Copyright, 2017-2024, by Samuel Williams.
|
50
49
|
Copyright, 2018, by Dillon Welch.
|
51
50
|
Copyright, 2018, by Yoshiyuki Hirano.
|
52
51
|
Copyright, 2018, by Nick LaMuro.
|
53
|
-
Copyright, 2019, by Rafael França.
|
54
52
|
Copyright, 2019, by Krzysztof Rybka.
|
55
53
|
Copyright, 2019, by Misaki Shioi.
|
56
54
|
Copyright, 2020-2022, by Jeremy Evans.
|
57
|
-
Copyright, 2021, by Katsuhiko
|
58
|
-
Copyright, 2021, by
|
55
|
+
Copyright, 2021, by Katsuhiko Yoshida.
|
56
|
+
Copyright, 2021, by Kang Sheng.
|
59
57
|
Copyright, 2021, by Stephen Paul Weber.
|
60
58
|
Copyright, 2022, by Akira Matsuda.
|
61
59
|
Copyright, 2022, by Andrew Hoglund.
|
60
|
+
Copyright, 2024, by Olle Jonsson.
|
61
|
+
Copyright, 2024, by Geremia Taglialatela.
|
62
|
+
Copyright, 2024, by Petrik de Heus.
|
62
63
|
|
63
64
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
64
65
|
of this software and associated documentation files (the "Software"), to deal
|
data/readme.md
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
# Rackup
|
2
2
|
|
3
|
-
`rackup` provides a command line interface for running a Rack-compatible application.
|
3
|
+
`rackup` provides a command line interface for running a Rack-compatible application. It also provides a generic interface for starting a `rack`-compatible server: `Rackup::Handler`. It is not designed for production use.
|
4
4
|
|
5
5
|
[![Development Status](https://github.com/rack/rackup/workflows/Test/badge.svg)](https://github.com/rack/rackup/actions?workflow=Test)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
9
|
``` bash
|
10
|
-
|
10
|
+
-- For Puma
|
11
|
+
$ gem install rackup puma
|
12
|
+
|
13
|
+
-- For Falcon
|
14
|
+
$ gem install rackup falcon
|
11
15
|
```
|
12
16
|
|
13
17
|
## Usage
|
@@ -20,6 +24,35 @@ $ rackup
|
|
20
24
|
|
21
25
|
Your application should now be available locally, typically `http://localhost:9292`.
|
22
26
|
|
27
|
+
## (Soft) Deprecation
|
28
|
+
|
29
|
+
For a long time, `rackup` (the executable and implementation) was part of `rack`, and `webrick` was the default server, included with Ruby. It made it easy to run a Rack application without having to worry about the details of the server - great for documentation and demos.
|
30
|
+
|
31
|
+
When `webrick` was removed from the Ruby standard library, `rack` started depending on `webrick` as a default server. Every web application and server would pull in `webrick` as a dependency, even if it was not used. To avoid this, the `rackup` component of `rack` was moved to this gem, which depended on `webrick`.
|
32
|
+
|
33
|
+
However, many libraries (e.g. `rails`) still depend on `rackup` and end up pulling in `webrick` as a dependency. To avoid this, the decision was made to cut `webrick` as a dependency of `rackup`. This means that `rackup` no longer depends on `webrick`, and you need to install it separately if you want to use it.
|
34
|
+
|
35
|
+
As a consequence of this, the value of the `rackup` gem is further diminished. In other words, why would you do this:
|
36
|
+
|
37
|
+
``` bash
|
38
|
+
$ gem install rackup puma
|
39
|
+
$ rackup ...
|
40
|
+
```
|
41
|
+
|
42
|
+
when you can do this:
|
43
|
+
|
44
|
+
``` bash
|
45
|
+
$ gem install puma
|
46
|
+
$ puma ...
|
47
|
+
```
|
48
|
+
|
49
|
+
In summary, the maintainers of `rack` recommend the following:
|
50
|
+
|
51
|
+
- Libraries should not depend on `rackup` if possible. `rackup` as an executable made sense when webrick shipped with Ruby, so there was always a fallback. But that hasn't been true since Ruby 3.0.
|
52
|
+
- Frameworks and applications should focus on providing `config.ru` files, so that users can use the webserver program of their choice directly (e.g. puma, falcon).
|
53
|
+
- There is still some value in the generic `rackup` and `Rackup::Handler` interfaces, but we encourage users to invoke the server command directly if possible.
|
54
|
+
- Webrick should be avoided if possible.
|
55
|
+
|
23
56
|
## Contributing
|
24
57
|
|
25
58
|
We welcome contributions to this project.
|
data/releases.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Releases
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file. For info on how to format all future additions to this file please reference [Keep A Changelog](https://keepachangelog.com/en/1.0.0/).
|
4
|
+
|
5
|
+
## v2.2.0
|
6
|
+
|
7
|
+
- Remove old rack shims.
|
8
|
+
- Remove `webrick` dependency.
|
9
|
+
|
10
|
+
## v2.1.0
|
11
|
+
|
12
|
+
- Correctly support streaming responses with `webrick`.
|
13
|
+
|
14
|
+
## v2.0.0
|
15
|
+
|
16
|
+
- Initial release and migration of code from `rack`.
|
17
|
+
|
18
|
+
## v1.0.1
|
19
|
+
|
20
|
+
- Fix `rackup.rb` invalid requires.
|
21
|
+
|
22
|
+
## v1.0.0
|
23
|
+
|
24
|
+
- Initial release of empty shim for Rack v2.
|
metadata
CHANGED
@@ -1,15 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rackup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
+
- James Tucker
|
9
|
+
- Leah Neukirchen
|
8
10
|
- Jeremy Evans
|
11
|
+
- Joshua Peek
|
12
|
+
- Megan Batty
|
13
|
+
- Rafael França
|
14
|
+
- Anurag Priyam
|
15
|
+
- Max Cantor
|
16
|
+
- Michael Fellinger
|
17
|
+
- Sophie Deziel
|
18
|
+
- Yoshiyuki Hirano
|
19
|
+
- Aaron Patterson
|
20
|
+
- Jean Boussier
|
21
|
+
- Katsuhiko Yoshida
|
22
|
+
- Konstantin Haase
|
23
|
+
- Krzysztof Rybka
|
24
|
+
- Martin Hrdlicka
|
25
|
+
- Nick LaMuro
|
26
|
+
- Aaron Pfeifer
|
27
|
+
- Akira Matsuda
|
28
|
+
- Andrew Bortz
|
29
|
+
- Andrew Hoglund
|
30
|
+
- Bas Vodde
|
31
|
+
- Blake Mizerany
|
32
|
+
- Carl Lerche
|
33
|
+
- David Celis
|
34
|
+
- Dillon Welch
|
35
|
+
- Genki Takiuchi
|
36
|
+
- Geremia Taglialatela
|
37
|
+
- Hal Brodigan
|
38
|
+
- Hrvoje Šimić
|
39
|
+
- Igor Bochkariov
|
40
|
+
- Jeremy Kemper
|
41
|
+
- Joe Fiorini
|
42
|
+
- John Barnette
|
43
|
+
- John Sumsion
|
44
|
+
- Julik Tarkhanov
|
45
|
+
- Kang Sheng
|
46
|
+
- Kazuya Hotta
|
47
|
+
- Lenny Marks
|
48
|
+
- Loren Segal
|
49
|
+
- Marc-André Cournoyer
|
50
|
+
- Misaki Shioi
|
51
|
+
- Olle Jonsson
|
52
|
+
- Peter Wilmott
|
53
|
+
- Petrik de Heus
|
54
|
+
- Richard Schneeman
|
55
|
+
- Ryunosuke Sato
|
56
|
+
- Sean McGivern
|
57
|
+
- Stephen Paul Weber
|
58
|
+
- Tadashi Saito
|
59
|
+
- Tim Moore
|
60
|
+
- Timur Batyrshin
|
61
|
+
- Trevor Wennblom
|
62
|
+
- Tsutomu Kuroda
|
63
|
+
- Uchio Kondo
|
64
|
+
- Wyatt Pan
|
65
|
+
- Yehuda Katz
|
66
|
+
- Zachary Scott
|
9
67
|
autorequire:
|
10
68
|
bindir: bin
|
11
69
|
cert_chain: []
|
12
|
-
date:
|
70
|
+
date: 2024-11-13 00:00:00.000000000 Z
|
13
71
|
dependencies:
|
14
72
|
- !ruby/object:Gem::Dependency
|
15
73
|
name: rack
|
@@ -25,90 +83,6 @@ dependencies:
|
|
25
83
|
- - ">="
|
26
84
|
- !ruby/object:Gem::Version
|
27
85
|
version: '3'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: webrick
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: bundler
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: minitest
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - "~>"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '5.0'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - "~>"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '5.0'
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: minitest-global_expectations
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: minitest-sprint
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: rake
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - ">="
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - ">="
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
112
86
|
description:
|
113
87
|
email:
|
114
88
|
executables:
|
@@ -117,22 +91,24 @@ extensions: []
|
|
117
91
|
extra_rdoc_files: []
|
118
92
|
files:
|
119
93
|
- bin/rackup
|
120
|
-
- lib/rack/handler.rb
|
121
|
-
- lib/rack/server.rb
|
122
94
|
- lib/rackup.rb
|
123
95
|
- lib/rackup/handler.rb
|
124
96
|
- lib/rackup/handler/cgi.rb
|
125
97
|
- lib/rackup/handler/webrick.rb
|
126
98
|
- lib/rackup/lobster.rb
|
127
99
|
- lib/rackup/server.rb
|
100
|
+
- lib/rackup/stream.rb
|
128
101
|
- lib/rackup/version.rb
|
129
102
|
- license.md
|
130
103
|
- readme.md
|
104
|
+
- releases.md
|
131
105
|
- security.md
|
132
106
|
homepage: https://github.com/rack/rackup
|
133
107
|
licenses:
|
134
108
|
- MIT
|
135
|
-
metadata:
|
109
|
+
metadata:
|
110
|
+
rubygems_mfa_required: 'true'
|
111
|
+
source_code_uri: https://github.com/rack/rackup.git
|
136
112
|
post_install_message:
|
137
113
|
rdoc_options: []
|
138
114
|
require_paths:
|
@@ -141,14 +117,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
117
|
requirements:
|
142
118
|
- - ">="
|
143
119
|
- !ruby/object:Gem::Version
|
144
|
-
version: 2.
|
120
|
+
version: '2.5'
|
145
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
122
|
requirements:
|
147
123
|
- - ">="
|
148
124
|
- !ruby/object:Gem::Version
|
149
125
|
version: '0'
|
150
126
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
127
|
+
rubygems_version: 3.5.22
|
152
128
|
signing_key:
|
153
129
|
specification_version: 4
|
154
130
|
summary: A general server command for Rack applications.
|
data/lib/rack/handler.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Released under the MIT License.
|
4
|
-
# Copyright, 2022-2023, by Samuel Williams.
|
5
|
-
|
6
|
-
warn "Rack::Handler is deprecated and replaced by Rackup::Handler"
|
7
|
-
require_relative '../rackup/handler'
|
8
|
-
module Rack
|
9
|
-
Handler = ::Rackup::Handler
|
10
|
-
end
|
data/lib/rack/server.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Released under the MIT License.
|
4
|
-
# Copyright, 2022-2023, by Samuel Williams.
|
5
|
-
|
6
|
-
warn "Rack::Server is deprecated and replaced by Rackup::Server"
|
7
|
-
require_relative '../rackup/server'
|
8
|
-
module Rack
|
9
|
-
Server = ::Rackup::Server
|
10
|
-
end
|