jellyfish 1.3.1 → 1.5.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 +4 -4
- data/.gitlab-ci.yml +35 -0
- data/.gitmodules +1 -1
- data/CHANGES.md +27 -0
- data/Gemfile +5 -5
- data/README.md +75 -62
- data/config.ru +1 -2
- data/jellyfish.gemspec +5 -6
- data/lib/jellyfish/version.rb +1 -1
- data/lib/jellyfish.rb +42 -33
- data/task/README.md +4 -4
- data/task/gemgem.rb +3 -1
- data/test/rack/test_builder.rb +6 -6
- data/test/rack/test_urlmap.rb +86 -86
- data/test/sinatra/test_base.rb +6 -6
- data/test/sinatra/test_routing.rb +3 -3
- data/test/test_from_readme.rb +1 -1
- data/test/test_log.rb +5 -3
- metadata +71 -74
- data/.travis.yml +0 -18
- data/lib/jellyfish/public/302.html +0 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 628990b1c7e58bef69d30e9d58c735546643875b3e56c3c9bb3c6d3938bac6d5
|
|
4
|
+
data.tar.gz: 5e50afb6c489da13a22225b87c6e3a20f1215c4fda43150e5447845159649223
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ec7d867538663a72c11f796ff44e64aea12966a81d8b52ef992dfeb51cb79a30882145be143aef69762725cf98d3233337fe54ff6aa27fea00e6d2cb0417a0e
|
|
7
|
+
data.tar.gz: b9b09ec0ca7070536515eee34e6635183eb6909da7abdcf2e76450650476d11093b475303bda708e4f2059ce5298c012a157a2774c94ddb817ef2871a847a67a
|
data/.gitlab-ci.yml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
stages:
|
|
3
|
+
- test
|
|
4
|
+
|
|
5
|
+
.test:
|
|
6
|
+
stage: test
|
|
7
|
+
image: ruby:${RUBY_VERSION}-trixie
|
|
8
|
+
variables:
|
|
9
|
+
GIT_DEPTH: "1"
|
|
10
|
+
GIT_SUBMODULE_STRATEGY: recursive
|
|
11
|
+
GIT_SUBMODULE_PATHS: task
|
|
12
|
+
# websocket_parser does not work with frozen string literal
|
|
13
|
+
# RUBYOPT: --enable-frozen-string-literal
|
|
14
|
+
before_script:
|
|
15
|
+
- bundle install --retry=3
|
|
16
|
+
- unset CI # Coverage doesn't work well with frozen literal
|
|
17
|
+
script:
|
|
18
|
+
- ruby -vr bundler/setup -S rake test
|
|
19
|
+
|
|
20
|
+
ruby:3.4:
|
|
21
|
+
extends:
|
|
22
|
+
- .test
|
|
23
|
+
variables:
|
|
24
|
+
RUBY_VERSION: '3.4'
|
|
25
|
+
|
|
26
|
+
ruby:4.0:
|
|
27
|
+
extends:
|
|
28
|
+
- .test
|
|
29
|
+
variables:
|
|
30
|
+
RUBY_VERSION: '4.0'
|
|
31
|
+
|
|
32
|
+
jruby:latest:
|
|
33
|
+
extends:
|
|
34
|
+
- .test
|
|
35
|
+
image: jruby:latest
|
data/.gitmodules
CHANGED
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# CHANGES
|
|
2
2
|
|
|
3
|
+
## Jellyfish 1.5.0 -- 2026-11-22
|
|
4
|
+
|
|
5
|
+
### Incompatible changes
|
|
6
|
+
|
|
7
|
+
* Removed `redirect` which is an alias of `found`
|
|
8
|
+
* Response from `found` with HTTP 302 no longer adds any response body
|
|
9
|
+
|
|
10
|
+
### Enhancements
|
|
11
|
+
|
|
12
|
+
* Added `moved` helper for HTTP 301
|
|
13
|
+
* Static responses are now memorized to avoid I/O
|
|
14
|
+
|
|
15
|
+
## Jellyfish 1.4.0 -- 2023-02-22
|
|
16
|
+
|
|
17
|
+
### Incompatible changes
|
|
18
|
+
|
|
19
|
+
* Adopted Rack 3. Technically, just lower the cases for headers.
|
|
20
|
+
* Internal strings are all frozen now.
|
|
21
|
+
* `log` and `log_error` now takes the `env` for the second argument,
|
|
22
|
+
rather than the error stream.
|
|
23
|
+
* `handle` now takes the `env` for the third argument,
|
|
24
|
+
rather than the error stream.
|
|
25
|
+
|
|
26
|
+
### Enhancements
|
|
27
|
+
|
|
28
|
+
* The default error logging will now also show `env['PATH_INFO']`.
|
|
29
|
+
|
|
3
30
|
## Jellyfish 1.3.1 -- 2018-11-11
|
|
4
31
|
|
|
5
32
|
### Bugs fixed
|
data/Gemfile
CHANGED
|
@@ -3,15 +3,15 @@ source 'https://rubygems.org'
|
|
|
3
3
|
|
|
4
4
|
gemspec
|
|
5
5
|
|
|
6
|
+
gem 'base64' # stdlib
|
|
7
|
+
|
|
6
8
|
gem 'rake'
|
|
7
9
|
gem 'rack'
|
|
8
10
|
gem 'pork'
|
|
9
11
|
gem 'muack'
|
|
10
12
|
gem 'websocket_parser'
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
gem '
|
|
14
|
-
|
|
15
|
-
platform :rbx do
|
|
16
|
-
gem 'rubysl-singleton' # used in rake
|
|
14
|
+
platform :ruby do
|
|
15
|
+
gem 'simplecov', :require => false if ENV['COV']
|
|
16
|
+
gem 'coveralls', :require => false if ENV['CI']
|
|
17
17
|
end
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Jellyfish [](https://gitlab.com/godfat/jellyfish/-/pipelines)
|
|
2
2
|
|
|
3
|
-
by Lin Jen-Shin ([godfat](
|
|
3
|
+
by Lin Jen-Shin ([godfat](https://godfat.org))
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ by Lin Jen-Shin ([godfat](http://godfat.org))
|
|
|
8
8
|
|
|
9
9
|
* [github](https://github.com/godfat/jellyfish)
|
|
10
10
|
* [rubygems](https://rubygems.org/gems/jellyfish)
|
|
11
|
-
* [rdoc](
|
|
11
|
+
* [rdoc](https://rubydoc.info/github/godfat/jellyfish)
|
|
12
12
|
* [issues](https://github.com/godfat/jellyfish/issues) (feel free to ask for support)
|
|
13
13
|
|
|
14
14
|
## DESCRIPTION:
|
|
@@ -42,7 +42,7 @@ Check [jellyfish-contrib][] for extra extensions.
|
|
|
42
42
|
* Simple
|
|
43
43
|
* Modular
|
|
44
44
|
* No templates (You could use [tilt](https://github.com/rtomayko/tilt))
|
|
45
|
-
* No ORM (You could use [sequel](
|
|
45
|
+
* No ORM (You could use [sequel](https://sequel.jeremyevans.net))
|
|
46
46
|
* No `dup` in `call`
|
|
47
47
|
* Regular expression routes, e.g. `get %r{^/(?<id>\d+)$}`
|
|
48
48
|
* String routes, e.g. `get '/'`
|
|
@@ -56,7 +56,7 @@ Because Sinatra is too complex and inconsistent for me.
|
|
|
56
56
|
|
|
57
57
|
## REQUIREMENTS:
|
|
58
58
|
|
|
59
|
-
* Tested with MRI (official CRuby)
|
|
59
|
+
* Tested with MRI (official CRuby) and JRuby.
|
|
60
60
|
|
|
61
61
|
## INSTALLATION:
|
|
62
62
|
|
|
@@ -84,7 +84,7 @@ run Tank.new
|
|
|
84
84
|
<!---
|
|
85
85
|
GET /
|
|
86
86
|
[200,
|
|
87
|
-
{'
|
|
87
|
+
{'content-length' => '12', 'content-type' => 'text/plain'},
|
|
88
88
|
["Jelly Kelly\n"]]
|
|
89
89
|
-->
|
|
90
90
|
|
|
@@ -106,7 +106,7 @@ run Tank.new
|
|
|
106
106
|
<!---
|
|
107
107
|
GET /123
|
|
108
108
|
[200,
|
|
109
|
-
{'
|
|
109
|
+
{'content-length' => '11', 'content-type' => 'text/plain'},
|
|
110
110
|
["Jelly #123\n"]]
|
|
111
111
|
-->
|
|
112
112
|
|
|
@@ -133,7 +133,7 @@ run Tank.new
|
|
|
133
133
|
<!---
|
|
134
134
|
GET /hctam
|
|
135
135
|
[200,
|
|
136
|
-
{'
|
|
136
|
+
{'content-length' => '5', 'content-type' => 'text/plain'},
|
|
137
137
|
["true\n"]]
|
|
138
138
|
-->
|
|
139
139
|
|
|
@@ -159,13 +159,15 @@ run Tank.new
|
|
|
159
159
|
<!---
|
|
160
160
|
POST /
|
|
161
161
|
[201,
|
|
162
|
-
{'
|
|
162
|
+
{'content-length' => '18', 'content-type' => 'text/plain',
|
|
163
163
|
'X-Jellyfish-Life' => '100', 'X-Jellyfish-Mana' => '200'},
|
|
164
164
|
["Jellyfish 100/200\n"]]
|
|
165
165
|
-->
|
|
166
166
|
|
|
167
167
|
### Redirect helper
|
|
168
168
|
|
|
169
|
+
This uses HTTP 302
|
|
170
|
+
|
|
169
171
|
``` ruby
|
|
170
172
|
require 'jellyfish'
|
|
171
173
|
class Tank
|
|
@@ -181,13 +183,35 @@ run Tank.new
|
|
|
181
183
|
|
|
182
184
|
<!---
|
|
183
185
|
GET /lookup host
|
|
184
|
-
body = File.read("#{File.dirname(
|
|
185
|
-
File.expand_path(__FILE__))}/../lib/jellyfish/public/302.html").
|
|
186
|
-
gsub('VAR_URL', 'http://host/')
|
|
187
186
|
[302,
|
|
188
|
-
{'
|
|
189
|
-
'
|
|
190
|
-
[
|
|
187
|
+
{'content-length' => '0', 'content-type' => 'text/html',
|
|
188
|
+
'location' => 'http://host/'},
|
|
189
|
+
[]]
|
|
190
|
+
-->
|
|
191
|
+
|
|
192
|
+
### Moved permanently
|
|
193
|
+
|
|
194
|
+
This uses HTTP 301
|
|
195
|
+
|
|
196
|
+
``` ruby
|
|
197
|
+
require 'jellyfish'
|
|
198
|
+
class Tank
|
|
199
|
+
include Jellyfish
|
|
200
|
+
get '/lookup' do
|
|
201
|
+
moved "#{env['rack.url_scheme']}://#{env['HTTP_HOST']}/"
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
use Rack::ContentLength
|
|
205
|
+
use Rack::ContentType, 'text/plain'
|
|
206
|
+
run Tank.new
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
<!---
|
|
210
|
+
GET /lookup host
|
|
211
|
+
[301,
|
|
212
|
+
{'content-length' => '0', 'content-type' => 'text/html',
|
|
213
|
+
'location' => 'http://host/'},
|
|
214
|
+
[]]
|
|
191
215
|
-->
|
|
192
216
|
|
|
193
217
|
### Crash-proof
|
|
@@ -210,7 +234,7 @@ GET /crash
|
|
|
210
234
|
body = File.read("#{File.dirname(
|
|
211
235
|
File.expand_path(__FILE__))}/../lib/jellyfish/public/500.html")
|
|
212
236
|
[500,
|
|
213
|
-
{'
|
|
237
|
+
{'content-length' => body.bytesize.to_s, 'content-type' => 'text/html'},
|
|
214
238
|
[body]]
|
|
215
239
|
-->
|
|
216
240
|
|
|
@@ -222,7 +246,7 @@ class Tank
|
|
|
222
246
|
include Jellyfish
|
|
223
247
|
handle NameError do |e|
|
|
224
248
|
status 403
|
|
225
|
-
"No one hears you: #{e.
|
|
249
|
+
"No one hears you: #{e.name}\n"
|
|
226
250
|
end
|
|
227
251
|
get '/yell' do
|
|
228
252
|
yell
|
|
@@ -235,16 +259,9 @@ run Tank.new
|
|
|
235
259
|
|
|
236
260
|
<!---
|
|
237
261
|
GET /yell
|
|
238
|
-
body =
|
|
239
|
-
when 'jruby'
|
|
240
|
-
"No one hears you: (eval):9:in `block in Tank'\n"
|
|
241
|
-
when 'rbx'
|
|
242
|
-
"No one hears you: core/zed.rb:1370:in `yell (method_missing)'\n"
|
|
243
|
-
else
|
|
244
|
-
"No one hears you: (eval):9:in `block in <class:Tank>'\n"
|
|
245
|
-
end
|
|
262
|
+
body = "No one hears you: yell\n"
|
|
246
263
|
[403,
|
|
247
|
-
{'
|
|
264
|
+
{'content-length' => body.bytesize.to_s, 'content-type' => 'text/plain'},
|
|
248
265
|
[body]]
|
|
249
266
|
-->
|
|
250
267
|
|
|
@@ -267,7 +284,7 @@ run Tank.new
|
|
|
267
284
|
<!---
|
|
268
285
|
GET /
|
|
269
286
|
[404,
|
|
270
|
-
{'
|
|
287
|
+
{'content-length' => '18', 'content-type' => 'text/plain'},
|
|
271
288
|
["You found nothing."]]
|
|
272
289
|
-->
|
|
273
290
|
|
|
@@ -293,7 +310,7 @@ run Tank.new
|
|
|
293
310
|
<!---
|
|
294
311
|
GET /
|
|
295
312
|
[404,
|
|
296
|
-
{'
|
|
313
|
+
{'content-length' => '18', 'content-type' => 'text/plain'},
|
|
297
314
|
["You found nothing."]]
|
|
298
315
|
-->
|
|
299
316
|
|
|
@@ -315,7 +332,7 @@ run Tank.new
|
|
|
315
332
|
<!---
|
|
316
333
|
GET /report?name=godfat
|
|
317
334
|
[200,
|
|
318
|
-
{'
|
|
335
|
+
{'content-length' => '20', 'content-type' => 'text/plain'},
|
|
319
336
|
["Your name is godfat\n"]]
|
|
320
337
|
-->
|
|
321
338
|
|
|
@@ -341,7 +358,7 @@ run Tank.new
|
|
|
341
358
|
<!---
|
|
342
359
|
GET /report
|
|
343
360
|
[200,
|
|
344
|
-
{'
|
|
361
|
+
{'content-length' => '3', 'content-type' => 'text/plain'},
|
|
345
362
|
["OK\n"]]
|
|
346
363
|
-->
|
|
347
364
|
|
|
@@ -374,7 +391,7 @@ run Heater.new
|
|
|
374
391
|
<!---
|
|
375
392
|
GET /status
|
|
376
393
|
[200,
|
|
377
|
-
{'
|
|
394
|
+
{'content-length' => '6', 'content-type' => 'text/plain'},
|
|
378
395
|
["30\u{2103}\n"]]
|
|
379
396
|
-->
|
|
380
397
|
|
|
@@ -406,7 +423,7 @@ run Heater.new
|
|
|
406
423
|
<!---
|
|
407
424
|
GET /status
|
|
408
425
|
[200,
|
|
409
|
-
{'
|
|
426
|
+
{'content-length' => '6', 'content-type' => 'text/plain'},
|
|
410
427
|
["30\u{2103}\n"]]
|
|
411
428
|
-->
|
|
412
429
|
|
|
@@ -438,7 +455,7 @@ run Tank.new
|
|
|
438
455
|
<!---
|
|
439
456
|
GET /123
|
|
440
457
|
[200,
|
|
441
|
-
{'
|
|
458
|
+
{'content-length' => '13', 'content-type' => 'text/plain'},
|
|
442
459
|
["Jelly jumps.\n"]]
|
|
443
460
|
-->
|
|
444
461
|
|
|
@@ -554,13 +571,13 @@ GET /m/x
|
|
|
554
571
|
[200, {}, ["m\n"]]
|
|
555
572
|
|
|
556
573
|
GET /
|
|
557
|
-
[200, {'
|
|
574
|
+
[200, {'content-length' => '2'}, ["/\n"]]
|
|
558
575
|
|
|
559
576
|
GET /x
|
|
560
|
-
[200, {'
|
|
577
|
+
[200, {'content-length' => '2'}, ["/\n"]]
|
|
561
578
|
|
|
562
579
|
GET /ab
|
|
563
|
-
[200, {'
|
|
580
|
+
[200, {'content-length' => '2'}, ["/\n"]]
|
|
564
581
|
-->
|
|
565
582
|
|
|
566
583
|
You could try a stupid benchmark yourself:
|
|
@@ -807,7 +824,7 @@ run Tank.new
|
|
|
807
824
|
<!---
|
|
808
825
|
GET /123
|
|
809
826
|
[200,
|
|
810
|
-
{'
|
|
827
|
+
{'content-length' => '11', 'content-type' => 'text/plain'},
|
|
811
828
|
["Jelly #123\n"]]
|
|
812
829
|
-->
|
|
813
830
|
|
|
@@ -831,7 +848,7 @@ run Tank.new
|
|
|
831
848
|
<!---
|
|
832
849
|
GET /%E5%9B%A7
|
|
833
850
|
[200,
|
|
834
|
-
{'
|
|
851
|
+
{'content-length' => '16', 'content-type' => 'text/plain'},
|
|
835
852
|
["/%E5%9B%A7=/\u{56e7}\n"]]
|
|
836
853
|
-->
|
|
837
854
|
|
|
@@ -862,7 +879,7 @@ run Tank.new
|
|
|
862
879
|
<!---
|
|
863
880
|
GET /123
|
|
864
881
|
[200,
|
|
865
|
-
{'
|
|
882
|
+
{'content-length' => '18', 'content-type' => 'text/plain'},
|
|
866
883
|
["Jelly #123 jumps.\n"]]
|
|
867
884
|
-->
|
|
868
885
|
|
|
@@ -896,7 +913,7 @@ run Tank.new
|
|
|
896
913
|
<!---
|
|
897
914
|
GET /
|
|
898
915
|
[200,
|
|
899
|
-
{'
|
|
916
|
+
{'content-length' => '12', 'content-type' => 'text/plain'},
|
|
900
917
|
["Jelly Kelly\n"]]
|
|
901
918
|
-->
|
|
902
919
|
|
|
@@ -934,7 +951,7 @@ run Tank.new
|
|
|
934
951
|
<!---
|
|
935
952
|
GET /status
|
|
936
953
|
[200,
|
|
937
|
-
{'
|
|
954
|
+
{'content-length' => '25', 'content-type' => 'text/plain',
|
|
938
955
|
'X-Temperature' => "30\u{2103}"},
|
|
939
956
|
["See header X-Temperature\n"]]
|
|
940
957
|
-->
|
|
@@ -980,7 +997,7 @@ run Tank.new
|
|
|
980
997
|
<!---
|
|
981
998
|
GET /status
|
|
982
999
|
[200,
|
|
983
|
-
{'
|
|
1000
|
+
{'content-length' => '1', 'content-type' => 'text/plain',
|
|
984
1001
|
'X-Temperature' => "35\u{2103}"},
|
|
985
1002
|
["\n"]]
|
|
986
1003
|
-->
|
|
@@ -1013,7 +1030,7 @@ run Tank.new
|
|
|
1013
1030
|
<!---
|
|
1014
1031
|
GET /status
|
|
1015
1032
|
[200,
|
|
1016
|
-
{'
|
|
1033
|
+
{'content-length' => '6', 'content-type' => 'text/plain'},
|
|
1017
1034
|
["30\u{2103}\n"]]
|
|
1018
1035
|
-->
|
|
1019
1036
|
|
|
@@ -1048,7 +1065,7 @@ run HugeTank
|
|
|
1048
1065
|
<!---
|
|
1049
1066
|
GET /status
|
|
1050
1067
|
[200,
|
|
1051
|
-
{'
|
|
1068
|
+
{'content-length' => '6', 'content-type' => 'text/plain'},
|
|
1052
1069
|
["30\u{2103}\n"]]
|
|
1053
1070
|
-->
|
|
1054
1071
|
|
|
@@ -1081,7 +1098,7 @@ run Tank.new
|
|
|
1081
1098
|
<!---
|
|
1082
1099
|
GET /
|
|
1083
1100
|
[200,
|
|
1084
|
-
{'
|
|
1101
|
+
{'content-length' => '29', 'content-type' => 'text/plain'},
|
|
1085
1102
|
["Protected: Oops, tank broken\n"]]
|
|
1086
1103
|
-->
|
|
1087
1104
|
|
|
@@ -1099,7 +1116,6 @@ class Tank
|
|
|
1099
1116
|
}
|
|
1100
1117
|
end
|
|
1101
1118
|
end
|
|
1102
|
-
use Rack::Chunked
|
|
1103
1119
|
use Rack::ContentType, 'text/plain'
|
|
1104
1120
|
run Tank.new
|
|
1105
1121
|
```
|
|
@@ -1107,9 +1123,8 @@ run Tank.new
|
|
|
1107
1123
|
<!---
|
|
1108
1124
|
GET /chunked
|
|
1109
1125
|
[200,
|
|
1110
|
-
{'
|
|
1111
|
-
["
|
|
1112
|
-
"2\r\n3\n\r\n", "2\r\n4\n\r\n", "0\r\n\r\n"]]
|
|
1126
|
+
{'content-type' => 'text/plain'},
|
|
1127
|
+
["0\n", "1\n", "2\n", "3\n", "4\n"]]
|
|
1113
1128
|
-->
|
|
1114
1129
|
|
|
1115
1130
|
### Chunked transfer encoding (streaming) with custom body
|
|
@@ -1126,7 +1141,6 @@ class Tank
|
|
|
1126
1141
|
Body.new
|
|
1127
1142
|
end
|
|
1128
1143
|
end
|
|
1129
|
-
use Rack::Chunked
|
|
1130
1144
|
use Rack::ContentType, 'text/plain'
|
|
1131
1145
|
run Tank.new
|
|
1132
1146
|
```
|
|
@@ -1134,9 +1148,8 @@ run Tank.new
|
|
|
1134
1148
|
<!---
|
|
1135
1149
|
GET /chunked
|
|
1136
1150
|
[200,
|
|
1137
|
-
{'
|
|
1138
|
-
["
|
|
1139
|
-
"2\r\n3\n\r\n", "2\r\n4\n\r\n", "0\r\n\r\n"]]
|
|
1151
|
+
{'content-type' => 'text/plain'},
|
|
1152
|
+
["0\n", "1\n", "2\n", "3\n", "4\n"]]
|
|
1140
1153
|
-->
|
|
1141
1154
|
|
|
1142
1155
|
### Server Sent Event (SSE)
|
|
@@ -1150,7 +1163,7 @@ class Tank
|
|
|
1150
1163
|
end
|
|
1151
1164
|
end
|
|
1152
1165
|
get '/sse' do
|
|
1153
|
-
headers_merge('
|
|
1166
|
+
headers_merge('content-type' => 'text/event-stream')
|
|
1154
1167
|
Body.new
|
|
1155
1168
|
end
|
|
1156
1169
|
end
|
|
@@ -1160,7 +1173,7 @@ run Tank.new
|
|
|
1160
1173
|
<!---
|
|
1161
1174
|
GET /sse
|
|
1162
1175
|
[200,
|
|
1163
|
-
{'
|
|
1176
|
+
{'content-type' => 'text/event-stream'},
|
|
1164
1177
|
["data: 0\n\n", "data: 1\n\n", "data: 2\n\n", "data: 3\n\n", "data: 4\n\n"]]
|
|
1165
1178
|
-->
|
|
1166
1179
|
|
|
@@ -1171,7 +1184,7 @@ class Tank
|
|
|
1171
1184
|
include Jellyfish
|
|
1172
1185
|
get '/sse' do
|
|
1173
1186
|
headers_merge(
|
|
1174
|
-
'
|
|
1187
|
+
'content-type' => 'text/event-stream',
|
|
1175
1188
|
'rack.hijack' => lambda do |sock|
|
|
1176
1189
|
(0..4).each do |i|
|
|
1177
1190
|
sock.write("data: #{i}\n\n")
|
|
@@ -1186,7 +1199,7 @@ run Tank.new
|
|
|
1186
1199
|
<!---
|
|
1187
1200
|
GET /sse
|
|
1188
1201
|
[200,
|
|
1189
|
-
{'
|
|
1202
|
+
{'content-type' => 'text/event-stream'},
|
|
1190
1203
|
["data: 0\n\n", "data: 1\n\n", "data: 2\n\n", "data: 3\n\n", "data: 4\n\n"]]
|
|
1191
1204
|
-->
|
|
1192
1205
|
|
|
@@ -1201,9 +1214,9 @@ EventMachine is basically dead, we could see if there would be a
|
|
|
1201
1214
|
[Celluloid-IO][] based web server production ready in the future,
|
|
1202
1215
|
so that we could take the advantage of event based approach.
|
|
1203
1216
|
|
|
1204
|
-
[hijack]:
|
|
1205
|
-
[Rainbows!]:
|
|
1206
|
-
[Puma]:
|
|
1217
|
+
[hijack]: https://github.com/rack/rack/blob/main/SPEC.rdoc#label-Hijacking
|
|
1218
|
+
[Rainbows!]: https://yhbt.net/rainbows/
|
|
1219
|
+
[Puma]: https://puma.io
|
|
1207
1220
|
[Celluloid-IO]: https://github.com/celluloid/celluloid-io
|
|
1208
1221
|
|
|
1209
1222
|
``` ruby
|
|
@@ -1244,13 +1257,13 @@ HTTP
|
|
|
1244
1257
|
|
|
1245
1258
|
Apache License 2.0 (Apache-2.0)
|
|
1246
1259
|
|
|
1247
|
-
Copyright (c) 2012-
|
|
1260
|
+
Copyright (c) 2012-2026, Lin Jen-Shin (godfat)
|
|
1248
1261
|
|
|
1249
1262
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
1250
1263
|
you may not use this file except in compliance with the License.
|
|
1251
1264
|
You may obtain a copy of the License at
|
|
1252
1265
|
|
|
1253
|
-
<
|
|
1266
|
+
<https://www.apache.org/licenses/LICENSE-2.0>
|
|
1254
1267
|
|
|
1255
1268
|
Unless required by applicable law or agreed to in writing, software
|
|
1256
1269
|
distributed under the License is distributed on an "AS IS" BASIS,
|
data/config.ru
CHANGED
|
@@ -7,7 +7,7 @@ class Jelly
|
|
|
7
7
|
|
|
8
8
|
controller_include Module.new{
|
|
9
9
|
def dispatch
|
|
10
|
-
headers_merge '
|
|
10
|
+
headers_merge 'content-type' => 'application/json; charset=utf-8',
|
|
11
11
|
'Access-Control-Allow-Origin' => '*'
|
|
12
12
|
super
|
|
13
13
|
end
|
|
@@ -59,7 +59,6 @@ end
|
|
|
59
59
|
|
|
60
60
|
App = Jellyfish::Builder.app do
|
|
61
61
|
use Rack::CommonLogger
|
|
62
|
-
use Rack::Chunked
|
|
63
62
|
use Rack::ContentLength
|
|
64
63
|
use Rack::Deflater
|
|
65
64
|
|
data/jellyfish.gemspec
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: jellyfish 1.
|
|
2
|
+
# stub: jellyfish 1.5.0 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "jellyfish".freeze
|
|
6
|
-
s.version = "1.
|
|
6
|
+
s.version = "1.5.0".freeze
|
|
7
7
|
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
9
9
|
s.require_paths = ["lib".freeze]
|
|
10
10
|
s.authors = ["Lin Jen-Shin (godfat)".freeze]
|
|
11
|
-
s.date = "
|
|
11
|
+
s.date = "2026-11-22"
|
|
12
12
|
s.description = "Pico web framework for building API-centric web applications.\nFor Rack applications or Rack middleware. Around 250 lines of code.\n\nCheck [jellyfish-contrib][] for extra extensions.\n\n[jellyfish-contrib]: https://github.com/godfat/jellyfish-contrib".freeze
|
|
13
13
|
s.email = ["godfat (XD) godfat.org".freeze]
|
|
14
14
|
s.files = [
|
|
15
15
|
".gitignore".freeze,
|
|
16
|
+
".gitlab-ci.yml".freeze,
|
|
16
17
|
".gitmodules".freeze,
|
|
17
|
-
".travis.yml".freeze,
|
|
18
18
|
"CHANGES.md".freeze,
|
|
19
19
|
"Gemfile".freeze,
|
|
20
20
|
"LICENSE".freeze,
|
|
@@ -30,7 +30,6 @@ Gem::Specification.new do |s|
|
|
|
30
30
|
"lib/jellyfish/json.rb".freeze,
|
|
31
31
|
"lib/jellyfish/normalized_params.rb".freeze,
|
|
32
32
|
"lib/jellyfish/normalized_path.rb".freeze,
|
|
33
|
-
"lib/jellyfish/public/302.html".freeze,
|
|
34
33
|
"lib/jellyfish/public/404.html".freeze,
|
|
35
34
|
"lib/jellyfish/public/500.html".freeze,
|
|
36
35
|
"lib/jellyfish/rewrite.rb".freeze,
|
|
@@ -56,7 +55,7 @@ Gem::Specification.new do |s|
|
|
|
56
55
|
"test/test_websocket.rb".freeze]
|
|
57
56
|
s.homepage = "https://github.com/godfat/jellyfish".freeze
|
|
58
57
|
s.licenses = ["Apache-2.0".freeze]
|
|
59
|
-
s.rubygems_version = "
|
|
58
|
+
s.rubygems_version = "4.1.0".freeze
|
|
60
59
|
s.summary = "Pico web framework for building API-centric web applications.".freeze
|
|
61
60
|
s.test_files = [
|
|
62
61
|
"test/rack/test_builder.rb".freeze,
|
data/lib/jellyfish/version.rb
CHANGED