puma 5.0.1-java → 5.0.2-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8714e4e2dc2f93e740852757eb2f4b27d1a8b798272cf3fdaeeb5149ee342c5
4
- data.tar.gz: 3864f8df894c0bed555b3894d2d0898bfe0c0f562e7be0888ac93a73888dda02
3
+ metadata.gz: 4694c6ad2829e4921002294f9484c63b2f7ac097011c1cbb27ddbd533d0841b8
4
+ data.tar.gz: c6d75b3c506da44286f1e8de2c86d329c2061f60bb846b2a373d9fa139763aa1
5
5
  SHA512:
6
- metadata.gz: 9f84284f5271ab83e46a4c848781617e967a649a677113689710ca980bea589654904ac55a6a62fbd9c1e859a803b0b0b0f1ed3c97253de9cf91bdf4ec79e2b0
7
- data.tar.gz: e7ee67654a659b782d0aab408a044cbc37c5cc0bf5e4653919c2c653b570e745a8f8fe780e9d1707ae64c969a850e6636d4d735299a02e154d4b028f87758087
6
+ metadata.gz: 6d8a77b3e18db85ad73f9e51b6fe3040351e38c78b04ad547c0743e8d5c55c211f7ad37ba58801d0e56fdec1ad0773111755d62bd70bf90f00fe070e0bf73991
7
+ data.tar.gz: fc4fb16340ea22b972dc640f3e0dbcfc1a73905cc9cdbbfad4f4dc11f4efb6adf30a694eb7305832453ee74a8a3a0e2e48564367532041b6d054dce74864c847
data/History.md CHANGED
@@ -6,6 +6,11 @@
6
6
  * Bugfixes
7
7
  * Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
8
8
 
9
+ ## 5.0.2 / 2020-09-28
10
+
11
+ * Bugfixes
12
+ * Reverted API changes to Server.
13
+
9
14
  ## 5.0.1 / 2020-09-28
10
15
 
11
16
  * Bugfixes
@@ -33,12 +33,12 @@ static void snake_upcase_char(char *c)
33
33
  /** Machine **/
34
34
 
35
35
 
36
- #line 81 "ext/puma_http11/http11_parser.rl"
36
+ #line 79 "ext/puma_http11/http11_parser.rl"
37
37
 
38
38
 
39
39
  /** Data **/
40
40
 
41
- #line 42 "ext/puma_http11/http11_parser.c"
41
+ #line 40 "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;
@@ -46,17 +46,17 @@ static const int puma_parser_error = 0;
46
46
  static const int puma_parser_en_main = 1;
47
47
 
48
48
 
49
- #line 85 "ext/puma_http11/http11_parser.rl"
49
+ #line 83 "ext/puma_http11/http11_parser.rl"
50
50
 
