puma 5.0.4 → 5.6.4

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.

Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +322 -48
  3. data/LICENSE +0 -0
  4. data/README.md +95 -24
  5. data/bin/puma-wild +0 -0
  6. data/docs/architecture.md +57 -20
  7. data/docs/compile_options.md +21 -0
  8. data/docs/deployment.md +53 -67
  9. data/docs/fork_worker.md +2 -0
  10. data/docs/images/puma-connection-flow-no-reactor.png +0 -0
  11. data/docs/images/puma-connection-flow.png +0 -0
  12. data/docs/images/puma-general-arch.png +0 -0
  13. data/docs/jungle/README.md +0 -0
  14. data/docs/jungle/rc.d/README.md +1 -1
  15. data/docs/jungle/rc.d/puma.conf +0 -0
  16. data/docs/kubernetes.md +66 -0
  17. data/docs/nginx.md +0 -0
  18. data/docs/plugins.md +15 -15
  19. data/docs/rails_dev_mode.md +28 -0
  20. data/docs/restart.md +7 -7
  21. data/docs/signals.md +11 -10
  22. data/docs/stats.md +142 -0
  23. data/docs/systemd.md +85 -66
  24. data/ext/puma_http11/PumaHttp11Service.java +0 -0
  25. data/ext/puma_http11/ext_help.h +0 -0
  26. data/ext/puma_http11/extconf.rb +42 -6
  27. data/ext/puma_http11/http11_parser.c +68 -57
  28. data/ext/puma_http11/http11_parser.h +1 -1
  29. data/ext/puma_http11/http11_parser.java.rl +1 -1
  30. data/ext/puma_http11/http11_parser.rl +1 -1
  31. data/ext/puma_http11/http11_parser_common.rl +1 -1
  32. data/ext/puma_http11/mini_ssl.c +226 -88
  33. data/ext/puma_http11/no_ssl/PumaHttp11Service.java +0 -0
  34. data/ext/puma_http11/org/jruby/puma/Http11.java +0 -0
  35. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +51 -51
  36. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +28 -43
  37. data/ext/puma_http11/puma_http11.c +9 -3
  38. data/lib/puma/app/status.rb +4 -7
  39. data/lib/puma/binder.rb +138 -49
  40. data/lib/puma/cli.rb +18 -4
  41. data/lib/puma/client.rb +113 -31
  42. data/lib/puma/cluster/worker.rb +22 -19
  43. data/lib/puma/cluster/worker_handle.rb +13 -2
  44. data/lib/puma/cluster.rb +75 -33
  45. data/lib/puma/commonlogger.rb +0 -0
  46. data/lib/puma/configuration.rb +21 -2
  47. data/lib/puma/const.rb +17 -8
  48. data/lib/puma/control_cli.rb +76 -71
  49. data/lib/puma/detect.rb +19 -9
  50. data/lib/puma/dsl.rb +225 -31
  51. data/lib/puma/error_logger.rb +12 -5
  52. data/lib/puma/events.rb +18 -3
  53. data/lib/puma/io_buffer.rb +0 -0
  54. data/lib/puma/jruby_restart.rb +0 -0
  55. data/lib/puma/json_serialization.rb +96 -0
  56. data/lib/puma/launcher.rb +56 -7
  57. data/lib/puma/minissl/context_builder.rb +14 -6
  58. data/lib/puma/minissl.rb +72 -40
  59. data/lib/puma/null_io.rb +12 -0
  60. data/lib/puma/plugin/tmp_restart.rb +0 -0
  61. data/lib/puma/plugin.rb +2 -2
  62. data/lib/puma/queue_close.rb +7 -7
  63. data/lib/puma/rack/builder.rb +1 -1
  64. data/lib/puma/rack/urlmap.rb +0 -0
  65. data/lib/puma/rack_default.rb +0 -0
  66. data/lib/puma/reactor.rb +19 -12
  67. data/lib/puma/request.rb +55 -21
  68. data/lib/puma/runner.rb +39 -13
  69. data/lib/puma/server.rb +78 -142
  70. data/lib/puma/single.rb +0 -0
  71. data/lib/puma/state_file.rb +45 -9
  72. data/lib/puma/systemd.rb +46 -0
  73. data/lib/puma/thread_pool.rb +11 -8
  74. data/lib/puma/util.rb +8 -1
  75. data/lib/puma.rb +36 -10
  76. data/lib/rack/handler/puma.rb +1 -0
  77. data/tools/Dockerfile +1 -1
  78. data/tools/trickletest.rb +0 -0
  79. metadata +15 -9
@@ -33,20 +33,18 @@ static void snake_upcase_char(char *c)
33
33
  /** Machine **/
34
34
 
35
35
 
36
- #line 79 "ext/puma_http11/http11_parser.rl"
36
+ #line 81 "ext/puma_http11/http11_parser.rl"
37
37
 
38
38
 
39
39
  /** Data **/
40
40
 
41
- #line 40 "ext/puma_http11/http11_parser.c"
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 87 "ext/puma_http11/http11_parser.rl"
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 35 "ext/puma_http11/http11_parser.rl"
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 48 "ext/puma_http11/http11_parser.rl"
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 35 "ext/puma_http11/http11_parser.rl"
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 51 "ext/puma_http11/http11_parser.rl"
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 35 "ext/puma_http11/http11_parser.rl"
179
+ #line 37 "ext/puma_http11/http11_parser.rl"
182
180
  { MARK(mark, p); }
