Skip to content

Commit f66cf13

Browse files
committed
More compatibility.
1 parent c11a28e commit f66cf13

25 files changed

+80
-50
lines changed

.github/workflows/test.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ jobs:
3535
- 3.1
3636
- 3.2
3737
- 3.3
38+
- 3.4
3839

39-
gemfile: ["Gemfile"]
40+
gemfile:
41+
- gems/rack-v2.rb
4042

4143
include:
4244
- experimental: false
4345
os: macos
44-
ruby: 3.3
46+
ruby: 3.4
4547
gemfile: gems/rack-v2.rb
4648
- experimental: true
4749
os: ubuntu
@@ -53,13 +55,16 @@ jobs:
5355
gemfile: gems/rack-v1.rb
5456
- experimental: true
5557
os: ubuntu
56-
ruby: 3.2
58+
ruby: 3.4
5759
gemfile: gems/rack-v2.rb
58-
# enable when rack v3 is supported
59-
# - experimental: true
60-
# os: ubuntu
61-
# ruby: 3.2
62-
# env: BUNDLE_GEMFILE=gems/rack-head.rb
60+
- experimental: true
61+
os: ubuntu
62+
ruby: 3.4
63+
gemfile: gems/rack-v3.rb
64+
- experimental: true
65+
os: ubuntu
66+
ruby: 3.4
67+
gemfile: gems/rack-head.rb
6368

6469
steps:
6570
- uses: actions/checkout@v3

benchmark/benchmarker.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def start_server(handler_name)
3737
end
3838

3939
app = proc do |env|
40-
[200, {'Content-Type' => 'text/html', 'Content-Length' => '11'}, ['hello world']]
40+
[200, {'content-type' => 'text/html', 'content-length' => '11'}, ['hello world']]
4141
end
4242

4343
handler = Rack::Handler.const_get(handler_name)

example/adapter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def call(env)
88
body = ["hello!"]
99
[
1010
200,
11-
{ 'Content-Type' => 'text/plain' },
11+
{ 'content-type' => 'text/plain' },
1212
body
1313
]
1414
end

example/async_app.ru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class AsyncApp
8787
body = DeferrableBody.new
8888

8989
# Get the headers out there asap, let the client know we're alive...
90-
EventMachine::next_tick { env['async.callback'].call [200, {'Content-Type' => 'text/plain'}, body] }
90+
EventMachine::next_tick { env['async.callback'].call [200, {'content-type' => 'text/plain'}, body] }
9191

9292
# Semi-emulate a long db request, instead of a timer, in reality we'd be
9393
# waiting for the response data. Whilst this happens, other connections

example/async_chat.ru

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class Chat
118118
send_message = function(message_box) {
119119
xhr = XHR();
120120
xhr.open("POST", "/", true);
121-
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
121+
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
122122
xhr.setRequestHeader("X_REQUESTED_WITH", "XMLHttpRequest");
123123
xhr.send("message="+escape(message_box.value));
124124
scroll();
@@ -161,7 +161,7 @@ class Chat
161161
body.callback { delete_user user_id }
162162

163163
EventMachine::next_tick do
164-
renderer.call [200, {'Content-Type' => 'text/html'}, body]
164+
renderer.call [200, {'content-type' => 'text/html'}, body]
165165
end
166166
end
167167

example/async_tailer.ru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class AsyncTailer
7070

7171
EventMachine::next_tick do
7272

73-
env['async.callback'].call [200, {'Content-Type' => 'text/html'}, body]
73+
env['async.callback'].call [200, {'content-type' => 'text/html'}, body]
7474

7575
body.call ["<h1>Async Tailer</h1><pre>"]
7676

example/config.ru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ app = proc do |env|
1414

1515
[
1616
200, # Status code
17-
{ 'Content-Type' => 'text/html' }, # Reponse headers
17+
{ 'content-type' => 'text/html' }, # Reponse headers
1818
body # Body of the response
1919
]
2020
end

ext/thin_parser/thin.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ static void request_http_version(void *data, const char *at, size_t length)
155155
VALUE req = (VALUE)data;
156156
VALUE val = rb_str_new(at, length);
157157
rb_hash_aset(req, global_request_http_version, val);
158+
rb_hash_aset(req, global_http_version, val);
159+
rb_hash_aset(req, global_server_protocol, val);
158160
}
159161

160162
/** Finalizes the request header to have a bunch of stuff that's
@@ -211,7 +213,6 @@ static void header_done(void *data, const char *at, size_t length)
211213
}
212214

213215
/* set some constants */
214-
rb_hash_aset(req, global_server_protocol, global_server_protocol_value);
215216
rb_hash_aset(req, global_url_scheme, global_url_scheme_value);
216217
rb_hash_aset(req, global_script_name, global_empty);
217218
}

gems/rack-v2.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
gemspec path: "../"
66

7-
gem 'rack', '~> 2.0'
7+
gem 'rack', "~> 2.0"
88

99
group :development do
1010
gem "rake-compiler"

gems/rack-v3.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# frozen_string_literal: true
2+
3+
source 'https://rubygems.org'
4+
5+
gemspec path: "../"
6+
7+
gem 'rack', "~> 3.0"
8+
9+
group :development do
10+
gem "rake-compiler"
11+
end
12+
13+
group :test do
14+
gem "rake", ">= 12.3.3"
15+
gem "rspec", "~> 3.5"
16+
end

0 commit comments

Comments
 (0)