51
51
  int puma_parser_init(puma_parser *parser) {
52
52
  int cs = 0;
53
53
 
54
- #line 55 "ext/puma_http11/http11_parser.c"
54
+ #line 53 "ext/puma_http11/http11_parser.c"
55
55
  {
56
56
  cs = puma_parser_start;
57
57
  }
58
58
 
59
- #line 89 "ext/puma_http11/http11_parser.rl"
59
+ #line 87 "ext/puma_http11/http11_parser.rl"
60
60
  parser->cs = cs;
61
61
  parser->body_start = 0;
62
62
  parser->content_len = 0;
@@ -85,7 +85,7 @@ size_t puma_parser_execute(puma_parser *parser, const char *buffer, size_t len,
85
85
  assert((size_t) (pe - p) == len - off && "pointers aren't same distance");
86
86
 
87
87
 
88
- #line 89 "ext/puma_http11/http11_parser.c"
88
+ #line 87 "ext/puma_http11/http11_parser.c"
89
89
  {
90
90
  if ( p == pe )
91
91
  goto _test_eof;
@@ -109,14 +109,14 @@ st0:
109
109
  cs = 0;
110
110
  goto _out;
111
111
  tr0:
112
- #line 37 "ext/puma_http11/http11_parser.rl"
112
+ #line 35 "ext/puma_http11/http11_parser.rl"
113
113
  { MARK(mark, p); }
114
114
  goto st2;
115
115
  st2:
116
116
  if ( ++p == pe )
117
117
  goto _test_eof2;
118
118
  case 2:
119
- #line 120 "ext/puma_http11/http11_parser.c"
119
+ #line 118 "ext/puma_http11/http11_parser.c"
120
120
  switch( (*p) ) {
121
121
  case 32: goto tr2;
122
122
  case 36: goto st27;
@@ -132,7 +132,7 @@ case 2:
132
132
  goto st27;
133
133
  goto st0;
134
134
  tr2:
135
- #line 50 "ext/puma_http11/http11_parser.rl"
135
+ #line 48 "ext/puma_http11/http11_parser.rl"
136
136
  {
137
137
  parser->request_method(parser, PTR_TO(mark), LEN(mark, p));
138
138
  }
@@ -141,7 +141,7 @@ st3:
141
141
  if ( ++p == pe )
142
142
  goto _test_eof3;
143
143
  case 3:
144
- #line 145 "ext/puma_http11/http11_parser.c"
144
+ #line 143 "ext/puma_http11/http11_parser.c"
145
145
  switch( (*p) ) {
146
146
  case 42: goto tr4;
147
147
  case 43: goto tr5;
@@ -158,67 +158,67 @@ case 3:
158
158
  goto tr5;
159
159
  goto st0;
160
160
  tr4:
161
- #line 37 "ext/puma_http11/http11_parser.rl"
161
+ #line 35 "ext/puma_http11/http11_parser.rl"
162
162
  { MARK(mark, p); }
163
163
  goto st4;
164
164
  st4:
165
165
  if ( ++p == pe )
166
166
  goto _test_eof4;
167
167
  case 4:
168
- #line 169 "ext/puma_http11/http11_parser.c"
168
+ #line 167 "ext/puma_http11/http11_parser.c"
169
169
  switch( (*p) ) {
170
170
  case 32: goto tr8;
171
171
  case 35: goto tr9;
172
172
  }
173
173
  goto st0;
174
174
  tr8:
175
- #line 53 "ext/puma_http11/http11_parser.rl"
175
+ #line 51 "ext/puma_http11/http11_parser.rl"
176
176
  {
177
177
  parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
178
178
  }
179
179
  goto st5;
180
180
  tr31:
181
- #line 37 "ext/puma_http11/http11_parser.rl"
181
+ #line 35 "ext/puma_http11/http11_parser.rl"
182
182
  { MARK(mark, p); }
183
- #line 56 "ext/puma_http11/http11_parser.rl"
183
+ #line 54 "ext/puma_http11/http11_parser.rl"
184
184
  {
185
185
  parser->fragment(parser, PTR_TO(mark), LEN(mark, p));
186
186
  }
187
187
  goto st5;
188
188
  tr33:
189
- #line 56 "ext/puma_http11/http11_parser.rl"
189
+ #line 54 "ext/puma_http11/http11_parser.rl"
190
190
  {
191
191
  parser->fragment(parser, PTR_TO(mark), LEN(mark, p));
192
192
  }
193
193
  goto st5;
194
194
  tr37:
195
- #line 69 "ext/puma_http11/http11_parser.rl"
195
+ #line 67 "ext/puma_http11/http11_parser.rl"
196
196
  {
197
197
  parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
198
198
  }
199
- #line 53 "ext/puma_http11/http11_parser.rl"
199
+ #line 51 "ext/puma_http11/http11_parser.rl"
200
200
  {
201
201
  parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
202
202
  }
203
203
  goto st5;
204
204
  tr41:
205
- #line 60 "ext/puma_http11/http11_parser.rl"
205
+ #line 58 "ext/puma_http11/http11_parser.rl"
206
206
  { MARK(query_start, p); }
207
- #line 61 "ext/puma_http11/http11_parser.rl"
207
+ #line 59 "ext/puma_http11/http11_parser.rl"
208
208
  {
209
209
  parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
210
210
  }
211
- #line 53 "ext/puma_http11/http11_parser.rl"
211
+ #line 51 "ext/puma_http11/http11_parser.rl"
212
212
  {
213
213
  parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
214
214
  }
215
215
  goto st5;
216
216
  tr44:
217
- #line 61 "ext/puma_http11/http11_parser.rl"
217
+ #line 59 "ext/puma_http11/http11_parser.rl"
218
218
  {
219
219
  parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
220
220
  }
221
- #line 53 "ext/puma_http11/http11_parser.rl"
221
+ #line 51 "ext/puma_http11/http11_parser.rl"
222
222
  {
223
223
  parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
224
224
  }
@@ -227,19 +227,19 @@ st5:
227
227
  if ( ++p == pe )
228
228
  goto _test_eof5;
229
229
  case 5:
230
- #line 231 "ext/puma_http11/http11_parser.c"
230
+ #line 229 "ext/puma_http11/http11_parser.c"
231
231
  if ( (*p) == 72 )
232
232
  goto tr10;
233
233
  goto st0;
234
234
  tr10:
235
- #line 37 "ext/puma_http11/http11_parser.rl"
235
+ #line 35 "ext/puma_http11/http11_parser.rl"
236
236
  { MARK(mark, p); }
237
237
  goto st6;
238
238
  st6:
239
239
  if ( ++p == pe )
240
240
  goto _test_eof6;
241
241
  case 6:
242
- #line 243 "ext/puma_http11/http11_parser.c"
242
+ #line 241 "ext/puma_http11/http11_parser.c"
243
243
  if ( (*p) == 84 )
244
244
  goto st7;
245
245
  goto st0;
@@ -297,21 +297,21 @@ case 13:
297
297
  goto st13;
298
298
  goto st0;
299
299
  tr18:
300
- #line 65 "ext/puma_http11/http11_parser.rl"
300
+ #line 63 "ext/puma_http11/http11_parser.rl"
301
301
  {
302
302
  parser->http_version(parser, PTR_TO(mark), LEN(mark, p));
303
303
  }
304
304
  goto st14;
305
305
  tr26:
306
- #line 46 "ext/puma_http11/http11_parser.rl"
306
+ #line 44 "ext/puma_http11/http11_parser.rl"
307
307
  { MARK(mark, p); }
308
- #line 47 "ext/puma_http11/http11_parser.rl"
308
+ #line 45 "ext/puma_http11/http11_parser.rl"
309
309
  {
310
310
  parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
311
311
  }
312
312
  goto st14;
313
313
  tr29:
314
- #line 47 "ext/puma_http11/http11_parser.rl"
314
+ #line 45 "ext/puma_http11/http11_parser.rl"
315
315
  {
316
316
  parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
317
317
  }
@@ -320,7 +320,7 @@ st14:
320
320
  if ( ++p == pe )
321
321
  goto _test_eof14;
322
322
  case 14:
323
- #line 324 "ext/puma_http11/http11_parser.c"
323
+ #line 322 "ext/puma_http11/http11_parser.c"
324
324
  if ( (*p) == 10 )
325
325
  goto st15;
326
326
  goto st0;
@@ -360,7 +360,7 @@ case 16:
360
360
  goto tr22;
361
361
  goto st0;
362
362
  tr22:
363
- #line 73 "ext/puma_http11/http11_parser.rl"
363
+ #line 71 "ext/puma_http11/http11_parser.rl"
364
364
  {
365
365
  parser->body_start = p - buffer + 1;
366
366
  parser->header_done(parser, p + 1, pe - p - 1);
@@ -371,23 +371,23 @@ st46:
371
371
  if ( ++p == pe )
372
372
  goto _test_eof46;
373
373
  case 46:
374
- #line 375 "ext/puma_http11/http11_parser.c"
374
+ #line 373 "ext/puma_http11/http11_parser.c"
375
375
  goto st0;
376
376
  tr21:
377
- #line 40 "ext/puma_http11/http11_parser.rl"
377
+ #line 38 "ext/puma_http11/http11_parser.rl"
378
378
  { MARK(field_start, p); }
379
- #line 41 "ext/puma_http11/http11_parser.rl"
379
+ #line 39 "ext/puma_http11/http11_parser.rl"
380
380
  { snake_upcase_char((char *)p); }
381
381
  goto st17;
382
382
  tr23:
383
- #line 41 "ext/puma_http11/http11_parser.rl"
383
+ #line 39 "ext/puma_http11/http11_parser.rl"
384
384
  { snake_upcase_char((char *)p); }
385
385
  goto st17;
386
386
  st17:
387
387
  if ( ++p == pe )
388
388
  goto _test_eof17;
389
389
  case 17:
390
- #line 391 "ext/puma_http11/http11_parser.c"
390
+ #line 389 "ext/puma_http11/http11_parser.c"
391
391
  switch( (*p) ) {
392
392
  case 33: goto tr23;
393
393
  case 58: goto tr24;
@@ -413,71 +413,71 @@ case 17:
413
413
  goto tr23;
414
414
  goto st0;
415
415
  tr24:
416
- #line 42 "ext/puma_http11/http11_parser.rl"
416
+ #line 40 "ext/puma_http11/http11_parser.rl"
417
417
  {
418
418
  parser->field_len = LEN(field_start, p);
419
419
  }
420
420
  goto st18;
421
421
  tr27:
422
- #line 46 "ext/puma_http11/http11_parser.rl"
422
+ #line 44 "ext/puma_http11/http11_parser.rl"
423
423
  { MARK(mark, p); }
424
424
  goto st18;
425
425
  st18:
426
426
  if ( ++p == pe )
427
427
  goto _test_eof18;
428
428
  case 18:
429
- #line 430 "ext/puma_http11/http11_parser.c"
429
+ #line 428 "ext/puma_http11/http11_parser.c"
430
430
  switch( (*p) ) {
431
431
  case 13: goto tr26;
432
432
  case 32: goto tr27;
433
433
  }
434
434
  goto tr25;
435
435
  tr25:
436
- #line 46 "ext/puma_http11/http11_parser.rl"
436
+ #line 44 "ext/puma_http11/http11_parser.rl"
437
437
  { MARK(mark, p); }
438
438
  goto st19;
439
439
  st19:
440
440
  if ( ++p == pe )
441
441
  goto _test_eof19;
442
442
  case 19:
443
- #line 444 "ext/puma_http11/http11_parser.c"
443
+ #line 442 "ext/puma_http11/http11_parser.c"
444
444
  if ( (*p) == 13 )
445
445
  goto tr29;
446
446
  goto st19;
447
447
  tr9:
448
- #line 53 "ext/puma_http11/http11_parser.rl"
448
+ #line 51 "ext/puma_http11/http11_parser.rl"
449
449
  {
450
450
  parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
451
451
  }
452
452
  goto st20;
453
453
  tr38:
454
- #line 69 "ext/puma_http11/http11_parser.rl"
454
+ #line 67 "ext/puma_http11/http11_parser.rl"
455
455
  {
456
456
  parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
457
457
  }
458
- #line 53 "ext/puma_http11/http11_parser.rl"
458
+ #line 51 "ext/puma_http11/http11_parser.rl"
459
459
  {
460
460
  parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
461
461
  }
462
462
  goto st20;
463
463
  tr42:
464
- #line 60 "ext/puma_http11/http11_parser.rl"
464
+ #line 58 "ext/puma_http11/http11_parser.rl"
465
465
  { MARK(query_start, p); }
466
- #line 61 "ext/puma_http11/http11_parser.rl"
466
+ #line 59 "ext/puma_http11/http11_parser.rl"
467
467
  {
468
468
  parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
469
469
  }
470
- #line 53 "ext/puma_http11/http11_parser.rl"
470
+ #line 51 "ext/puma_http11/http11_parser.rl"
471
471
  {
472
472
  parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
473
473
  }
474
474
  goto st20;
475
475
  tr45:
476
- #line 61 "ext/puma_http11/http11_parser.rl"
476
+ #line 59 "ext/puma_http11/http11_parser.rl"
477
477
  {
478
478
  parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
479
479
  }
480
- #line 53 "ext/puma_http11/http11_parser.rl"
480
+ #line 51 "ext/puma_http11/http11_parser.rl"
481
481
  {
482
482
  parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
483
483
  }
@@ -486,7 +486,7 @@ st20:
486
486
  if ( ++p == pe )
487
487
  goto _test_eof20;
488
488
  case 20:
489
- #line 490 "ext/puma_http11/http11_parser.c"
489
+ #line 488 "ext/puma_http11/http11_parser.c"
490
490
  switch( (*p) ) {
491
491
  case 32: goto tr31;
492
492
  case 60: goto st0;
@@ -500,14 +500,14 @@ case 20:
500
500
  goto st0;
501
501
  goto tr30;
502
502
  tr30:
503
- #line 37 "ext/puma_http11/http11_parser.rl"
503
+ #line 35 "ext/puma_http11/http11_parser.rl"
504
504
  { MARK(mark, p); }
505
505
  goto st21;
506
506
  st21:
507
507
  if ( ++p == pe )
508
508
  goto _test_eof21;
509
509
  case 21:
510
- #line 511 "ext/puma_http11/http11_parser.c"
510
+ #line 509 "ext/puma_http11/http11_parser.c"
511
511
  switch( (*p) ) {
512
512
  case 32: goto tr33;
513
513
  case 60: goto st0;
@@ -521,14 +521,14 @@ case 21:
521
521
  goto st0;
522
522
  goto st21;
523
523
  tr5:
524
- #line 37 "ext/puma_http11/http11_parser.rl"
524
+ #line 35 "ext/puma_http11/http11_parser.rl"
525
525
  { MARK(mark, p); }
526
526
  goto st22;
527
527
  st22:
528
528
  if ( ++p == pe )
529
529
  goto _test_eof22;
530
530
  case 22:
531
- #line 532 "ext/puma_http11/http11_parser.c"
531
+ #line 530 "ext/puma_http11/http11_parser.c"
532
532
  switch( (*p) ) {
533
533
  case 43: goto st22;
534
534
  case 58: goto st23;
@@ -546,14 +546,14 @@ case 22:
546
546
  goto st22;
547
547
  goto st0;
548
548
  tr7:
549
- #line 37 "ext/puma_http11/http11_parser.rl"
549
+ #line 35 "ext/puma_http11/http11_parser.rl"
550
550
  { MARK(mark, p); }
551
551
  goto st23;
552
552
  st23:
553
553
  if ( ++p == pe )
554
554
  goto _test_eof23;
555
555
  case 23:
556
- #line 557 "ext/puma_http11/http11_parser.c"
556
+ #line 555 "ext/puma_http11/http11_parser.c"
557
557
  switch( (*p) ) {
558
558
  case 32: goto tr8;
559
559
  case 34: goto st0;
@@ -566,14 +566,14 @@ case 23:
566
566
  goto st0;
567
567
  goto st23;
568
568
  tr6:
569
- #line 37 "ext/puma_http11/http11_parser.rl"
569
+ #line 35 "ext/puma_http11/http11_parser.rl"
570
570
  { MARK(mark, p); }
571
571
  goto st24;
572
572
  st24:
573
573
  if ( ++p == pe )
574
574
  goto _test_eof24;
575
575
  case 24:
576
- #line 577 "ext/puma_http11/http11_parser.c"
576
+ #line 575 "ext/puma_http11/http11_parser.c"
577
577
  switch( (*p) ) {
578
578
  case 32: goto tr37;
579
579
  case 34: goto st0;
@@ -587,7 +587,7 @@ case 24:
587
587
  goto st0;
588
588
  goto st24;
589
589
  tr39:
590
- #line 69 "ext/puma_http11/http11_parser.rl"
590
+ #line 67 "ext/puma_http11/http11_parser.rl"
591
591
  {
592
592
  parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
593
593
  }
@@ -596,7 +596,7 @@ st25:
596
596
  if ( ++p == pe )
597
597
  goto _test_eof25;
598
598
  case 25:
599
- #line 600 "ext/puma_http11/http11_parser.c"
599
+ #line 598 "ext/puma_http11/http11_parser.c"
600
600
  switch( (*p) ) {
601
601
  case 32: goto tr41;
602
602
  case 34: goto st0;
@@ -609,14 +609,14 @@ case 25:
609
609
  goto st0;
610
610
  goto tr40;
611
611
  tr40:
612
- #line 60 "ext/puma_http11/http11_parser.rl"
612
+ #line 58 "ext/puma_http11/http11_parser.rl"
613
613
  { MARK(query_start, p); }
614
614
  goto st26;
615
615
  st26:
616
616
  if ( ++p == pe )
617
617
  goto _test_eof26;
618
618
  case 26:
619
- #line 620 "ext/puma_http11/http11_parser.c"
619
+ #line 618 "ext/puma_http11/http11_parser.c"
620
620
  switch( (*p) ) {
621
621
  case 32: goto tr44;
622
622
  case 34: goto st0;
@@ -1010,7 +1010,7 @@ case 45:
1010
1010
  _out: {}
1011
1011
  }
1012
1012
 
1013
- #line 117 "ext/puma_http11/http11_parser.rl"
1013
+ #line 115 "ext/puma_http11/http11_parser.rl"
1014
1014
 
1015
1015
  if (!puma_parser_has_error(parser))
1016
1016
  parser->cs = cs;
@@ -100,7 +100,7 @@ module Puma
100
100
  # too taxing on performance.
101
101
  module Const
102
102
 
103
- PUMA_VERSION = VERSION = "5.0.1".freeze
103
+ PUMA_VERSION = VERSION = "5.0.2".freeze
104
104
  CODE_NAME = "Spoony Bard".freeze
105
105
 
106
106
  PUMA_SERVER_STRING = ['puma', PUMA_VERSION, CODE_NAME].join(' ').freeze
@@ -54,8 +54,9 @@ module Puma
54
54
 
55
55
  app = Puma::App::Status.new @launcher, token
56
56
 
57
- control = Puma::Server.new app, @launcher.events,
58
- { min_threads: 0, max_threads: 1 }
57
+ control = Puma::Server.new app, @launcher.events
58
+ control.min_threads = 0
59
+ control.max_threads = 1
59
60
 
60
61
  control.binder.parse [str], self, 'Starting control server'
61
62
 
@@ -68,7 +69,6 @@ module Puma
68
69
  @control.binder.close_listeners if @control
69
70
  end
70
71
 
71
- # @!attribute [r] ruby_engine
72
72
  def ruby_engine
73
73
  if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby"
74
74
  "ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
@@ -137,14 +137,27 @@ module Puma
137
137
  @launcher.binder.parse @options[:binds], self
138
138
  end
139
139
 
140
- # @!attribute [r] app
141
140
  def app
142
141
  @app ||= @launcher.config.app
143
142
  end
144
143
 
145
144
  def start_server
145
+ min_t = @options[:min_threads]
146
+ max_t = @options[:max_threads]
147
+
146
148
  server = Puma::Server.new app, @launcher.events, @options
149
+ server.min_threads = min_t
150
+ server.max_threads = max_t
147
151
  server.inherit_binder @launcher.binder
152
+
153
+ if @options[:early_hints]
154
+ server.early_hints = true
155
+ end
156
+
157
+ unless development? || test?
158
+ server.leak_stack_on_error = false
159
+ end
160
+
148
161
  server
149
162
  end
150
163
  end
@@ -34,21 +34,15 @@ module Puma
34
34
 
35
35
  attr_reader :thread
36
36
  attr_reader :events
37
- attr_reader :min_threads, :max_threads # for #stats
38
- attr_reader :requests_count # @version 5.0.0
39
-
40
- # the following may be deprecated in the future
41
- attr_reader :auto_trim_time
42
- attr_reader :first_data_timeout
43
- attr_reader :persistent_timeout
44
- attr_reader :reaping_time
45
-
37
+ attr_reader :requests_count # @version 5.0.0
46
38
  attr_accessor :app
47
- attr_accessor :binder
48
39
 
49
- def_delegators :@binder, :add_tcp_listener, :add_ssl_listener, :add_unix_listener, :connected_ports
50
-
51
- ThreadLocalKey = :puma_server
40
+ attr_accessor :min_threads
41
+ attr_accessor :max_threads
42
+ attr_accessor :persistent_timeout
43
+ attr_accessor :auto_trim_time
44
+ attr_accessor :reaping_time
45
+ attr_accessor :first_data_timeout
52
46
 
53
47
  # Create a server for the rack app +app+.
54
48
  #
@@ -58,10 +52,6 @@ module Puma
58
52
  # Server#run returns a thread that you can join on to wait for the server
59
53
  # to do its work.
60
54
  #
61
- # @note Several instance variables exist so they are available for testing,
62
- # and have default values set via +fetch+. Normally the values are set via
63
- # `::Puma::Configuration.puma_default_options`.
64
- #
65
55
  def initialize(app, events=Events.stdio, options={})
66
56
  @app = app
67
57
  @events = events
@@ -69,24 +59,24 @@ module Puma
69
59
  @check, @notify = nil
70
60
  @status = :stop
71
61
 
62
+ @min_threads = 0
63
+ @max_threads = 16
72
64
  @auto_trim_time = 30
73
65
  @reaping_time = 1
74
66
 
75
67
  @thread = nil
76
68
  @thread_pool = nil
69
+ @early_hints = nil
77
70
 
78
- @options = options
71
+ @persistent_timeout = options.fetch(:persistent_timeout, PERSISTENT_TIMEOUT)
72
+ @first_data_timeout = options.fetch(:first_data_timeout, FIRST_DATA_TIMEOUT)
79
73
 
80
- @early_hints = options.fetch :early_hints, nil
81
- @first_data_timeout = options.fetch :first_data_timeout, FIRST_DATA_TIMEOUT
82
- @min_threads = options.fetch :min_threads, 0
83
- @max_threads = options.fetch :max_threads , (Puma.mri? ? 5 : 16)
84
- @persistent_timeout = options.fetch :persistent_timeout, PERSISTENT_TIMEOUT
85
- @queue_requests = options.fetch :queue_requests, true
74
+ @binder = Binder.new(events)
86
75
 
87
- @leak_stack_on_error = !!(@options[:environment] =~ /\A(development|test)\z/)
76
+ @leak_stack_on_error = true
88
77
 
89
- @binder = Binder.new(events)
78
+ @options = options
79
+ @queue_requests = options[:queue_requests].nil? ? true : options[:queue_requests]
90
80
 
91
81
  ENV['RACK_ENV'] ||= "development"
92
82
 
@@ -99,16 +89,15 @@ module Puma
99
89
  @shutdown_mutex = Mutex.new
100
90
  end
101
91
 
92
+ attr_accessor :binder, :leak_stack_on_error, :early_hints
93
+
94
+ def_delegators :@binder, :add_tcp_listener, :add_ssl_listener, :add_unix_listener, :connected_ports
95
+
102
96
  def inherit_binder(bind)
103
97
  @binder = bind
104
98
  end
105
99
 
106
100
  class << self
107
- # @!attribute [r] current
108
- def current
109
- Thread.current[ThreadLocalKey]
110
- end
111
-
112
101
  # :nodoc:
113
102
  # @version 5.0.0
114
103
  def tcp_cork_supported?
@@ -183,12 +172,10 @@ module Puma
183
172
  end
184
173
  end
185
174
 
186
- # @!attribute [r] backlog
187
175
  def backlog
188
176
  @thread_pool and @thread_pool.backlog
189
177
  end
190
178
 
191
- # @!attribute [r] running
192
179
  def running
193
180
  @thread_pool and @thread_pool.spawned
194
181
  end
@@ -201,7 +188,6 @@ module Puma
201
188
  # there are 5 threads sitting idle ready to take
202
189
  # a request. If one request comes in, then the
203
190
  # value would be 4 until it finishes processing.
204
- # @!attribute [r] pool_capacity
205
191
  def pool_capacity
206
192
  @thread_pool and @thread_pool.pool_capacity
207
193
  end
@@ -1012,6 +998,12 @@ module Puma
1012
998
  end
1013
999
  private :fast_write
1014
1000
 
1001
+ ThreadLocalKey = :puma_server
1002
+
1003
+ def self.current
1004
+ Thread.current[ThreadLocalKey]
1005
+ end
1006
+
1015
1007
  def shutting_down?
1016
1008
  @status == :stop || @status == :restart
1017
1009
  end
@@ -1027,7 +1019,6 @@ module Puma
1027
1019
 
1028
1020
  # Returns a hash of stats about the running server for reporting purposes.
1029
1021
  # @version 5.0.0
1030
- # @!attribute [r] stats
1031
1022
  def stats
1032
1023
  STAT_METHODS.map {|name| [name, send(name) || 0]}.to_h
1033
1024
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.0.2
5
5
  platform: java
6
6
  authors:
7
7
  - Evan Phoenix