183
- #line 54 "ext/puma_http11/http11_parser.rl"
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 54 "ext/puma_http11/http11_parser.rl"
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 67 "ext/puma_http11/http11_parser.rl"
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 51 "ext/puma_http11/http11_parser.rl"
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 58 "ext/puma_http11/http11_parser.rl"
203
+ #line 60 "ext/puma_http11/http11_parser.rl"
206
204
  { MARK(query_start, p); }
207
- #line 59 "ext/puma_http11/http11_parser.rl"
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 51 "ext/puma_http11/http11_parser.rl"
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 59 "ext/puma_http11/http11_parser.rl"
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 51 "ext/puma_http11/http11_parser.rl"
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 35 "ext/puma_http11/http11_parser.rl"
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 63 "ext/puma_http11/http11_parser.rl"
298
+ #line 65 "ext/puma_http11/http11_parser.rl"
301
299
  {
302
300
  parser->http_version(parser, PTR_TO(mark), LEN(mark, p));
303
301
  }
304
302
  goto st14;
305
303
  tr26:
306
- #line 44 "ext/puma_http11/http11_parser.rl"
304
+ #line 46 "ext/puma_http11/http11_parser.rl"
307
305
  { MARK(mark, p); }
308
- #line 45 "ext/puma_http11/http11_parser.rl"
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 45 "ext/puma_http11/http11_parser.rl"
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 71 "ext/puma_http11/http11_parser.rl"
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 38 "ext/puma_http11/http11_parser.rl"
375
+ #line 40 "ext/puma_http11/http11_parser.rl"
378
376
  { MARK(field_start, p); }
379
- #line 39 "ext/puma_http11/http11_parser.rl"
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 39 "ext/puma_http11/http11_parser.rl"
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 40 "ext/puma_http11/http11_parser.rl"
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 44 "ext/puma_http11/http11_parser.rl"
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 44 "ext/puma_http11/http11_parser.rl"
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 442 "ext/puma_http11/http11_parser.c"
444
- if ( (*p) == 13 )
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 51 "ext/puma_http11/http11_parser.rl"
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 67 "ext/puma_http11/http11_parser.rl"
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 51 "ext/puma_http11/http11_parser.rl"
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
474
  tr42:
464
- #line 58 "ext/puma_http11/http11_parser.rl"
475
+ #line 60 "ext/puma_http11/http11_parser.rl"
465
476
  { MARK(query_start, p); }
466
- #line 59 "ext/puma_http11/http11_parser.rl"
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 51 "ext/puma_http11/http11_parser.rl"
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
486
  tr45:
476
- #line 59 "ext/puma_http11/http11_parser.rl"
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 51 "ext/puma_http11/http11_parser.rl"
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 488 "ext/puma_http11/http11_parser.c"
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 35 "ext/puma_http11/http11_parser.rl"
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 509 "ext/puma_http11/http11_parser.c"
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 35 "ext/puma_http11/http11_parser.rl"
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 530 "ext/puma_http11/http11_parser.c"
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 35 "ext/puma_http11/http11_parser.rl"
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 555 "ext/puma_http11/http11_parser.c"
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,14 +577,14 @@ case 23:
566
577
  goto st0;
567
578
  goto st23;
568
579
  tr6:
569
- #line 35 "ext/puma_http11/http11_parser.rl"
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 575 "ext/puma_http11/http11_parser.c"
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;
@@ -587,7 +598,7 @@ case 24:
587
598
  goto st0;
588
599
  goto st24;
589
600
  tr39:
590
- #line 67 "ext/puma_http11/http11_parser.rl"
601
+ #line 69 "ext/puma_http11/http11_parser.rl"
591
602
  {
592
603
  parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
593
604
  }
@@ -596,7 +607,7 @@ st25:
596
607
  if ( ++p == pe )
597
608
  goto _test_eof25;
598
609
  case 25:
599
- #line 598 "ext/puma_http11/http11_parser.c"
610
+ #line 611 "ext/puma_http11/http11_parser.c"
600
611
  switch( (*p) ) {
601
612
  case 32: goto tr41;
602
613
  case 34: goto st0;
@@ -609,14 +620,14 @@ case 25:
609
620
  goto st0;
610
621
  goto tr40;
611
622
  tr40:
612
- #line 58 "ext/puma_http11/http11_parser.rl"
623
+ #line 60 "ext/puma_http11/http11_parser.rl"
613
624
  { MARK(query_start, p); }
614
625
  goto st26;
615
626
  st26:
616
627
  if ( ++p == pe )
617
628
  goto _test_eof26;
618
629
  case 26:
619
- #line 618 "ext/puma_http11/http11_parser.c"
630
+ #line 631 "ext/puma_http11/http11_parser.c"
620
631
  switch( (*p) ) {
621
632
  case 32: goto tr44;
622
633
  case 34: goto st0;
@@ -1010,7 +1021,7 @@ case 45:
1010
1021
  _out: {}
1011
1022
  }
1012
1023
 
1013
- #line 115 "ext/puma_http11/http11_parser.rl"
1024
+ #line 117 "ext/puma_http11/http11_parser.rl"
1014
1025
 
1015
1026
  if (!puma_parser_has_error(parser))
1016
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;
@@ -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);
@@ -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;
@@ -43,7 +43,7 @@
43
43
 
44
44
  field_name = ( token -- ":" )+ >start_field $snake_upcase_field %write_field;
45
45
 
46
- field_value = any* >start_value %write_value;
46
+ field_value = ( (any -- CTL) | "\t" )* >start_value %write_value;
47
47
 
48
48
  message_header = field_name ":" " "* field_value :> CRLF;
49
49