puma 3.8.2 → 3.12.6
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 +5 -5
- data/History.md +153 -0
- data/README.md +140 -230
- data/docs/architecture.md +36 -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/plugins.md +28 -0
- data/docs/restart.md +39 -0
- data/docs/signals.md +56 -3
- data/docs/systemd.md +112 -37
- data/ext/puma_http11/http11_parser.c +87 -85
- data/ext/puma_http11/http11_parser.rl +12 -10
- data/ext/puma_http11/mini_ssl.c +31 -5
- data/ext/puma_http11/org/jruby/puma/Http11Parser.java +13 -16
- data/ext/puma_http11/org/jruby/puma/MiniSSL.java +15 -2
- data/lib/puma/app/status.rb +8 -0
- data/lib/puma/binder.rb +22 -17
- data/lib/puma/cli.rb +22 -7
- data/lib/puma/client.rb +41 -2
- data/lib/puma/cluster.rb +28 -7
- data/lib/puma/commonlogger.rb +2 -0
- data/lib/puma/configuration.rb +21 -14
- data/lib/puma/const.rb +17 -2
- data/lib/puma/control_cli.rb +16 -14
- data/lib/puma/convenient.rb +2 -0
- data/lib/puma/daemon_ext.rb +2 -0
- data/lib/puma/delegation.rb +2 -0
- data/lib/puma/detect.rb +2 -0
- data/lib/puma/dsl.rb +46 -9
- data/lib/puma/events.rb +3 -2
- data/lib/puma/io_buffer.rb +2 -0
- data/lib/puma/java_io_buffer.rb +2 -0
- data/lib/puma/jruby_restart.rb +2 -1
- data/lib/puma/launcher.rb +42 -20
- data/lib/puma/minissl.rb +67 -28
- data/lib/puma/null_io.rb +2 -0
- data/lib/puma/plugin/tmp_restart.rb +0 -1
- data/lib/puma/plugin.rb +2 -0
- data/lib/puma/rack/builder.rb +2 -1
- data/lib/puma/reactor.rb +137 -0
- data/lib/puma/runner.rb +16 -3
- data/lib/puma/server.rb +145 -29
- data/lib/puma/single.rb +14 -3
- data/lib/puma/state_file.rb +2 -0
- data/lib/puma/tcp_logger.rb +2 -0
- data/lib/puma/thread_pool.rb +55 -6
- data/lib/puma/util.rb +1 -0
- data/lib/puma.rb +8 -0
- data/lib/rack/handler/puma.rb +13 -2
- data/tools/jungle/README.md +12 -2
- data/tools/jungle/init.d/README.md +2 -0
- data/tools/jungle/init.d/puma +2 -2
- data/tools/jungle/init.d/run-puma +1 -1
- data/tools/jungle/rc.d/README.md +74 -0
- data/tools/jungle/rc.d/puma +61 -0
- data/tools/jungle/rc.d/puma.conf +10 -0
- data/tools/trickletest.rb +1 -1
- metadata +21 -95
- data/.github/issue_template.md +0 -20
- data/Gemfile +0 -12
- data/Manifest.txt +0 -78
- data/Rakefile +0 -158
- data/Release.md +0 -9
- data/gemfiles/2.1-Gemfile +0 -12
- data/puma.gemspec +0 -52
- /data/{DEPLOYMENT.md → docs/deployment.md} +0 -0
@@ -14,12 +14,14 @@
|
|
14
14
|
|
15
15
|
/*
|
16
16
|
* capitalizes all lower-case ASCII characters,
|
17
|
-
* converts dashes to underscores.
|
17
|
+
* converts dashes to underscores, and underscores to commas.
|
18
18
|
*/
|
19
19
|
static void snake_upcase_char(char *c)
|
20
20
|
{
|
21
21
|
if (*c >= 'a' && *c <= 'z')
|
22
22
|
*c &= ~0x20;
|
23
|
+
else if (*c == '_')
|
24
|
+
*c = ',';
|
23
25
|
else if (*c == '-')
|
24
26
|
*c = '_';
|
25
27
|
}
|
@@ -31,12 +33,12 @@ static void snake_upcase_char(char *c)
|
|
31
33
|
/** Machine **/
|
32
34
|
|
33
35
|
|
34
|
-
#line
|
36
|
+
#line 79 "ext/puma_http11/http11_parser.rl"
|
35
37
|
|
36
38
|
|
37
39
|
/** Data **/
|
38
40
|
|
39
|
-
#line
|
41
|
+
#line 40 "ext/puma_http11/http11_parser.c"
|
40
42
|
static const int puma_parser_start = 1;
|
41
43
|
static const int puma_parser_first_final = 47;
|
42
44
|
static const int puma_parser_error = 0;
|
@@ -44,17 +46,17 @@ static const int puma_parser_error = 0;
|
|
44
46
|
static const int puma_parser_en_main = 1;
|
45
47
|
|
46
48
|
|
47
|
-
#line
|
49
|
+
#line 83 "ext/puma_http11/http11_parser.rl"
|
48
50
|
|
49
51
|
int puma_parser_init(puma_parser *parser) {
|
50
52
|
int cs = 0;
|
51
53
|
|
52
|
-
#line
|
54
|
+
#line 53 "ext/puma_http11/http11_parser.c"
|
53
55
|
{
|
54
56
|
cs = puma_parser_start;
|
55
57
|
}
|
56
58
|
|
57
|
-
#line
|
59
|
+
#line 87 "ext/puma_http11/http11_parser.rl"
|
58
60
|
parser->cs = cs;
|
59
61
|
parser->body_start = 0;
|
60
62
|
parser->content_len = 0;
|
@@ -80,10 +82,10 @@ size_t puma_parser_execute(puma_parser *parser, const char *buffer, size_t len,
|
|
80
82
|
pe = buffer+len;
|
81
83
|
|
82
84
|
/* assert(*pe == '\0' && "pointer does not end on NUL"); */
|
83
|
-
assert(pe - p == len - off && "pointers aren't same distance");
|
85
|
+
assert((size_t) (pe - p) == len - off && "pointers aren't same distance");
|
84
86
|
|
85
87
|
|
86
|
-
#line
|
88
|
+
#line 87 "ext/puma_http11/http11_parser.c"
|
87
89
|
{
|
88
90
|
if ( p == pe )
|
89
91
|
goto _test_eof;
|
@@ -107,14 +109,14 @@ st0:
|
|
107
109
|
cs = 0;
|
108
110
|
goto _out;
|
109
111
|
tr0:
|
110
|
-
#line
|
112
|
+
#line 35 "ext/puma_http11/http11_parser.rl"
|
111
113
|
{ MARK(mark, p); }
|
112
114
|
goto st2;
|
113
115
|
st2:
|
114
116
|
if ( ++p == pe )
|
115
117
|
goto _test_eof2;
|
116
118
|
case 2:
|
117
|
-
#line
|
119
|
+
#line 118 "ext/puma_http11/http11_parser.c"
|
118
120
|
switch( (*p) ) {
|
119
121
|
case 32: goto tr2;
|
120
122
|
case 36: goto st28;
|
@@ -130,8 +132,8 @@ case 2:
|
|
130
132
|
goto st28;
|
131
133
|
goto st0;
|
132
134
|
tr2:
|
133
|
-
#line
|
134
|
-
{
|
135
|
+
#line 48 "ext/puma_http11/http11_parser.rl"
|
136
|
+
{
|
135
137
|
parser->request_method(parser, PTR_TO(mark), LEN(mark, p));
|
136
138
|
}
|
137
139
|
goto st3;
|
@@ -139,7 +141,7 @@ st3:
|
|
139
141
|
if ( ++p == pe )
|
140
142
|
goto _test_eof3;
|
141
143
|
case 3:
|
142
|
-
#line
|
144
|
+
#line 143 "ext/puma_http11/http11_parser.c"
|
143
145
|
switch( (*p) ) {
|
144
146
|
case 42: goto tr4;
|
145
147
|
case 43: goto tr5;
|
@@ -156,68 +158,68 @@ case 3:
|
|
156
158
|
goto tr5;
|
157
159
|
goto st0;
|
158
160
|
tr4:
|
159
|
-
#line
|
161
|
+
#line 35 "ext/puma_http11/http11_parser.rl"
|
160
162
|
{ MARK(mark, p); }
|
161
163
|
goto st4;
|
162
164
|
st4:
|
163
165
|
if ( ++p == pe )
|
164
166
|
goto _test_eof4;
|
165
167
|
case 4:
|
166
|
-
#line
|
168
|
+
#line 167 "ext/puma_http11/http11_parser.c"
|
167
169
|
switch( (*p) ) {
|
168
170
|
case 32: goto tr8;
|
169
171
|
case 35: goto tr9;
|
170
172
|
}
|
171
173
|
goto st0;
|
172
174
|
tr8:
|
173
|
-
#line
|
174
|
-
{
|
175
|
+
#line 51 "ext/puma_http11/http11_parser.rl"
|
176
|
+
{
|
175
177
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
176
178
|
}
|
177
179
|
goto st5;
|
178
180
|
tr31:
|
179
|
-
#line
|
181
|
+
#line 35 "ext/puma_http11/http11_parser.rl"
|
180
182
|
{ MARK(mark, p); }
|
181
|
-
#line
|
183
|
+
#line 54 "ext/puma_http11/http11_parser.rl"
|
182
184
|
{
|
183
185
|
parser->fragment(parser, PTR_TO(mark), LEN(mark, p));
|
184
186
|
}
|
185
187
|
goto st5;
|
186
188
|
tr33:
|
187
|
-
#line
|
189
|
+
#line 54 "ext/puma_http11/http11_parser.rl"
|
188
190
|
{
|
189
191
|
parser->fragment(parser, PTR_TO(mark), LEN(mark, p));
|
190
192
|
}
|
191
193
|
goto st5;
|
192
194
|
tr37:
|
193
|
-
#line
|
195
|
+
#line 67 "ext/puma_http11/http11_parser.rl"
|
194
196
|
{
|
195
197
|
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
|
196
198
|
}
|
197
|
-
#line
|
198
|
-
{
|
199
|
+
#line 51 "ext/puma_http11/http11_parser.rl"
|
200
|
+
{
|
199
201
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
200
202
|
}
|
201
203
|
goto st5;
|
202
204
|
tr44:
|
203
|
-
#line 57 "ext/puma_http11/http11_parser.rl"
|
204
|
-
{ MARK(query_start, p); }
|
205
205
|
#line 58 "ext/puma_http11/http11_parser.rl"
|
206
|
-
{
|
206
|
+
{ MARK(query_start, p); }
|
207
|
+
#line 59 "ext/puma_http11/http11_parser.rl"
|
208
|
+
{
|
207
209
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
208
210
|
}
|
209
|
-
#line
|
210
|
-
{
|
211
|
+
#line 51 "ext/puma_http11/http11_parser.rl"
|
212
|
+
{
|
211
213
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
212
214
|
}
|
213
215
|
goto st5;
|
214
216
|
tr47:
|
215
|
-
#line
|
216
|
-
{
|
217
|
+
#line 59 "ext/puma_http11/http11_parser.rl"
|
218
|
+
{
|
217
219
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
218
220
|
}
|
219
|
-
#line
|
220
|
-
{
|
221
|
+
#line 51 "ext/puma_http11/http11_parser.rl"
|
222
|
+
{
|
221
223
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
222
224
|
}
|
223
225
|
goto st5;
|
@@ -225,19 +227,19 @@ st5:
|
|
225
227
|
if ( ++p == pe )
|
226
228
|
goto _test_eof5;
|
227
229
|
case 5:
|
228
|
-
#line
|
230
|
+
#line 229 "ext/puma_http11/http11_parser.c"
|
229
231
|
if ( (*p) == 72 )
|
230
232
|
goto tr10;
|
231
233
|
goto st0;
|
232
234
|
tr10:
|
233
|
-
#line
|
235
|
+
#line 35 "ext/puma_http11/http11_parser.rl"
|
234
236
|
{ MARK(mark, p); }
|
235
237
|
goto st6;
|
236
238
|
st6:
|
237
239
|
if ( ++p == pe )
|
238
240
|
goto _test_eof6;
|
239
241
|
case 6:
|
240
|
-
#line
|
242
|
+
#line 241 "ext/puma_http11/http11_parser.c"
|
241
243
|
if ( (*p) == 84 )
|
242
244
|
goto st7;
|
243
245
|
goto st0;
|
@@ -295,21 +297,21 @@ case 13:
|
|
295
297
|
goto st13;
|
296
298
|
goto st0;
|
297
299
|
tr18:
|
298
|
-
#line
|
299
|
-
{
|
300
|
+
#line 63 "ext/puma_http11/http11_parser.rl"
|
301
|
+
{
|
300
302
|
parser->http_version(parser, PTR_TO(mark), LEN(mark, p));
|
301
303
|
}
|
302
304
|
goto st14;
|
303
305
|
tr26:
|
304
|
-
#line 43 "ext/puma_http11/http11_parser.rl"
|
305
|
-
{ MARK(mark, p); }
|
306
306
|
#line 44 "ext/puma_http11/http11_parser.rl"
|
307
|
+
{ MARK(mark, p); }
|
308
|
+
#line 45 "ext/puma_http11/http11_parser.rl"
|
307
309
|
{
|
308
310
|
parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
309
311
|
}
|
310
312
|
goto st14;
|
311
313
|
tr29:
|
312
|
-
#line
|
314
|
+
#line 45 "ext/puma_http11/http11_parser.rl"
|
313
315
|
{
|
314
316
|
parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
315
317
|
}
|
@@ -318,7 +320,7 @@ st14:
|
|
318
320
|
if ( ++p == pe )
|
319
321
|
goto _test_eof14;
|
320
322
|
case 14:
|
321
|
-
#line
|
323
|
+
#line 322 "ext/puma_http11/http11_parser.c"
|
322
324
|
if ( (*p) == 10 )
|
323
325
|
goto st15;
|
324
326
|
goto st0;
|
@@ -358,9 +360,9 @@ case 16:
|
|
358
360
|
goto tr22;
|
359
361
|
goto st0;
|
360
362
|
tr22:
|
361
|
-
#line
|
362
|
-
{
|
363
|
-
parser->body_start = p - buffer + 1;
|
363
|
+
#line 71 "ext/puma_http11/http11_parser.rl"
|
364
|
+
{
|
365
|
+
parser->body_start = p - buffer + 1;
|
364
366
|
parser->header_done(parser, p + 1, pe - p - 1);
|
365
367
|
{p++; cs = 47; goto _out;}
|
366
368
|
}
|
@@ -369,23 +371,23 @@ st47:
|
|
369
371
|
if ( ++p == pe )
|
370
372
|
goto _test_eof47;
|
371
373
|
case 47:
|
372
|
-
#line
|
374
|
+
#line 373 "ext/puma_http11/http11_parser.c"
|
373
375
|
goto st0;
|
374
376
|
tr21:
|
375
|
-
#line 37 "ext/puma_http11/http11_parser.rl"
|
376
|
-
{ MARK(field_start, p); }
|
377
377
|
#line 38 "ext/puma_http11/http11_parser.rl"
|
378
|
+
{ MARK(field_start, p); }
|
379
|
+
#line 39 "ext/puma_http11/http11_parser.rl"
|
378
380
|
{ snake_upcase_char((char *)p); }
|
379
381
|
goto st17;
|
380
382
|
tr23:
|
381
|
-
#line
|
383
|
+
#line 39 "ext/puma_http11/http11_parser.rl"
|
382
384
|
{ snake_upcase_char((char *)p); }
|
383
385
|
goto st17;
|
384
386
|
st17:
|
385
387
|
if ( ++p == pe )
|
386
388
|
goto _test_eof17;
|
387
389
|
case 17:
|
388
|
-
#line
|
390
|
+
#line 389 "ext/puma_http11/http11_parser.c"
|
389
391
|
switch( (*p) ) {
|
390
392
|
case 33: goto tr23;
|
391
393
|
case 58: goto tr24;
|
@@ -411,72 +413,72 @@ case 17:
|
|
411
413
|
goto tr23;
|
412
414
|
goto st0;
|
413
415
|
tr24:
|
414
|
-
#line
|
415
|
-
{
|
416
|
+
#line 40 "ext/puma_http11/http11_parser.rl"
|
417
|
+
{
|
416
418
|
parser->field_len = LEN(field_start, p);
|
417
419
|
}
|
418
420
|
goto st18;
|
419
421
|
tr27:
|
420
|
-
#line
|
422
|
+
#line 44 "ext/puma_http11/http11_parser.rl"
|
421
423
|
{ MARK(mark, p); }
|
422
424
|
goto st18;
|
423
425
|
st18:
|
424
426
|
if ( ++p == pe )
|
425
427
|
goto _test_eof18;
|
426
428
|
case 18:
|
427
|
-
#line
|
429
|
+
#line 428 "ext/puma_http11/http11_parser.c"
|
428
430
|
switch( (*p) ) {
|
429
431
|
case 13: goto tr26;
|
430
432
|
case 32: goto tr27;
|
431
433
|
}
|
432
434
|
goto tr25;
|
433
435
|
tr25:
|
434
|
-
#line
|
436
|
+
#line 44 "ext/puma_http11/http11_parser.rl"
|
435
437
|
{ MARK(mark, p); }
|
436
438
|
goto st19;
|
437
439
|
st19:
|
438
440
|
if ( ++p == pe )
|
439
441
|
goto _test_eof19;
|
440
442
|
case 19:
|
441
|
-
#line
|
443
|
+
#line 442 "ext/puma_http11/http11_parser.c"
|
442
444
|
if ( (*p) == 13 )
|
443
445
|
goto tr29;
|
444
446
|
goto st19;
|
445
447
|
tr9:
|
446
|
-
#line
|
447
|
-
{
|
448
|
+
#line 51 "ext/puma_http11/http11_parser.rl"
|
449
|
+
{
|
448
450
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
449
451
|
}
|
450
452
|
goto st20;
|
451
453
|
tr38:
|
452
|
-
#line
|
454
|
+
#line 67 "ext/puma_http11/http11_parser.rl"
|
453
455
|
{
|
454
456
|
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
|
455
457
|
}
|
456
|
-
#line
|
457
|
-
{
|
458
|
+
#line 51 "ext/puma_http11/http11_parser.rl"
|
459
|
+
{
|
458
460
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
459
461
|
}
|
460
462
|
goto st20;
|
461
463
|
tr45:
|
462
|
-
#line 57 "ext/puma_http11/http11_parser.rl"
|
463
|
-
{ MARK(query_start, p); }
|
464
464
|
#line 58 "ext/puma_http11/http11_parser.rl"
|
465
|
-
{
|
465
|
+
{ MARK(query_start, p); }
|
466
|
+
#line 59 "ext/puma_http11/http11_parser.rl"
|
467
|
+
{
|
466
468
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
467
469
|
}
|
468
|
-
#line
|
469
|
-
{
|
470
|
+
#line 51 "ext/puma_http11/http11_parser.rl"
|
471
|
+
{
|
470
472
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
471
473
|
}
|
472
474
|
goto st20;
|
473
475
|
tr48:
|
474
|
-
#line
|
475
|
-
{
|
476
|
+
#line 59 "ext/puma_http11/http11_parser.rl"
|
477
|
+
{
|
476
478
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
|
477
479
|
}
|
478
|
-
#line
|
479
|
-
{
|
480
|
+
#line 51 "ext/puma_http11/http11_parser.rl"
|
481
|
+
{
|
480
482
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
|
481
483
|
}
|
482
484
|
goto st20;
|
@@ -484,7 +486,7 @@ st20:
|
|
484
486
|
if ( ++p == pe )
|
485
487
|
goto _test_eof20;
|
486
488
|
case 20:
|
487
|
-
#line
|
489
|
+
#line 488 "ext/puma_http11/http11_parser.c"
|
488
490
|
switch( (*p) ) {
|
489
491
|
case 32: goto tr31;
|
490
492
|
case 60: goto st0;
|
@@ -498,14 +500,14 @@ case 20:
|
|
498
500
|
goto st0;
|
499
501
|
goto tr30;
|
500
502
|
tr30:
|
501
|
-
#line
|
503
|
+
#line 35 "ext/puma_http11/http11_parser.rl"
|
502
504
|
{ MARK(mark, p); }
|
503
505
|
goto st21;
|
504
506
|
st21:
|
505
507
|
if ( ++p == pe )
|
506
508
|
goto _test_eof21;
|
507
509
|
case 21:
|
508
|
-
#line
|
510
|
+
#line 509 "ext/puma_http11/http11_parser.c"
|
509
511
|
switch( (*p) ) {
|
510
512
|
case 32: goto tr33;
|
511
513
|
case 60: goto st0;
|
@@ -519,14 +521,14 @@ case 21:
|
|
519
521
|
goto st0;
|
520
522
|
goto st21;
|
521
523
|
tr5:
|
522
|
-
#line
|
524
|
+
#line 35 "ext/puma_http11/http11_parser.rl"
|
523
525
|
{ MARK(mark, p); }
|
524
526
|
goto st22;
|
525
527
|
st22:
|
526
528
|
if ( ++p == pe )
|
527
529
|
goto _test_eof22;
|
528
530
|
case 22:
|
529
|
-
#line
|
531
|
+
#line 530 "ext/puma_http11/http11_parser.c"
|
530
532
|
switch( (*p) ) {
|
531
533
|
case 43: goto st22;
|
532
534
|
case 58: goto st23;
|
@@ -544,14 +546,14 @@ case 22:
|
|
544
546
|
goto st22;
|
545
547
|
goto st0;
|
546
548
|
tr7:
|
547
|
-
#line
|
549
|
+
#line 35 "ext/puma_http11/http11_parser.rl"
|
548
550
|
{ MARK(mark, p); }
|
549
551
|
goto st23;
|
550
552
|
st23:
|
551
553
|
if ( ++p == pe )
|
552
554
|
goto _test_eof23;
|
553
555
|
case 23:
|
554
|
-
#line
|
556
|
+
#line 555 "ext/puma_http11/http11_parser.c"
|
555
557
|
switch( (*p) ) {
|
556
558
|
case 32: goto tr8;
|
557
559
|
case 34: goto st0;
|
@@ -564,14 +566,14 @@ case 23:
|
|
564
566
|
goto st0;
|
565
567
|
goto st23;
|
566
568
|
tr6:
|
567
|
-
#line
|
569
|
+
#line 35 "ext/puma_http11/http11_parser.rl"
|
568
570
|
{ MARK(mark, p); }
|
569
571
|
goto st24;
|
570
572
|
st24:
|
571
573
|
if ( ++p == pe )
|
572
574
|
goto _test_eof24;
|
573
575
|
case 24:
|
574
|
-
#line
|
576
|
+
#line 575 "ext/puma_http11/http11_parser.c"
|
575
577
|
switch( (*p) ) {
|
576
578
|
case 32: goto tr37;
|
577
579
|
case 34: goto st0;
|
@@ -586,7 +588,7 @@ case 24:
|
|
586
588
|
goto st0;
|
587
589
|
goto st24;
|
588
590
|
tr39:
|
589
|
-
#line
|
591
|
+
#line 67 "ext/puma_http11/http11_parser.rl"
|
590
592
|
{
|
591
593
|
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
|
592
594
|
}
|
@@ -595,7 +597,7 @@ st25:
|
|
595
597
|
if ( ++p == pe )
|
596
598
|
goto _test_eof25;
|
597
599
|
case 25:
|
598
|
-
#line
|
600
|
+
#line 599 "ext/puma_http11/http11_parser.c"
|
599
601
|
switch( (*p) ) {
|
600
602
|
case 32: goto tr8;
|
601
603
|
case 34: goto st0;
|
@@ -609,7 +611,7 @@ case 25:
|
|
609
611
|
goto st0;
|
610
612
|
goto st25;
|
611
613
|
tr40:
|
612
|
-
#line
|
614
|
+
#line 67 "ext/puma_http11/http11_parser.rl"
|
613
615
|
{
|
614
616
|
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
|
615
617
|
}
|
@@ -618,7 +620,7 @@ st26:
|
|
618
620
|
if ( ++p == pe )
|
619
621
|
goto _test_eof26;
|
620
622
|
case 26:
|
621
|
-
#line
|
623
|
+
#line 622 "ext/puma_http11/http11_parser.c"
|
622
624
|
switch( (*p) ) {
|
623
625
|
case 32: goto tr44;
|
624
626
|
case 34: goto st0;
|
@@ -631,14 +633,14 @@ case 26:
|
|
631
633
|
goto st0;
|
632
634
|
goto tr43;
|
633
635
|
tr43:
|
634
|
-
#line
|
636
|
+
#line 58 "ext/puma_http11/http11_parser.rl"
|
635
637
|
{ MARK(query_start, p); }
|
636
638
|
goto st27;
|
637
639
|
st27:
|
638
640
|
if ( ++p == pe )
|
639
641
|
goto _test_eof27;
|
640
642
|
case 27:
|
641
|
-
#line
|
643
|
+
#line 642 "ext/puma_http11/http11_parser.c"
|
642
644
|
switch( (*p) ) {
|
643
645
|
case 32: goto tr47;
|
644
646
|
case 34: goto st0;
|
@@ -1033,7 +1035,7 @@ case 46:
|
|
1033
1035
|
_out: {}
|
1034
1036
|
}
|
1035
1037
|
|
1036
|
-
#line
|
1038
|
+
#line 115 "ext/puma_http11/http11_parser.rl"
|
1037
1039
|
|
1038
1040
|
if (!puma_parser_has_error(parser))
|
1039
1041
|
parser->cs = cs;
|
@@ -12,12 +12,14 @@
|
|
12
12
|
|
13
13
|
/*
|
14
14
|
* capitalizes all lower-case ASCII characters,
|
15
|
-
* converts dashes to underscores.
|
15
|
+
* converts dashes to underscores, and underscores to commas.
|
16
16
|
*/
|
17
17
|
static void snake_upcase_char(char *c)
|
18
18
|
{
|
19
19
|
if (*c >= 'a' && *c <= 'z')
|
20
20
|
*c &= ~0x20;
|
21
|
+
else if (*c == '_')
|
22
|
+
*c = ',';
|
21
23
|
else if (*c == '-')
|
22
24
|
*c = '_';
|
23
25
|
}
|
@@ -29,7 +31,7 @@ static void snake_upcase_char(char *c)
|
|
29
31
|
/** Machine **/
|
30
32
|
|
31
33
|
%%{
|
32
|
-
|
34
|
+
|
33
35
|
machine puma_parser;
|
34
36
|
|
35
37
|
action mark { MARK(mark, fpc); }
|
@@ -37,7 +39,7 @@ static void snake_upcase_char(char *c)
|
|
37
39
|
|
38
40
|
action start_field { MARK(field_start, fpc); }
|
39
41
|
action snake_upcase_field { snake_upcase_char((char *)fpc); }
|
40
|
-
action write_field {
|
42
|
+
action write_field {
|
41
43
|
parser->field_len = LEN(field_start, fpc);
|
42
44
|
}
|
43
45
|
|
@@ -45,10 +47,10 @@ static void snake_upcase_char(char *c)
|
|
45
47
|
action write_value {
|
46
48
|
parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, fpc));
|
47
49
|
}
|
48
|
-
action request_method {
|
50
|
+
action request_method {
|
49
51
|
parser->request_method(parser, PTR_TO(mark), LEN(mark, fpc));
|
50
52
|
}
|
51
|
-
action request_uri {
|
53
|
+
action request_uri {
|
52
54
|
parser->request_uri(parser, PTR_TO(mark), LEN(mark, fpc));
|
53
55
|
}
|
54
56
|
action fragment {
|
@@ -56,11 +58,11 @@ static void snake_upcase_char(char *c)
|
|
56
58
|
}
|
57
59
|
|
58
60
|
action start_query { MARK(query_start, fpc); }
|
59
|
-
action query_string {
|
61
|
+
action query_string {
|
60
62
|
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, fpc));
|
61
63
|
}
|
62
64
|
|
63
|
-
action http_version {
|
65
|
+
action http_version {
|
64
66
|
parser->http_version(parser, PTR_TO(mark), LEN(mark, fpc));
|
65
67
|
}
|
66
68
|
|
@@ -68,8 +70,8 @@ static void snake_upcase_char(char *c)
|
|
68
70
|
parser->request_path(parser, PTR_TO(mark), LEN(mark,fpc));
|
69
71
|
}
|
70
72
|
|
71
|
-
action done {
|
72
|
-
parser->body_start = fpc - buffer + 1;
|
73
|
+
action done {
|
74
|
+
parser->body_start = fpc - buffer + 1;
|
73
75
|
parser->header_done(parser, fpc + 1, pe - fpc - 1);
|
74
76
|
fbreak;
|
75
77
|
}
|
@@ -109,7 +111,7 @@ size_t puma_parser_execute(puma_parser *parser, const char *buffer, size_t len,
|
|
109
111
|
pe = buffer+len;
|
110
112
|
|
111
113
|
/* assert(*pe == '\0' && "pointer does not end on NUL"); */
|
112
|
-
assert(pe - p == len - off && "pointers aren't same distance");
|
114
|
+
assert((size_t) (pe - p) == len - off && "pointers aren't same distance");
|
113
115
|
|
114
116
|
%% write exec;
|
115
117
|
|
data/ext/puma_http11/mini_ssl.c
CHANGED
@@ -88,7 +88,7 @@ DH *get_dh1024() {
|
|
88
88
|
DH *dh;
|
89
89
|
dh = DH_new();
|
90
90
|
|
91
|
-
#if OPENSSL_VERSION_NUMBER < 0x10100005L
|
91
|
+
#if OPENSSL_VERSION_NUMBER < 0x10100005L || defined(LIBRESSL_VERSION_NUMBER)
|
92
92
|
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
|
93
93
|
dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
|
94
94
|
|
@@ -161,6 +161,9 @@ VALUE engine_init_server(VALUE self, VALUE mini_ssl_ctx) {
|
|
161
161
|
ID sym_verify_mode = rb_intern("verify_mode");
|
162
162
|
VALUE verify_mode = rb_funcall(mini_ssl_ctx, sym_verify_mode, 0);
|
163
163
|
|
164
|
+
ID sym_ssl_cipher_filter = rb_intern("ssl_cipher_filter");
|
165
|
+
VALUE ssl_cipher_filter = rb_funcall(mini_ssl_ctx, sym_ssl_cipher_filter, 0);
|
166
|
+
|
164
167
|
ctx = SSL_CTX_new(SSLv23_server_method());
|
165
168
|
conn->ctx = ctx;
|
166
169
|
|
@@ -175,7 +178,13 @@ VALUE engine_init_server(VALUE self, VALUE mini_ssl_ctx) {
|
|
175
178
|
SSL_CTX_set_options(ctx, SSL_OP_CIPHER_SERVER_PREFERENCE | SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_SINGLE_DH_USE | SSL_OP_SINGLE_ECDH_USE | SSL_OP_NO_COMPRESSION);
|
176
179
|
SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF);
|
177
180
|
|
178
|
-
|
181
|
+
if (!NIL_P(ssl_cipher_filter)) {
|
182
|
+
StringValue(ssl_cipher_filter);
|
183
|
+
SSL_CTX_set_cipher_list(ctx, RSTRING_PTR(ssl_cipher_filter));
|
184
|
+
}
|
185
|
+
else {
|
186
|
+
SSL_CTX_set_cipher_list(ctx, "HIGH:!aNULL@STRENGTH");
|
187
|
+
}
|
179
188
|
|
180
189
|
DH *dh = get_dh1024();
|
181
190
|
SSL_CTX_set_tmp_dh(ctx, dh);
|
@@ -244,7 +253,7 @@ void raise_error(SSL* ssl, int result) {
|
|
244
253
|
const char* err_str;
|
245
254
|
int err = errno;
|
246
255
|
int ssl_err = SSL_get_error(ssl, result);
|
247
|
-
int verify_err = SSL_get_verify_result(ssl);
|
256
|
+
int verify_err = (int) SSL_get_verify_result(ssl);
|
248
257
|
|
249
258
|
if(SSL_ERROR_SYSCALL == ssl_err) {
|
250
259
|
snprintf(msg, sizeof(msg), "System error: %s - %d", strerror(err), err);
|
@@ -257,7 +266,7 @@ void raise_error(SSL* ssl, int result) {
|
|
257
266
|
err_str, verify_err);
|
258
267
|
|
259
268
|
} else {
|
260
|
-
err = ERR_get_error();
|
269
|
+
err = (int) ERR_get_error();
|
261
270
|
ERR_error_string_n(err, buf, sizeof(buf));
|
262
271
|
snprintf(msg, sizeof(msg), "OpenSSL error: %s - %d", buf, err);
|
263
272
|
|
@@ -411,6 +420,11 @@ VALUE noop(VALUE self) {
|
|
411
420
|
void Init_mini_ssl(VALUE puma) {
|
412
421
|
VALUE mod, eng;
|
413
422
|
|
423
|
+
/* Fake operation for documentation (RDoc, YARD) */
|
424
|
+
#if 0 == 1
|
425
|
+
puma = rb_define_module("Puma");
|
426
|
+
#endif
|
427
|
+
|
414
428
|
SSL_library_init();
|
415
429
|
OpenSSL_add_ssl_algorithms();
|
416
430
|
SSL_load_error_strings();
|
@@ -419,6 +433,18 @@ void Init_mini_ssl(VALUE puma) {
|
|
419
433
|
mod = rb_define_module_under(puma, "MiniSSL");
|
420
434
|
eng = rb_define_class_under(mod, "Engine", rb_cObject);
|
421
435
|
|
436
|
+
// OpenSSL Build / Runtime/Load versions
|
437
|
+
|
438
|
+
/* Version of OpenSSL that Puma was compiled with */
|
439
|
+
rb_define_const(mod, "OPENSSL_VERSION", rb_str_new2(OPENSSL_VERSION_TEXT));
|
440
|
+
|
441
|
+
#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000
|
442
|
+
/* Version of OpenSSL that Puma loaded with */
|
443
|
+
rb_define_const(mod, "OPENSSL_LIBRARY_VERSION", rb_str_new2(OpenSSL_version(OPENSSL_VERSION)));
|
444
|
+
#else
|
445
|
+
rb_define_const(mod, "OPENSSL_LIBRARY_VERSION", rb_str_new2(SSLeay_version(SSLEAY_VERSION)));
|
446
|
+
#endif
|
447
|
+
|
422
448
|
rb_define_singleton_method(mod, "check", noop, 0);
|
423
449
|
|
424
450
|
eError = rb_define_class_under(mod, "SSLError", rb_eStandardError);
|
@@ -447,7 +473,7 @@ VALUE raise_error(VALUE self) {
|
|
447
473
|
}
|
448
474
|
|
449
475
|
void Init_mini_ssl(VALUE puma) {
|
450
|
-
VALUE mod
|
476
|
+
VALUE mod;
|
451
477
|
|
452
478
|
mod = rb_define_module_under(puma, "MiniSSL");
|
453
479
|
rb_define_class_under(mod, "SSLError", rb_eStandardError);
|