puma 4.3.12 → 6.3.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puma might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/History.md +1729 -521
- data/LICENSE +23 -20
- data/README.md +169 -45
- data/bin/puma-wild +3 -9
- data/docs/architecture.md +63 -26
- data/docs/compile_options.md +55 -0
- data/docs/deployment.md +60 -69
- data/docs/fork_worker.md +31 -0
- data/docs/images/puma-connection-flow-no-reactor.png +0 -0
- data/docs/images/puma-connection-flow.png +0 -0
- data/docs/images/puma-general-arch.png +0 -0
- data/docs/jungle/README.md +9 -0
- data/{tools → docs}/jungle/rc.d/README.md +1 -1
- data/{tools → docs}/jungle/rc.d/puma +2 -2
- data/{tools → docs}/jungle/rc.d/puma.conf +0 -0
- data/docs/kubernetes.md +66 -0
- data/docs/nginx.md +2 -2
- data/docs/plugins.md +15 -15
- data/docs/rails_dev_mode.md +28 -0
- data/docs/restart.md +46 -23
- data/docs/signals.md +13 -11
- data/docs/stats.md +142 -0
- data/docs/systemd.md +84 -128
- data/docs/testing_benchmarks_local_files.md +150 -0
- data/docs/testing_test_rackup_ci_files.md +36 -0
- data/ext/puma_http11/PumaHttp11Service.java +2 -4
- data/ext/puma_http11/ext_help.h +1 -1
- data/ext/puma_http11/extconf.rb +49 -12
- data/ext/puma_http11/http11_parser.c +46 -48
- data/ext/puma_http11/http11_parser.h +2 -2
- data/ext/puma_http11/http11_parser.java.rl +3 -3
- data/ext/puma_http11/http11_parser.rl +3 -3
- data/ext/puma_http11/http11_parser_common.rl +2 -2
- data/ext/puma_http11/mini_ssl.c +278 -93
- data/ext/puma_http11/no_ssl/PumaHttp11Service.java +15 -0
- data/ext/puma_http11/org/jruby/puma/Http11.java +6 -6
- data/ext/puma_http11/org/jruby/puma/Http11Parser.java +4 -6
- data/ext/puma_http11/org/jruby/puma/MiniSSL.java +241 -96
- data/ext/puma_http11/puma_http11.c +46 -57
- data/lib/puma/app/status.rb +53 -39
- data/lib/puma/binder.rb +237 -121
- data/lib/puma/cli.rb +34 -34
- data/lib/puma/client.rb +172 -98
- data/lib/puma/cluster/worker.rb +180 -0
- data/lib/puma/cluster/worker_handle.rb +97 -0
- data/lib/puma/cluster.rb +226 -231
- data/lib/puma/commonlogger.rb +21 -14
- data/lib/puma/configuration.rb +114 -87
- data/lib/puma/const.rb +139 -95
- data/lib/puma/control_cli.rb +99 -79
- data/lib/puma/detect.rb +33 -2
- data/lib/puma/dsl.rb +516 -110
- data/lib/puma/error_logger.rb +113 -0
- data/lib/puma/events.rb +16 -115
- data/lib/puma/io_buffer.rb +44 -2
- data/lib/puma/jruby_restart.rb +2 -59
- data/lib/puma/json_serialization.rb +96 -0
- data/lib/puma/launcher/bundle_pruner.rb +104 -0
- data/lib/puma/launcher.rb +164 -155
- data/lib/puma/log_writer.rb +147 -0
- data/lib/puma/minissl/context_builder.rb +36 -19
- data/lib/puma/minissl.rb +230 -55
- data/lib/puma/null_io.rb +18 -1
- data/lib/puma/plugin/systemd.rb +90 -0
- data/lib/puma/plugin/tmp_restart.rb +1 -1
- data/lib/puma/plugin.rb +3 -12
- data/lib/puma/rack/builder.rb +7 -11
- data/lib/puma/rack/urlmap.rb +0 -0
- data/lib/puma/rack_default.rb +19 -4
- data/lib/puma/reactor.rb +93 -368
- data/lib/puma/request.rb +671 -0
- data/lib/puma/runner.rb +92 -75
- data/lib/puma/sd_notify.rb +149 -0
- data/lib/puma/server.rb +321 -794
- data/lib/puma/single.rb +20 -74
- data/lib/puma/state_file.rb +45 -8
- data/lib/puma/thread_pool.rb +140 -68
- data/lib/puma/util.rb +21 -4
- data/lib/puma.rb +54 -7
- data/lib/rack/handler/puma.rb +113 -87
- data/tools/{docker/Dockerfile → Dockerfile} +1 -1
- data/tools/trickletest.rb +0 -0
- metadata +33 -24
- data/docs/tcp_mode.md +0 -96
- data/ext/puma_http11/io_buffer.c +0 -155
- data/ext/puma_http11/org/jruby/puma/IOBuffer.java +0 -72
- data/lib/puma/accept_nonblock.rb +0 -29
- data/lib/puma/tcp_logger.rb +0 -41
- data/tools/jungle/README.md +0 -19
- data/tools/jungle/init.d/README.md +0 -61
- data/tools/jungle/init.d/puma +0 -421
- data/tools/jungle/init.d/run-puma +0 -18
- data/tools/jungle/upstart/README.md +0 -61
- data/tools/jungle/upstart/puma-manager.conf +0 -31
- data/tools/jungle/upstart/puma.conf +0 -69
data/ext/puma_http11/extconf.rb
CHANGED
@@ -1,31 +1,54 @@
|
|
1
1
|
require 'mkmf'
|
2
2
|
|
3
3
|
dir_config("puma_http11")
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
|
5
|
+
if $mingw
|
6
|
+
append_cflags '-fstack-protector-strong -D_FORTIFY_SOURCE=2'
|
7
|
+
append_ldflags '-fstack-protector-strong -l:libssp.a'
|
7
8
|
have_library 'ssp'
|
8
9
|
end
|
9
10
|
|
10
|
-
unless ENV["
|
11
|
-
|
11
|
+
unless ENV["PUMA_DISABLE_SSL"]
|
12
|
+
# don't use pkg_config('openssl') if '--with-openssl-dir' is used
|
13
|
+
has_openssl_dir = dir_config('openssl').any?
|
14
|
+
found_pkg_config = !has_openssl_dir && pkg_config('openssl')
|
12
15
|
|
13
|
-
|
16
|
+
found_ssl = if !$mingw && found_pkg_config
|
17
|
+
puts 'using OpenSSL pkgconfig (openssl.pc)'
|
18
|
+
true
|
19
|
+
elsif have_library('libcrypto', 'BIO_read') && have_library('libssl', 'SSL_CTX_new')
|
20
|
+
true
|
21
|
+
elsif %w'crypto libeay32'.find {|crypto| have_library(crypto, 'BIO_read')} &&
|
14
22
|
%w'ssl ssleay32'.find {|ssl| have_library(ssl, 'SSL_CTX_new')}
|
23
|
+
true
|
24
|
+
else
|
25
|
+
puts '** Puma will be compiled without SSL support'
|
26
|
+
false
|
27
|
+
end
|
15
28
|
|
29
|
+
if found_ssl
|
16
30
|
have_header "openssl/bio.h"
|
17
31
|
|
18
32
|
# below is yes for 1.0.2 & later
|
19
|
-
have_func
|
33
|
+
have_func "DTLS_method" , "openssl/ssl.h"
|
34
|
+
have_func "SSL_CTX_set_session_cache_mode(NULL, 0)", "openssl/ssl.h"
|
35
|
+
|
36
|
+
# below are yes for 1.1.0 & later
|
37
|
+
have_func "TLS_server_method" , "openssl/ssl.h"
|
38
|
+
have_func "SSL_CTX_set_min_proto_version(NULL, 0)" , "openssl/ssl.h"
|
39
|
+
|
40
|
+
have_func "X509_STORE_up_ref"
|
41
|
+
have_func "SSL_CTX_set_ecdh_auto(NULL, 0)" , "openssl/ssl.h"
|
20
42
|
|
21
|
-
# below
|
22
|
-
|
23
|
-
|
24
|
-
|
43
|
+
# below exists in 1.1.0 and later, but isn't documented until 3.0.0
|
44
|
+
have_func "SSL_CTX_set_dh_auto(NULL, 0)" , "openssl/ssl.h"
|
45
|
+
|
46
|
+
# below is yes for 3.0.0 & later
|
47
|
+
have_func "SSL_get1_peer_certificate" , "openssl/ssl.h"
|
25
48
|
|
26
49
|
# Random.bytes available in Ruby 2.5 and later, Random::DEFAULT deprecated in 3.0
|
27
50
|
if Random.respond_to?(:bytes)
|
28
|
-
$defs.push
|
51
|
+
$defs.push "-DHAVE_RANDOM_BYTES"
|
29
52
|
puts "checking for Random.bytes... yes"
|
30
53
|
else
|
31
54
|
puts "checking for Random.bytes... no"
|
@@ -33,4 +56,18 @@ unless ENV["DISABLE_SSL"]
|
|
33
56
|
end
|
34
57
|
end
|
35
58
|
|
59
|
+
if ENV["PUMA_MAKE_WARNINGS_INTO_ERRORS"]
|
60
|
+
# Make all warnings into errors
|
61
|
+
# Except `implicit-fallthrough` since most failures comes from ragel state machine generated code
|
62
|
+
if respond_to?(:append_cflags, true) # Ruby 2.5 and later
|
63
|
+
append_cflags(config_string('WERRORFLAG') || '-Werror')
|
64
|
+
append_cflags '-Wno-implicit-fallthrough'
|
65
|
+
else
|
66
|
+
# flag may not exist on some platforms, -Werror may not be defined on some platforms, but
|
67
|
+
# works with all in current CI
|
68
|
+
$CFLAGS << " #{config_string('WERRORFLAG') || '-Werror'}"
|
69
|
+
$CFLAGS << ' -Wno-implicit-fallthrough'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
36
73
|
create_makefile("puma/puma_http11")
|
@@ -33,20 +33,18 @@ static void snake_upcase_char(char *c)
|
|
33
33
|
/** Machine **/
|
34
34
|
|
35
35
|
|
36
|
-
#line
|
36
|
+
#line 81 "ext/puma_http11/http11_parser.rl"
|
37
37
|
|
38
38
|
|
39
39
|
/** Data **/
|
40
40
|
|
41
|
-
#line
|
41
|
+
#line 42 "ext/puma_http11/http11_parser.c"
|
42
42
|
static const int puma_parser_start = 1;
|
43
43
|
static const int puma_parser_first_final = 46;
|
44
44
|
static const int puma_parser_error = 0;
|
45
45
|
|
46
|
-
static const int puma_parser_en_main = 1;
|
47
46
|
|
48
|
-
|
49
|
-
#line 83 "ext/puma_http11/http11_parser.rl"
|
47
|
+
#line 85 "ext/puma_http11/http11_parser.rl"
|
50
48
|
|
51
49
|
int puma_parser_init(puma_parser *parser) {
|
52
50
|
int cs = 0;
|
@@ -56,7 +54,7 @@ int puma_parser_init(puma_parser *parser) {
|
|
56
54
|
cs = puma_parser_start;
|
57
55
|
}
|
58
56
|
|
59
|
-
#line
|
57
|
+
#line 89 "ext/puma_http11/http11_parser.rl"
|
60
58
|
parser->cs = cs;
|
61
59
|
parser->body_start = 0;
|
62
60
|
parser->content_len = 0;
|
@@ -109,7 +107,7 @@ st0:
|
|
109
107
|
cs = 0;
|
110
108
|
goto _out;
|
111
109
|
tr0:
|
112
|
-
#line
|
110
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
113
111
|
{ MARK(mark, p); }
|
114
112
|
goto st2;
|
115
113
|
st2:
|
@@ -132,7 +130,7 @@ case 2:
|
|
132
130
|
goto st27;
|
133
131
|
goto st0;
|
134
132
|
tr2:
|
135
|
-
#line
|
133
|
+
#line 50 "ext/puma_http11/http11_parser.rl"
|
136
134
|
{
|
137
135
|
parser->request_method(parser, PTR_TO(mark), LEN(mark, p));
|
138
136
|
}
|
@@ -158,7 +156,7 @@ case 3:
|
|
158
156
|
goto tr5;
|
159
157
|
goto st0;
|
160
158
|
tr4:
|
161
|
-
#line
|
159
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
162
160
|
{ MARK(mark, p); }
|
163
161
|
goto st4;
|
164
162
|
st4:
|
@@ -172,53 +170,53 @@ case 4:
|
|
172
170
|
}
|
173
171
|
goto st0;
|
174
172
|
tr8:
|
175
|
-
#line
|
173
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
176
174
|
{
|
177
175
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
178
176
|
}
|
179
177
|
goto st5;
|
180
178
|
tr31:
|
181
|
-
#line
|
179
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
182
180
|
{ MARK(mark, p); }
|
183
|
-
#line
|
181
|
+
#line 56 "ext/puma_http11/http11_parser.rl"
|
184
182
|
{
|
185
183
|
parser->fragment(parser, PTR_TO(mark), LEN(mark, p));
|
186
184
|
}
|
187
185
|
goto st5;
|
188
186
|
tr33:
|
189
|
-
#line
|
187
|
+
#line 56 "ext/puma_http11/http11_parser.rl"
|
190
188
|
{
|
191
189
|
parser->fragment(parser, PTR_TO(mark), LEN(mark, p));
|
192
190
|
}
|
193
191
|
goto st5;
|
194
192
|
tr37:
|
195
|
-
#line
|
193
|
+
#line 69 "ext/puma_http11/http11_parser.rl"
|
196
194
|
{
|
197
195
|
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
|
198
196
|
}
|
199
|
-
#line
|
197
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
200
198
|
{
|
201
199
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
202
200
|
}
|
203
201
|
goto st5;
|
204
202
|
tr41:
|
205
|
-
#line
|
203
|
+
#line 60 "ext/puma_http11/http11_parser.rl"
|
206
204
|
{ MARK(query_start, p); }
|
207
|
-
#line
|
205
|
+
#line 61 "ext/puma_http11/http11_parser.rl"
|
208
206
|
{
|
209
207
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
210
208
|
}
|
211
|
-
#line
|
209
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
212
210
|
{
|
213
211
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
214
212
|
}
|
215
213
|
goto st5;
|
216
214
|
tr44:
|
217
|
-
#line
|
215
|
+
#line 61 "ext/puma_http11/http11_parser.rl"
|
218
216
|
{
|
219
217
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
220
218
|
}
|
221
|
-
#line
|
219
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
222
220
|
{
|
223
221
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
224
222
|
}
|
@@ -232,7 +230,7 @@ case 5:
|
|
232
230
|
goto tr10;
|
233
231
|
goto st0;
|
234
232
|
tr10:
|
235
|
-
#line
|
233
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
236
234
|
{ MARK(mark, p); }
|
237
235
|
goto st6;
|
238
236
|
st6:
|
@@ -297,21 +295,21 @@ case 13:
|
|
297
295
|
goto st13;
|
298
296
|
goto st0;
|
299
297
|
tr18:
|
300
|
-
#line
|
298
|
+
#line 65 "ext/puma_http11/http11_parser.rl"
|
301
299
|
{
|
302
|
-
parser->
|
300
|
+
parser->server_protocol(parser, PTR_TO(mark), LEN(mark, p));
|
303
301
|
}
|
304
302
|
goto st14;
|
305
303
|
tr26:
|
306
|
-
#line
|
304
|
+
#line 46 "ext/puma_http11/http11_parser.rl"
|
307
305
|
{ MARK(mark, p); }
|
308
|
-
#line
|
306
|
+
#line 47 "ext/puma_http11/http11_parser.rl"
|
309
307
|
{
|
310
308
|
parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
311
309
|
}
|
312
310
|
goto st14;
|
313
311
|
tr29:
|
314
|
-
#line
|
312
|
+
#line 47 "ext/puma_http11/http11_parser.rl"
|
315
313
|
{
|
316
314
|
parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
317
315
|
}
|
@@ -360,7 +358,7 @@ case 16:
|
|
360
358
|
goto tr22;
|
361
359
|
goto st0;
|
362
360
|
tr22:
|
363
|
-
#line
|
361
|
+
#line 73 "ext/puma_http11/http11_parser.rl"
|
364
362
|
{
|
365
363
|
parser->body_start = p - buffer + 1;
|
366
364
|
parser->header_done(parser, p + 1, pe - p - 1);
|
@@ -374,13 +372,13 @@ case 46:
|
|
374
372
|
#line 373 "ext/puma_http11/http11_parser.c"
|
375
373
|
goto st0;
|
376
374
|
tr21:
|
377
|
-
#line
|
375
|
+
#line 40 "ext/puma_http11/http11_parser.rl"
|
378
376
|
{ MARK(field_start, p); }
|
379
|
-
#line
|
377
|
+
#line 41 "ext/puma_http11/http11_parser.rl"
|
380
378
|
{ snake_upcase_char((char *)p); }
|
381
379
|
goto st17;
|
382
380
|
tr23:
|
383
|
-
#line
|
381
|
+
#line 41 "ext/puma_http11/http11_parser.rl"
|
384
382
|
{ snake_upcase_char((char *)p); }
|
385
383
|
goto st17;
|
386
384
|
st17:
|
@@ -413,13 +411,13 @@ case 17:
|
|
413
411
|
goto tr23;
|
414
412
|
goto st0;
|
415
413
|
tr24:
|
416
|
-
#line
|
414
|
+
#line 42 "ext/puma_http11/http11_parser.rl"
|
417
415
|
{
|
418
416
|
parser->field_len = LEN(field_start, p);
|
419
417
|
}
|
420
418
|
goto st18;
|
421
419
|
tr27:
|
422
|
-
#line
|
420
|
+
#line 46 "ext/puma_http11/http11_parser.rl"
|
423
421
|
{ MARK(mark, p); }
|
424
422
|
goto st18;
|
425
423
|
st18:
|
@@ -439,7 +437,7 @@ case 18:
|
|
439
437
|
goto st0;
|
440
438
|
goto tr25;
|
441
439
|
tr25:
|
442
|
-
#line
|
440
|
+
#line 46 "ext/puma_http11/http11_parser.rl"
|
443
441
|
{ MARK(mark, p); }
|
444
442
|
goto st19;
|
445
443
|
st19:
|
@@ -458,39 +456,39 @@ case 19:
|
|
458
456
|
goto st0;
|
459
457
|
goto st19;
|
460
458
|
tr9:
|
461
|
-
#line
|
459
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
462
460
|
{
|
463
461
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
464
462
|
}
|
465
463
|
goto st20;
|
466
464
|
tr38:
|
467
|
-
#line
|
465
|
+
#line 69 "ext/puma_http11/http11_parser.rl"
|
468
466
|
{
|
469
467
|
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
|
470
468
|
}
|
471
|
-
#line
|
469
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
472
470
|
{
|
473
471
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
474
472
|
}
|
475
473
|
goto st20;
|
476
474
|
tr42:
|
477
|
-
#line
|
475
|
+
#line 60 "ext/puma_http11/http11_parser.rl"
|
478
476
|
{ MARK(query_start, p); }
|
479
|
-
#line
|
477
|
+
#line 61 "ext/puma_http11/http11_parser.rl"
|
480
478
|
{
|
481
479
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
482
480
|
}
|
483
|
-
#line
|
481
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
484
482
|
{
|
485
483
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
486
484
|
}
|
487
485
|
goto st20;
|
488
486
|
tr45:
|
489
|
-
#line
|
487
|
+
#line 61 "ext/puma_http11/http11_parser.rl"
|
490
488
|
{
|
491
489
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
492
490
|
}
|
493
|
-
#line
|
491
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
494
492
|
{
|
495
493
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
496
494
|
}
|
@@ -513,7 +511,7 @@ case 20:
|
|
513
511
|
goto st0;
|
514
512
|
goto tr30;
|
515
513
|
tr30:
|
516
|
-
#line
|
514
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
517
515
|
{ MARK(mark, p); }
|
518
516
|
goto st21;
|
519
517
|
st21:
|
@@ -534,7 +532,7 @@ case 21:
|
|
534
532
|
goto st0;
|
535
533
|
goto st21;
|
536
534
|
tr5:
|
537
|
-
#line
|
535
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
538
536
|
{ MARK(mark, p); }
|
539
537
|
goto st22;
|
540
538
|
st22:
|
@@ -559,7 +557,7 @@ case 22:
|
|
559
557
|
goto st22;
|
560
558
|
goto st0;
|
561
559
|
tr7:
|
562
|
-
#line
|
560
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
563
561
|
{ MARK(mark, p); }
|
564
562
|
goto st23;
|
565
563
|
st23:
|
@@ -579,7 +577,7 @@ case 23:
|
|
579
577
|
goto st0;
|
580
578
|
goto st23;
|
581
579
|
tr6:
|
582
|
-
#line
|
580
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
583
581
|
{ MARK(mark, p); }
|
584
582
|
goto st24;
|
585
583
|
st24:
|
@@ -600,7 +598,7 @@ case 24:
|
|
600
598
|
goto st0;
|
601
599
|
goto st24;
|
602
600
|
tr39:
|
603
|
-
#line
|
601
|
+
#line 69 "ext/puma_http11/http11_parser.rl"
|
604
602
|
{
|
605
603
|
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
|
606
604
|
}
|
@@ -622,7 +620,7 @@ case 25:
|
|
622
620
|
goto st0;
|
623
621
|
goto tr40;
|
624
622
|
tr40:
|
625
|
-
#line
|
623
|
+
#line 60 "ext/puma_http11/http11_parser.rl"
|
626
624
|
{ MARK(query_start, p); }
|
627
625
|
goto st26;
|
628
626
|
st26:
|
@@ -1023,7 +1021,7 @@ case 45:
|
|
1023
1021
|
_out: {}
|
1024
1022
|
}
|
1025
1023
|
|
1026
|
-
#line
|
1024
|
+
#line 117 "ext/puma_http11/http11_parser.rl"
|
1027
1025
|
|
1028
1026
|
if (!puma_parser_has_error(parser))
|
1029
1027
|
parser->cs = cs;
|
@@ -29,8 +29,8 @@ typedef void (*field_cb)(struct puma_parser* hp,
|
|
29
29
|
|
30
30
|
typedef struct puma_parser {
|
31
31
|
int cs;
|
32
|
-
size_t body_start;
|
33
32
|
int content_len;
|
33
|
+
size_t body_start;
|
34
34
|
size_t nread;
|
35
35
|
size_t mark;
|
36
36
|
size_t field_start;
|
@@ -46,7 +46,7 @@ typedef struct puma_parser {
|
|
46
46
|
element_cb fragment;
|
47
47
|
element_cb request_path;
|
48
48
|
element_cb query_string;
|
49
|
-
element_cb
|
49
|
+
element_cb server_protocol;
|
50
50
|
element_cb header_done;
|
51
51
|
|
52
52
|
char buf[BUFFER_LEN];
|
@@ -39,8 +39,8 @@ public class Http11Parser {
|
|
39
39
|
Http11.query_string(runtime, parser.data, parser.buffer, parser.query_start, fpc-parser.query_start);
|
40
40
|
}
|
41
41
|
|
42
|
-
action
|
43
|
-
Http11.
|
42
|
+
action server_protocol {
|
43
|
+
Http11.server_protocol(runtime, parser.data, parser.buffer, parser.mark, fpc-parser.mark);
|
44
44
|
}
|
45
45
|
|
46
46
|
action request_path {
|
@@ -58,7 +58,7 @@ public class Http11Parser {
|
|
58
58
|
}%%
|
59
59
|
|
60
60
|
/** Data **/
|
61
|
-
%% write data;
|
61
|
+
%% write data noentry;
|
62
62
|
|
63
63
|
public static interface ElementCB {
|
64
64
|
public void call(Ruby runtime, RubyHash data, ByteList buffer, int at, int length);
|
@@ -62,8 +62,8 @@ static void snake_upcase_char(char *c)
|
|
62
62
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, fpc));
|
63
63
|
}
|
64
64
|
|
65
|
-
action
|
66
|
-
parser->
|
65
|
+
action server_protocol {
|
66
|
+
parser->server_protocol(parser, PTR_TO(mark), LEN(mark, fpc));
|
67
67
|
}
|
68
68
|
|
69
69
|
action request_path {
|
@@ -81,7 +81,7 @@ static void snake_upcase_char(char *c)
|
|
81
81
|
}%%
|
82
82
|
|
83
83
|
/** Data **/
|
84
|
-
%% write data;
|
84
|
+
%% write data noentry;
|
85
85
|
|
86
86
|
int puma_parser_init(puma_parser *parser) {
|
87
87
|
int cs = 0;
|
@@ -38,8 +38,8 @@
|
|
38
38
|
Method = ( upper | digit | safe ){1,20} >mark %request_method;
|
39
39
|
|
40
40
|
http_number = ( digit+ "." digit+ ) ;
|
41
|
-
|
42
|
-
Request_Line = ( Method " " Request_URI ("#" Fragment){0,1} " "
|
41
|
+
Server_Protocol = ( "HTTP/" http_number ) >mark %server_protocol ;
|
42
|
+
Request_Line = ( Method " " Request_URI ("#" Fragment){0,1} " " Server_Protocol CRLF ) ;
|
43
43
|
|
44
44
|
field_name = ( token -- ":" )+ >start_field $snake_upcase_field %write_field;
|
45
45
|
|