puma 5.0.4 → 5.5.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.

Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +250 -48
  3. data/README.md +90 -24
  4. data/docs/architecture.md +57 -20
  5. data/docs/compile_options.md +21 -0
  6. data/docs/deployment.md +53 -67
  7. data/docs/fork_worker.md +2 -0
  8. data/docs/jungle/rc.d/README.md +1 -1
  9. data/docs/kubernetes.md +66 -0
  10. data/docs/plugins.md +15 -15
  11. data/docs/rails_dev_mode.md +28 -0
  12. data/docs/restart.md +7 -7
  13. data/docs/signals.md +10 -10
  14. data/docs/stats.md +142 -0
  15. data/docs/systemd.md +85 -66
  16. data/ext/puma_http11/extconf.rb +36 -6
  17. data/ext/puma_http11/http11_parser.c +64 -59
  18. data/ext/puma_http11/http11_parser.h +1 -1
  19. data/ext/puma_http11/http11_parser.java.rl +1 -1
  20. data/ext/puma_http11/http11_parser.rl +1 -1
  21. data/ext/puma_http11/http11_parser_common.rl +1 -1
  22. data/ext/puma_http11/mini_ssl.c +177 -84
  23. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +39 -41
  24. data/ext/puma_http11/puma_http11.c +8 -2
  25. data/lib/puma/app/status.rb +4 -7
  26. data/lib/puma/binder.rb +121 -46
  27. data/lib/puma/cli.rb +9 -0
  28. data/lib/puma/client.rb +58 -19
  29. data/lib/puma/cluster/worker.rb +19 -16
  30. data/lib/puma/cluster/worker_handle.rb +9 -2
  31. data/lib/puma/cluster.rb +46 -22
  32. data/lib/puma/configuration.rb +18 -2
  33. data/lib/puma/const.rb +14 -4
  34. data/lib/puma/control_cli.rb +76 -71
  35. data/lib/puma/detect.rb +14 -10
  36. data/lib/puma/dsl.rb +143 -26
  37. data/lib/puma/error_logger.rb +12 -5
  38. data/lib/puma/events.rb +18 -3
  39. data/lib/puma/json_serialization.rb +96 -0
  40. data/lib/puma/launcher.rb +54 -6
  41. data/lib/puma/minissl/context_builder.rb +6 -0
  42. data/lib/puma/minissl.rb +54 -38
  43. data/lib/puma/null_io.rb +12 -0
  44. data/lib/puma/plugin.rb +1 -1
  45. data/lib/puma/queue_close.rb +7 -7
  46. data/lib/puma/rack/builder.rb +1 -1
  47. data/lib/puma/reactor.rb +19 -12
  48. data/lib/puma/request.rb +45 -16
  49. data/lib/puma/runner.rb +38 -13
  50. data/lib/puma/server.rb +62 -123
  51. data/lib/puma/state_file.rb +5 -3
  52. data/lib/puma/systemd.rb +46 -0
  53. data/lib/puma/thread_pool.rb +10 -7
  54. data/lib/puma/util.rb +8 -1
  55. data/lib/puma.rb +36 -10
  56. data/lib/rack/handler/puma.rb +1 -0
  57. 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:
@@ -428,56 +426,63 @@ st18:
428
426
  case 18:
429
427
  #line 428 "ext/puma_http11/http11_parser.c"
430
428
  switch( (*p) ) {
429
+ case 9: goto tr25;
431
430
  case 13: goto tr26;
432
431
  case 32: goto tr27;
433
432
  }
434
- goto tr25;
433
+ if ( 33 <= (*p) && (*p) <= 126 )
434
+ goto tr25;
435
+ goto st0;
435
436
  tr25:
436
- #line 44 "ext/puma_http11/http11_parser.rl"
437
+ #line 46 "ext/puma_http11/http11_parser.rl"
437
438
  { MARK(mark, p); }
438
439
  goto st19;
439
440
  st19:
440
441
  if ( ++p == pe )
441
442
  goto _test_eof19;
442
443
  case 19:
443
- #line 442 "ext/puma_http11/http11_parser.c"
444
- if ( (*p) == 13 )
445
- goto tr29;
446
- goto st19;
444
+ #line 445 "ext/puma_http11/http11_parser.c"
445
+ switch( (*p) ) {
446
+ case 9: goto st19;
447
+ case 13: goto tr29;
448
+ }
449
+ if ( 32 <= (*p) && (*p) <= 126 )
450
+ goto st19;
451
+ goto st0;
447
452
  tr9:
448
- #line 51 "ext/puma_http11/http11_parser.rl"
453
+ #line 53 "ext/puma_http11/http11_parser.rl"
449
454
  {
450
455
  parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
451
456
  }
452
457
  goto st20;
453
458
  tr38:
454
- #line 67 "ext/puma_http11/http11_parser.rl"
459
+ #line 69 "ext/puma_http11/http11_parser.rl"
455
460
  {
456
461
  parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
457
462
  }
458
- #line 51 "ext/puma_http11/http11_parser.rl"
463
+ #line 53 "ext/puma_http11/http11_parser.rl"
459
464
  {
460
465
  parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
461
466
  }
462
467
  goto st20;
463
468
  tr42:
464
- #line 58 "ext/puma_http11/http11_parser.rl"
469
+ #line 60 "ext/puma_http11/http11_parser.rl"
465
470
  { MARK(query_start, p); }
466
- #line 59 "ext/puma_http11/http11_parser.rl"
471
+ #line 61 "ext/puma_http11/http11_parser.rl"
467
472
  {
468
473
  parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
469
474
  }
470
- #line 51 "ext/puma_http11/http11_parser.rl"
475
+ #line 53 "ext/puma_http11/http11_parser.rl"
471
476
  {
472
477
  parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
473
478
  }
