puma 3.12.6 → 6.3.0
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 +1806 -451
- data/LICENSE +23 -20
- data/README.md +217 -65
- data/bin/puma-wild +3 -9
- data/docs/architecture.md +59 -21
- data/docs/compile_options.md +55 -0
- data/docs/deployment.md +69 -58
- 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/docs/kubernetes.md +66 -0
- data/docs/nginx.md +2 -2
- data/docs/plugins.md +22 -12
- data/docs/rails_dev_mode.md +28 -0
- data/docs/restart.md +47 -22
- data/docs/signals.md +13 -11
- data/docs/stats.md +142 -0
- data/docs/systemd.md +94 -120
- 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 -2
- data/ext/puma_http11/ext_help.h +1 -1
- data/ext/puma_http11/extconf.rb +61 -3
- data/ext/puma_http11/http11_parser.c +103 -117
- data/ext/puma_http11/http11_parser.h +2 -2
- data/ext/puma_http11/http11_parser.java.rl +22 -38
- data/ext/puma_http11/http11_parser.rl +3 -3
- data/ext/puma_http11/http11_parser_common.rl +6 -6
- data/ext/puma_http11/mini_ssl.c +389 -99
- data/ext/puma_http11/no_ssl/PumaHttp11Service.java +15 -0
- data/ext/puma_http11/org/jruby/puma/Http11.java +108 -116
- data/ext/puma_http11/org/jruby/puma/Http11Parser.java +84 -99
- data/ext/puma_http11/org/jruby/puma/MiniSSL.java +248 -92
- data/ext/puma_http11/puma_http11.c +49 -57
- data/lib/puma/app/status.rb +71 -49
- data/lib/puma/binder.rb +244 -150
- data/lib/puma/cli.rb +38 -34
- data/lib/puma/client.rb +388 -244
- data/lib/puma/cluster/worker.rb +180 -0
- data/lib/puma/cluster/worker_handle.rb +97 -0
- data/lib/puma/cluster.rb +261 -243
- data/lib/puma/commonlogger.rb +21 -14
- data/lib/puma/configuration.rb +116 -88
- data/lib/puma/const.rb +154 -104
- data/lib/puma/control_cli.rb +115 -70
- data/lib/puma/detect.rb +33 -2
- data/lib/puma/dsl.rb +764 -134
- data/lib/puma/error_logger.rb +113 -0
- data/lib/puma/events.rb +16 -112
- data/lib/puma/io_buffer.rb +42 -5
- 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 +184 -133
- data/lib/puma/log_writer.rb +147 -0
- data/lib/puma/minissl/context_builder.rb +93 -0
- data/lib/puma/minissl.rb +263 -70
- data/lib/puma/null_io.rb +18 -1
- data/lib/puma/plugin/systemd.rb +90 -0
- data/lib/puma/plugin/tmp_restart.rb +3 -1
- data/lib/puma/plugin.rb +7 -13
- data/lib/puma/rack/builder.rb +9 -11
- data/lib/puma/rack/urlmap.rb +2 -0
- data/lib/puma/rack_default.rb +21 -4
- data/lib/puma/reactor.rb +93 -315
- data/lib/puma/request.rb +671 -0
- data/lib/puma/runner.rb +94 -69
- data/lib/puma/sd_notify.rb +149 -0
- data/lib/puma/server.rb +327 -772
- data/lib/puma/single.rb +20 -74
- data/lib/puma/state_file.rb +45 -8
- data/lib/puma/thread_pool.rb +146 -92
- data/lib/puma/util.rb +22 -10
- data/lib/puma.rb +60 -5
- data/lib/rack/handler/puma.rb +116 -90
- data/tools/Dockerfile +16 -0
- data/tools/trickletest.rb +0 -1
- metadata +54 -32
- data/ext/puma_http11/io_buffer.c +0 -155
- data/lib/puma/accept_nonblock.rb +0 -23
- data/lib/puma/compat.rb +0 -14
- data/lib/puma/convenient.rb +0 -25
- data/lib/puma/daemon_ext.rb +0 -33
- data/lib/puma/delegation.rb +0 -13
- data/lib/puma/java_io_buffer.rb +0 -47
- data/lib/puma/rack/backports/uri/common_193.rb +0 -33
- 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/{tools → docs}/jungle/rc.d/puma.conf +0 -0
data/ext/puma_http11/extconf.rb
CHANGED
@@ -2,13 +2,71 @@ require 'mkmf'
|
|
2
2
|
|
3
3
|
dir_config("puma_http11")
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
if $mingw
|
6
|
+
append_cflags '-fstack-protector-strong -D_FORTIFY_SOURCE=2'
|
7
|
+
append_ldflags '-fstack-protector-strong -l:libssp.a'
|
8
|
+
have_library 'ssp'
|
9
|
+
end
|
10
|
+
|
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')
|
7
15
|
|
8
|
-
|
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')} &&
|
9
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
|
10
28
|
|
29
|
+
if found_ssl
|
11
30
|
have_header "openssl/bio.h"
|
31
|
+
|
32
|
+
# below is yes for 1.0.2 & later
|
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"
|
42
|
+
|
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"
|
48
|
+
|
49
|
+
# Random.bytes available in Ruby 2.5 and later, Random::DEFAULT deprecated in 3.0
|
50
|
+
if Random.respond_to?(:bytes)
|
51
|
+
$defs.push "-DHAVE_RANDOM_BYTES"
|
52
|
+
puts "checking for Random.bytes... yes"
|
53
|
+
else
|
54
|
+
puts "checking for Random.bytes... no"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
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'
|
12
70
|
end
|
13
71
|
end
|
14
72
|
|
@@ -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
|
-
static const int puma_parser_first_final =
|
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:
|
@@ -119,20 +117,20 @@ case 2:
|
|
119
117
|
#line 118 "ext/puma_http11/http11_parser.c"
|
120
118
|
switch( (*p) ) {
|
121
119
|
case 32: goto tr2;
|
122
|
-
case 36: goto
|
123
|
-
case 95: goto
|
120
|
+
case 36: goto st27;
|
121
|
+
case 95: goto st27;
|
124
122
|
}
|
125
123
|
if ( (*p) < 48 ) {
|
126
124
|
if ( 45 <= (*p) && (*p) <= 46 )
|
127
|
-
goto
|
125
|
+
goto st27;
|
128
126
|
} else if ( (*p) > 57 ) {
|
129
127
|
if ( 65 <= (*p) && (*p) <= 90 )
|
130
|
-
goto
|
128
|
+
goto st27;
|
131
129
|
} else
|
132
|
-
goto
|
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
|
-
|
205
|
-
#line
|
202
|
+
tr41:
|
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
|
-
|
217
|
-
#line
|
214
|
+
tr44:
|
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,27 +358,27 @@ 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);
|
367
|
-
{p++; cs =
|
365
|
+
{p++; cs = 46; goto _out;}
|
368
366
|
}
|
369
|
-
goto
|
370
|
-
|
367
|
+
goto st46;
|
368
|
+
st46:
|
371
369
|
if ( ++p == pe )
|
372
|
-
goto
|
373
|
-
case
|
370
|
+
goto _test_eof46;
|
371
|
+
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:
|
@@ -430,54 +428,67 @@ case 18:
|
|
430
428
|
switch( (*p) ) {
|
431
429
|
case 13: goto tr26;
|
432
430
|
case 32: goto tr27;
|
431
|
+
case 127: goto st0;
|
433
432
|
}
|
433
|
+
if ( (*p) > 8 ) {
|
434
|
+
if ( 10 <= (*p) && (*p) <= 31 )
|
435
|
+
goto st0;
|
436
|
+
} else if ( (*p) >= 0 )
|
437
|
+
goto st0;
|
434
438
|
goto tr25;
|
435
439
|
tr25:
|
436
|
-
#line
|
440
|
+
#line 46 "ext/puma_http11/http11_parser.rl"
|
437
441
|
{ MARK(mark, p); }
|
438
442
|
goto st19;
|
439
443
|
st19:
|
440
444
|
if ( ++p == pe )
|
441
445
|
goto _test_eof19;
|
442
446
|
case 19:
|
443
|
-
#line
|
444
|
-
|
445
|
-
goto tr29;
|
447
|
+
#line 448 "ext/puma_http11/http11_parser.c"
|
448
|
+
switch( (*p) ) {
|
449
|
+
case 13: goto tr29;
|
450
|
+
case 127: goto st0;
|
451
|
+
}
|
452
|
+
if ( (*p) > 8 ) {
|
453
|
+
if ( 10 <= (*p) && (*p) <= 31 )
|
454
|
+
goto st0;
|
455
|
+
} else if ( (*p) >= 0 )
|
456
|
+
goto st0;
|
446
457
|
goto st19;
|
447
458
|
tr9:
|
448
|
-
#line
|
459
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
449
460
|
{
|
450
461
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
451
462
|
}
|
452
463
|
goto st20;
|
453
464
|
tr38:
|
454
|
-
#line
|
465
|
+
#line 69 "ext/puma_http11/http11_parser.rl"
|
455
466
|
{
|
456
467
|
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
|
457
468
|
}
|
458
|
-
#line
|
469
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
459
470
|
{
|
460
471
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
461
472
|
}
|
462
473
|
goto st20;
|
463
|
-
|
464
|
-
#line
|
474
|
+
tr42:
|
475
|
+
#line 60 "ext/puma_http11/http11_parser.rl"
|
465
476
|
{ MARK(query_start, p); }
|
466
|
-
#line
|
477
|
+
#line 61 "ext/puma_http11/http11_parser.rl"
|
467
478
|
{
|
468
479
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
469
480
|
}
|
470
|
-
#line
|
481
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
471
482
|
{
|
472
483
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
473
484
|
}
|
474
485
|
goto st20;
|
475
|
-
|
476
|
-
#line
|
486
|
+
tr45:
|
487
|
+
#line 61 "ext/puma_http11/http11_parser.rl"
|
477
488
|
{
|
478
489
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
479
490
|
}
|
480
|
-
#line
|
491
|
+
#line 53 "ext/puma_http11/http11_parser.rl"
|
481
492
|
{
|
482
493
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
483
494
|
}
|
@@ -486,7 +497,7 @@ st20:
|
|
486
497
|
if ( ++p == pe )
|
487
498
|
goto _test_eof20;
|
488
499
|
case 20:
|
489
|
-
#line
|
500
|
+
#line 501 "ext/puma_http11/http11_parser.c"
|
490
501
|
switch( (*p) ) {
|
491
502
|
case 32: goto tr31;
|
492
503
|
case 60: goto st0;
|
@@ -500,14 +511,14 @@ case 20:
|
|
500
511
|
goto st0;
|
501
512
|
goto tr30;
|
502
513
|
tr30:
|
503
|
-
#line
|
514
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
504
515
|
{ MARK(mark, p); }
|
505
516
|
goto st21;
|
506
517
|
st21:
|
507
518
|
if ( ++p == pe )
|
508
519
|
goto _test_eof21;
|
509
520
|
case 21:
|
510
|
-
#line
|
521
|
+
#line 522 "ext/puma_http11/http11_parser.c"
|
511
522
|
switch( (*p) ) {
|
512
523
|
case 32: goto tr33;
|
513
524
|
case 60: goto st0;
|
@@ -521,14 +532,14 @@ case 21:
|
|
521
532
|
goto st0;
|
522
533
|
goto st21;
|
523
534
|
tr5:
|
524
|
-
#line
|
535
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
525
536
|
{ MARK(mark, p); }
|
526
537
|
goto st22;
|
527
538
|
st22:
|
528
539
|
if ( ++p == pe )
|
529
540
|
goto _test_eof22;
|
530
541
|
case 22:
|
531
|
-
#line
|
542
|
+
#line 543 "ext/puma_http11/http11_parser.c"
|
532
543
|
switch( (*p) ) {
|
533
544
|
case 43: goto st22;
|
534
545
|
case 58: goto st23;
|
@@ -546,14 +557,14 @@ case 22:
|
|
546
557
|
goto st22;
|
547
558
|
goto st0;
|
548
559
|
tr7:
|
549
|
-
#line
|
560
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
550
561
|
{ MARK(mark, p); }
|
551
562
|
goto st23;
|
552
563
|
st23:
|
553
564
|
if ( ++p == pe )
|
554
565
|
goto _test_eof23;
|
555
566
|
case 23:
|
556
|
-
#line
|
567
|
+
#line 568 "ext/puma_http11/http11_parser.c"
|
557
568
|
switch( (*p) ) {
|
558
569
|
case 32: goto tr8;
|
559
570
|
case 34: goto st0;
|
@@ -566,29 +577,28 @@ case 23:
|
|
566
577
|
goto st0;
|
567
578
|
goto st23;
|
568
579
|
tr6:
|
569
|
-
#line
|
580
|
+
#line 37 "ext/puma_http11/http11_parser.rl"
|
570
581
|
{ MARK(mark, p); }
|
571
582
|
goto st24;
|
572
583
|
st24:
|
573
584
|
if ( ++p == pe )
|
574
585
|
goto _test_eof24;
|
575
586
|
case 24:
|
576
|
-
#line
|
587
|
+
#line 588 "ext/puma_http11/http11_parser.c"
|
577
588
|
switch( (*p) ) {
|
578
589
|
case 32: goto tr37;
|
579
590
|
case 34: goto st0;
|
580
591
|
case 35: goto tr38;
|
581
|
-
case 59: goto tr39;
|
582
592
|
case 60: goto st0;
|
583
593
|
case 62: goto st0;
|
584
|
-
case 63: goto
|
594
|
+
case 63: goto tr39;
|
585
595
|
case 127: goto st0;
|
586
596
|
}
|
587
597
|
if ( 0 <= (*p) && (*p) <= 31 )
|
588
598
|
goto st0;
|
589
599
|
goto st24;
|
590
600
|
tr39:
|
591
|
-
#line
|
601
|
+
#line 69 "ext/puma_http11/http11_parser.rl"
|
592
602
|
{
|
593
603
|
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
|
594
604
|
}
|
@@ -597,30 +607,27 @@ st25:
|
|
597
607
|
if ( ++p == pe )
|
598
608
|
goto _test_eof25;
|
599
609
|
case 25:
|
600
|
-
#line
|
610
|
+
#line 611 "ext/puma_http11/http11_parser.c"
|
601
611
|
switch( (*p) ) {
|
602
|
-
case 32: goto
|
612
|
+
case 32: goto tr41;
|
603
613
|
case 34: goto st0;
|
604
|
-
case 35: goto
|
614
|
+
case 35: goto tr42;
|
605
615
|
case 60: goto st0;
|
606
616
|
case 62: goto st0;
|
607
|
-
case 63: goto st26;
|
608
617
|
case 127: goto st0;
|
609
618
|
}
|
610
619
|
if ( 0 <= (*p) && (*p) <= 31 )
|
611
620
|
goto st0;
|
612
|
-
goto
|
621
|
+
goto tr40;
|
613
622
|
tr40:
|
614
|
-
#line
|
615
|
-
{
|
616
|
-
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
|
617
|
-
}
|
623
|
+
#line 60 "ext/puma_http11/http11_parser.rl"
|
624
|
+
{ MARK(query_start, p); }
|
618
625
|
goto st26;
|
619
626
|
st26:
|
620
627
|
if ( ++p == pe )
|
621
628
|
goto _test_eof26;
|
622
629
|
case 26:
|
623
|
-
#line
|
630
|
+
#line 631 "ext/puma_http11/http11_parser.c"
|
624
631
|
switch( (*p) ) {
|
625
632
|
case 32: goto tr44;
|
626
633
|
case 34: goto st0;
|
@@ -631,27 +638,25 @@ case 26:
|
|
631
638
|
}
|
632
639
|
if ( 0 <= (*p) && (*p) <= 31 )
|
633
640
|
goto st0;
|
634
|
-
goto
|
635
|
-
tr43:
|
636
|
-
#line 58 "ext/puma_http11/http11_parser.rl"
|
637
|
-
{ MARK(query_start, p); }
|
638
|
-
goto st27;
|
641
|
+
goto st26;
|
639
642
|
st27:
|
640
643
|
if ( ++p == pe )
|
641
644
|
goto _test_eof27;
|
642
645
|
case 27:
|
643
|
-
#line 642 "ext/puma_http11/http11_parser.c"
|
644
646
|
switch( (*p) ) {
|
645
|
-
case 32: goto
|
646
|
-
case
|
647
|
-
case
|
648
|
-
case 60: goto st0;
|
649
|
-
case 62: goto st0;
|
650
|
-
case 127: goto st0;
|
647
|
+
case 32: goto tr2;
|
648
|
+
case 36: goto st28;
|
649
|
+
case 95: goto st28;
|
651
650
|
}
|
652
|
-
if (
|
653
|
-
|
654
|
-
|
651
|
+
if ( (*p) < 48 ) {
|
652
|
+
if ( 45 <= (*p) && (*p) <= 46 )
|
653
|
+
goto st28;
|
654
|
+
} else if ( (*p) > 57 ) {
|
655
|
+
if ( 65 <= (*p) && (*p) <= 90 )
|
656
|
+
goto st28;
|
657
|
+
} else
|
658
|
+
goto st28;
|
659
|
+
goto st0;
|
655
660
|
st28:
|
656
661
|
if ( ++p == pe )
|
657
662
|
goto _test_eof28;
|
@@ -962,24 +967,6 @@ st45:
|
|
962
967
|
if ( ++p == pe )
|
963
968
|
goto _test_eof45;
|
964
969
|
case 45:
|
965
|
-
switch( (*p) ) {
|
966
|
-
case 32: goto tr2;
|
967
|
-
case 36: goto st46;
|
968
|
-
case 95: goto st46;
|
969
|
-
}
|
970
|
-
if ( (*p) < 48 ) {
|
971
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
972
|
-
goto st46;
|
973
|
-
} else if ( (*p) > 57 ) {
|
974
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
975
|
-
goto st46;
|
976
|
-
} else
|
977
|
-
goto st46;
|
978
|
-
goto st0;
|
979
|
-
st46:
|
980
|
-
if ( ++p == pe )
|
981
|
-
goto _test_eof46;
|
982
|
-
case 46:
|
983
970
|
if ( (*p) == 32 )
|
984
971
|
goto tr2;
|
985
972
|
goto st0;
|
@@ -999,7 +986,7 @@ case 46:
|
|
999
986
|
_test_eof14: cs = 14; goto _test_eof;
|
1000
987
|
_test_eof15: cs = 15; goto _test_eof;
|
1001
988
|
_test_eof16: cs = 16; goto _test_eof;
|
1002
|
-
|
989
|
+
_test_eof46: cs = 46; goto _test_eof;
|
1003
990
|
_test_eof17: cs = 17; goto _test_eof;
|
1004
991
|
_test_eof18: cs = 18; goto _test_eof;
|
1005
992
|
_test_eof19: cs = 19; goto _test_eof;
|
@@ -1029,13 +1016,12 @@ case 46:
|
|
1029
1016
|
_test_eof43: cs = 43; goto _test_eof;
|
1030
1017
|
_test_eof44: cs = 44; goto _test_eof;
|
1031
1018
|
_test_eof45: cs = 45; goto _test_eof;
|
1032
|
-
_test_eof46: cs = 46; goto _test_eof;
|
1033
1019
|
|
1034
1020
|
_test_eof: {}
|
1035
1021
|
_out: {}
|
1036
1022
|
}
|
1037
1023
|
|
1038
|
-
#line
|
1024
|
+
#line 117 "ext/puma_http11/http11_parser.rl"
|
1039
1025
|
|
1040
1026
|
if (!puma_parser_has_error(parser))
|
1041
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];
|