474
479
  goto st20;
475
480
  tr45:
476
- #line 59 "ext/puma_http11/http11_parser.rl"
481
+ #line 61 "ext/puma_http11/http11_parser.rl"
477
482
  {
478
483
  parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
479
484
  }
480
- #line 51 "ext/puma_http11/http11_parser.rl"
485
+ #line 53 "ext/puma_http11/http11_parser.rl"
481
486
  {
482
487
  parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
483
488
  }
@@ -486,7 +491,7 @@ st20:
486
491
  if ( ++p == pe )
487
492
  goto _test_eof20;
488
493
  case 20:
489
- #line 488 "ext/puma_http11/http11_parser.c"
494
+ #line 495 "ext/puma_http11/http11_parser.c"
490
495
  switch( (*p) ) {
491
496
  case 32: goto tr31;
492
497
  case 60: goto st0;
@@ -500,14 +505,14 @@ case 20:
500
505
  goto st0;
501
506
  goto tr30;
502
507
  tr30:
503
- #line 35 "ext/puma_http11/http11_parser.rl"
508
+ #line 37 "ext/puma_http11/http11_parser.rl"
504
509
  { MARK(mark, p); }
505
510
  goto st21;
506
511
  st21:
507
512
  if ( ++p == pe )
508
513
  goto _test_eof21;
509
514
  case 21:
510
- #line 509 "ext/puma_http11/http11_parser.c"
515
+ #line 516 "ext/puma_http11/http11_parser.c"
511
516
  switch( (*p) ) {
512
517
  case 32: goto tr33;
513
518
  case 60: goto st0;
@@ -521,14 +526,14 @@ case 21:
521
526
  goto st0;
522
527
  goto st21;
523
528
  tr5:
524
- #line 35 "ext/puma_http11/http11_parser.rl"
529
+ #line 37 "ext/puma_http11/http11_parser.rl"
525
530
  { MARK(mark, p); }
526
531
  goto st22;
527
532
  st22:
528
533
  if ( ++p == pe )
529
534
  goto _test_eof22;
530
535
  case 22:
531
- #line 530 "ext/puma_http11/http11_parser.c"
536
+ #line 537 "ext/puma_http11/http11_parser.c"
532
537
  switch( (*p) ) {
533
538
  case 43: goto st22;
534
539
  case 58: goto st23;
@@ -546,14 +551,14 @@ case 22:
546
551
  goto st22;
547
552
  goto st0;
548
553
  tr7:
549
- #line 35 "ext/puma_http11/http11_parser.rl"
554
+ #line 37 "ext/puma_http11/http11_parser.rl"
550
555
  { MARK(mark, p); }
551
556
  goto st23;
552
557
  st23:
553
558
  if ( ++p == pe )
554
559
  goto _test_eof23;
555
560
  case 23:
556
- #line 555 "ext/puma_http11/http11_parser.c"
561
+ #line 562 "ext/puma_http11/http11_parser.c"
557
562
  switch( (*p) ) {
558
563
  case 32: goto tr8;
559
564
  case 34: goto st0;
@@ -566,14 +571,14 @@ case 23:
566
571
  goto st0;
567
572
  goto st23;
568
573
  tr6:
569
- #line 35 "ext/puma_http11/http11_parser.rl"
574
+ #line 37 "ext/puma_http11/http11_parser.rl"
570
575
  { MARK(mark, p); }
571
576
  goto st24;
572
577
  st24:
573
578
  if ( ++p == pe )
574
579
  goto _test_eof24;
575
580
  case 24:
576
- #line 575 "ext/puma_http11/http11_parser.c"
581
+ #line 582 "ext/puma_http11/http11_parser.c"
577
582
  switch( (*p) ) {
578
583
  case 32: goto tr37;
579
584
  case 34: goto st0;
@@ -587,7 +592,7 @@ case 24:
587
592
  goto st0;
588
593
  goto st24;
589
594
  tr39:
590
- #line 67 "ext/puma_http11/http11_parser.rl"
595
+ #line 69 "ext/puma_http11/http11_parser.rl"
591
596
  {
592
597
  parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
593
598
  }
@@ -596,7 +601,7 @@ st25:
596
601
  if ( ++p == pe )
597
602
  goto _test_eof25;
598
603
  case 25:
599
- #line 598 "ext/puma_http11/http11_parser.c"
604
+ #line 605 "ext/puma_http11/http11_parser.c"
600
605
  switch( (*p) ) {
601
606
  case 32: goto tr41;
602
607
  case 34: goto st0;
@@ -609,14 +614,14 @@ case 25:
609
614
  goto st0;
610
615
  goto tr40;
611
616
  tr40:
612
- #line 58 "ext/puma_http11/http11_parser.rl"
617
+ #line 60 "ext/puma_http11/http11_parser.rl"
613
618
  { MARK(query_start, p); }
614
619
  goto st26;
615
620
  st26:
616
621
  if ( ++p == pe )
617
622
  goto _test_eof26;
618
623
  case 26:
619
- #line 618 "ext/puma_http11/http11_parser.c"
624
+ #line 625 "ext/puma_http11/http11_parser.c"
620
625
  switch( (*p) ) {
621
626
  case 32: goto tr44;
622
627
  case 34: goto st0;
@@ -1010,7 +1015,7 @@ case 45:
1010
1015
  _out: {}
1011
1016
  }
1012
1017
 
1013
- #line 115 "ext/puma_http11/http11_parser.rl"
1018
+ #line 117 "ext/puma_http11/http11_parser.rl"
1014
1019
 
1015
1020
  if (!puma_parser_has_error(parser))
1016
1021
  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 = ( print | "\t" )* >start_value %write_value;
47
47
 
48
48
  message_header = field_name ":" " "* field_value :> CRLF;
49
49