puma 4.2.0 → 4.3.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.
- checksums.yaml +4 -4
- data/History.md +25 -1
- data/README.md +5 -23
- data/docs/plugins.md +20 -10
- data/docs/tcp_mode.md +96 -0
- data/ext/puma_http11/extconf.rb +5 -0
- data/ext/puma_http11/http11_parser.java.rl +21 -37
- data/ext/puma_http11/org/jruby/puma/Http11.java +106 -114
- data/ext/puma_http11/org/jruby/puma/Http11Parser.java +91 -106
- data/ext/puma_http11/puma_http11.c +2 -0
- data/lib/puma/binder.rb +7 -61
- data/lib/puma/cli.rb +1 -1
- data/lib/puma/client.rb +3 -3
- data/lib/puma/cluster.rb +0 -1
- data/lib/puma/const.rb +9 -2
- data/lib/puma/control_cli.rb +11 -3
- data/lib/puma/dsl.rb +5 -3
- data/lib/puma/launcher.rb +1 -4
- data/lib/puma/minissl/context_builder.rb +76 -0
- data/lib/puma/reactor.rb +2 -1
- data/lib/puma/runner.rb +7 -0
- data/lib/puma/server.rb +18 -7
- data/lib/puma/single.rb +0 -1
- data/lib/puma/thread_pool.rb +1 -1
- metadata +4 -4
- data/lib/puma/convenient.rb +0 -25
- data/lib/puma/delegation.rb +0 -13
@@ -2,6 +2,8 @@
|
|
2
2
|
// line 1 "ext/puma_http11/http11_parser.java.rl"
|
3
3
|
package org.jruby.puma;
|
4
4
|
|
5
|
+
import org.jruby.Ruby;
|
6
|
+
import org.jruby.RubyHash;
|
5
7
|
import org.jruby.util.ByteList;
|
6
8
|
|
7
9
|
public class Http11Parser {
|
@@ -9,12 +11,12 @@ public class Http11Parser {
|
|
9
11
|
/** Machine **/
|
10
12
|
|
11
13
|
|
12
|
-
// line
|
14
|
+
// line 58 "ext/puma_http11/http11_parser.java.rl"
|
13
15
|
|
14
16
|
|
15
17
|
/** Data **/
|
16
18
|
|
17
|
-
// line
|
19
|
+
// line 20 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
|
18
20
|
private static byte[] init__puma_parser_actions_0()
|
19
21
|
{
|
20
22
|
return new byte [] {
|
@@ -33,8 +35,8 @@ private static short[] init__puma_parser_key_offsets_0()
|
|
33
35
|
return new short [] {
|
34
36
|
0, 0, 8, 17, 27, 29, 30, 31, 32, 33, 34, 36,
|
35
37
|
39, 41, 44, 45, 61, 62, 78, 80, 81, 89, 97, 107,
|
36
|
-
115,
|
37
|
-
|
38
|
+
115, 124, 132, 140, 149, 158, 167, 176, 185, 194, 203, 212,
|
39
|
+
221, 230, 239, 248, 257, 266, 275, 284, 293, 302, 303
|
38
40
|
};
|
39
41
|
}
|
40
42
|
|
@@ -53,24 +55,23 @@ private static char[] init__puma_parser_trans_keys_0()
|
|
53
55
|
48, 57, 65, 90, 94, 122, 13, 32, 13, 32, 60, 62,
|
54
56
|
127, 0, 31, 34, 35, 32, 60, 62, 127, 0, 31, 34,
|
55
57
|
35, 43, 58, 45, 46, 48, 57, 65, 90, 97, 122, 32,
|
56
|
-
34, 35, 60, 62, 127, 0, 31, 32, 34, 35,
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
32, 0
|
58
|
+
34, 35, 60, 62, 127, 0, 31, 32, 34, 35, 60, 62,
|
59
|
+
63, 127, 0, 31, 32, 34, 35, 60, 62, 127, 0, 31,
|
60
|
+
32, 34, 35, 60, 62, 127, 0, 31, 32, 36, 95, 45,
|
61
|
+
46, 48, 57, 65, 90, 32, 36, 95, 45, 46, 48, 57,
|
62
|
+
65, 90, 32, 36, 95, 45, 46, 48, 57, 65, 90, 32,
|
63
|
+
36, 95, 45, 46, 48, 57, 65, 90, 32, 36, 95, 45,
|
64
|
+
46, 48, 57, 65, 90, 32, 36, 95, 45, 46, 48, 57,
|
65
|
+
65, 90, 32, 36, 95, 45, 46, 48, 57, 65, 90, 32,
|
66
|
+
36, 95, 45, 46, 48, 57, 65, 90, 32, 36, 95, 45,
|
67
|
+
46, 48, 57, 65, 90, 32, 36, 95, 45, 46, 48, 57,
|
68
|
+
65, 90, 32, 36, 95, 45, 46, 48, 57, 65, 90, 32,
|
69
|
+
36, 95, 45, 46, 48, 57, 65, 90, 32, 36, 95, 45,
|
70
|
+
46, 48, 57, 65, 90, 32, 36, 95, 45, 46, 48, 57,
|
71
|
+
65, 90, 32, 36, 95, 45, 46, 48, 57, 65, 90, 32,
|
72
|
+
36, 95, 45, 46, 48, 57, 65, 90, 32, 36, 95, 45,
|
73
|
+
46, 48, 57, 65, 90, 32, 36, 95, 45, 46, 48, 57,
|
74
|
+
65, 90, 32, 0
|
74
75
|
};
|
75
76
|
}
|
76
77
|
|
@@ -82,8 +83,8 @@ private static byte[] init__puma_parser_single_lengths_0()
|
|
82
83
|
return new byte [] {
|
83
84
|
0, 2, 3, 4, 2, 1, 1, 1, 1, 1, 0, 1,
|
84
85
|
0, 1, 1, 4, 1, 4, 2, 1, 4, 4, 2, 6,
|
85
|
-
|
86
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3,
|
86
|
+
7, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
87
|
+
3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 0
|
87
88
|
};
|
88
89
|
}
|
89
90
|
|
@@ -95,8 +96,8 @@ private static byte[] init__puma_parser_range_lengths_0()
|
|
95
96
|
return new byte [] {
|
96
97
|
0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 1, 1,
|
97
98
|
1, 1, 0, 6, 0, 6, 0, 0, 2, 2, 4, 1,
|
98
|
-
1, 1, 1,
|
99
|
-
3, 3, 3, 3, 3, 3, 3, 3, 3,
|
99
|
+
1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
100
|
+
3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0
|
100
101
|
};
|
101
102
|
}
|
102
103
|
|
@@ -108,8 +109,8 @@ private static short[] init__puma_parser_index_offsets_0()
|
|
108
109
|
return new short [] {
|
109
110
|
0, 0, 6, 13, 21, 24, 26, 28, 30, 32, 34, 36,
|
110
111
|
39, 41, 44, 46, 57, 59, 70, 73, 75, 82, 89, 96,
|
111
|
-
104,
|
112
|
-
|
112
|
+
104, 113, 121, 129, 136, 143, 150, 157, 164, 171, 178, 185,
|
113
|
+
192, 199, 206, 213, 220, 227, 234, 241, 248, 255, 257
|
113
114
|
};
|
114
115
|
}
|
115
116
|
|
@@ -127,21 +128,20 @@ private static byte[] init__puma_parser_indicies_0()
|
|
127
128
|
24, 23, 23, 23, 23, 23, 23, 23, 23, 1, 26, 27,
|
128
129
|
25, 29, 28, 30, 1, 1, 1, 1, 1, 31, 32, 1,
|
129
130
|
1, 1, 1, 1, 33, 34, 35, 34, 34, 34, 34, 1,
|
130
|
-
8, 1, 9, 1, 1, 1, 1, 35, 36, 1, 38,
|
131
|
-
1,
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
1, 2, 1, 1, 0
|
131
|
+
8, 1, 9, 1, 1, 1, 1, 35, 36, 1, 38, 1,
|
132
|
+
1, 39, 1, 1, 37, 40, 1, 42, 1, 1, 1, 1,
|
133
|
+
41, 43, 1, 45, 1, 1, 1, 1, 44, 2, 46, 46,
|
134
|
+
46, 46, 46, 1, 2, 47, 47, 47, 47, 47, 1, 2,
|
135
|
+
48, 48, 48, 48, 48, 1, 2, 49, 49, 49, 49, 49,
|
136
|
+
1, 2, 50, 50, 50, 50, 50, 1, 2, 51, 51, 51,
|
137
|
+
51, 51, 1, 2, 52, 52, 52, 52, 52, 1, 2, 53,
|
138
|
+
53, 53, 53, 53, 1, 2, 54, 54, 54, 54, 54, 1,
|
139
|
+
2, 55, 55, 55, 55, 55, 1, 2, 56, 56, 56, 56,
|
140
|
+
56, 1, 2, 57, 57, 57, 57, 57, 1, 2, 58, 58,
|
141
|
+
58, 58, 58, 1, 2, 59, 59, 59, 59, 59, 1, 2,
|
142
|
+
60, 60, 60, 60, 60, 1, 2, 61, 61, 61, 61, 61,
|
143
|
+
1, 2, 62, 62, 62, 62, 62, 1, 2, 63, 63, 63,
|
144
|
+
63, 63, 1, 2, 1, 1, 0
|
145
145
|
};
|
146
146
|
}
|
147
147
|
|
@@ -151,12 +151,12 @@ private static final byte _puma_parser_indicies[] = init__puma_parser_indicies_0
|
|
151
151
|
private static byte[] init__puma_parser_trans_targs_0()
|
152
152
|
{
|
153
153
|
return new byte [] {
|
154
|
-
2, 0, 3,
|
155
|
-
8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
|
154
|
+
2, 0, 3, 27, 4, 22, 24, 23, 5, 20, 6, 7,
|
155
|
+
8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 46, 17,
|
156
156
|
18, 19, 14, 18, 19, 14, 5, 21, 5, 21, 22, 23,
|
157
|
-
5, 24, 20, 25, 26,
|
158
|
-
|
159
|
-
|
157
|
+
5, 24, 20, 25, 5, 26, 20, 5, 26, 20, 28, 29,
|
158
|
+
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
|
159
|
+
42, 43, 44, 45
|
160
160
|
};
|
161
161
|
}
|
162
162
|
|
@@ -169,9 +169,9 @@ private static byte[] init__puma_parser_trans_actions_0()
|
|
169
169
|
1, 0, 11, 0, 1, 1, 1, 1, 13, 13, 1, 0,
|
170
170
|
0, 0, 0, 0, 0, 0, 19, 0, 0, 28, 23, 3,
|
171
171
|
5, 7, 31, 7, 0, 9, 25, 1, 15, 0, 0, 0,
|
172
|
-
37, 0, 37, 21,
|
173
|
-
|
174
|
-
0, 0, 0, 0
|
172
|
+
37, 0, 37, 21, 40, 17, 40, 34, 0, 34, 0, 0,
|
173
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
174
|
+
0, 0, 0, 0
|
175
175
|
};
|
176
176
|
}
|
177
177
|
|
@@ -179,17 +179,20 @@ private static final byte _puma_parser_trans_actions[] = init__puma_parser_trans
|
|
179
179
|
|
180
180
|
|
181
181
|
static final int puma_parser_start = 1;
|
182
|
-
static final int puma_parser_first_final =
|
182
|
+
static final int puma_parser_first_final = 46;
|
183
183
|
static final int puma_parser_error = 0;
|
184
184
|
|
185
|
-
|
185
|
+
static final int puma_parser_en_main = 1;
|
186
|
+
|
187
|
+
|
188
|
+
// line 62 "ext/puma_http11/http11_parser.java.rl"
|
186
189
|
|
187
190
|
public static interface ElementCB {
|
188
|
-
public void call(
|
191
|
+
public void call(Ruby runtime, RubyHash data, ByteList buffer, int at, int length);
|
189
192
|
}
|
190
193
|
|
191
194
|
public static interface FieldCB {
|
192
|
-
public void call(
|
195
|
+
public void call(Ruby runtime, RubyHash data, ByteList buffer, int field, int flen, int value, int vlen);
|
193
196
|
}
|
194
197
|
|
195
198
|
public static class HttpParser {
|
@@ -202,28 +205,19 @@ static final int puma_parser_error = 0;
|
|
202
205
|
int field_len;
|
203
206
|
int query_start;
|
204
207
|
|
205
|
-
|
208
|
+
RubyHash data;
|
206
209
|
ByteList buffer;
|
207
210
|
|
208
|
-
public FieldCB http_field;
|
209
|
-
public ElementCB request_method;
|
210
|
-
public ElementCB request_uri;
|
211
|
-
public ElementCB fragment;
|
212
|
-
public ElementCB request_path;
|
213
|
-
public ElementCB query_string;
|
214
|
-
public ElementCB http_version;
|
215
|
-
public ElementCB header_done;
|
216
|
-
|
217
211
|
public void init() {
|
218
212
|
cs = 0;
|
219
213
|
|
220
|
-
|
221
|
-
// line
|
214
|
+
|
215
|
+
// line 218 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
|
222
216
|
{
|
223
217
|
cs = puma_parser_start;
|
224
218
|
}
|
225
219
|
|
226
|
-
// line
|
220
|
+
// line 90 "ext/puma_http11/http11_parser.java.rl"
|
227
221
|
|
228
222
|
body_start = 0;
|
229
223
|
content_len = 0;
|
@@ -236,7 +230,7 @@ static final int puma_parser_error = 0;
|
|
236
230
|
|
237
231
|
public final HttpParser parser = new HttpParser();
|
238
232
|
|
239
|
-
public int execute(ByteList buffer, int off) {
|
233
|
+
public int execute(Ruby runtime, Http11 http, ByteList buffer, int off) {
|
240
234
|
int p, pe;
|
241
235
|
int cs = parser.cs;
|
242
236
|
int len = buffer.length();
|
@@ -249,8 +243,8 @@ static final int puma_parser_error = 0;
|
|
249
243
|
byte[] data = buffer.bytes();
|
250
244
|
parser.buffer = buffer;
|
251
245
|
|
252
|
-
|
253
|
-
// line
|
246
|
+
|
247
|
+
// line 250 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
|
254
248
|
{
|
255
249
|
int _klen;
|
256
250
|
int _trans = 0;
|
@@ -331,91 +325,82 @@ case 1:
|
|
331
325
|
switch ( _puma_parser_actions[_acts++] )
|
332
326
|
{
|
333
327
|
case 0:
|
334
|
-
// line
|
328
|
+
// line 15 "ext/puma_http11/http11_parser.java.rl"
|
335
329
|
{parser.mark = p; }
|
336
330
|
break;
|
337
331
|
case 1:
|
338
|
-
// line
|
332
|
+
// line 17 "ext/puma_http11/http11_parser.java.rl"
|
339
333
|
{ parser.field_start = p; }
|
340
334
|
break;
|
341
335
|
case 2:
|
342
|
-
// line
|
336
|
+
// line 18 "ext/puma_http11/http11_parser.java.rl"
|
343
337
|
{ /* FIXME stub */ }
|
344
338
|
break;
|
345
339
|
case 3:
|
346
|
-
// line
|
347
|
-
{
|
340
|
+
// line 19 "ext/puma_http11/http11_parser.java.rl"
|
341
|
+
{
|
348
342
|
parser.field_len = p-parser.field_start;
|
349
343
|
}
|
350
344
|
break;
|
351
345
|
case 4:
|
352
|
-
// line
|
346
|
+
// line 23 "ext/puma_http11/http11_parser.java.rl"
|
353
347
|
{ parser.mark = p; }
|
354
348
|
break;
|
355
349
|
case 5:
|
356
|
-
// line
|
350
|
+
// line 24 "ext/puma_http11/http11_parser.java.rl"
|
357
351
|
{
|
358
|
-
|
359
|
-
parser.http_field.call(parser.data, parser.field_start, parser.field_len, parser.mark, p-parser.mark);
|
360
|
-
}
|
352
|
+
Http11.http_field(runtime, parser.data, parser.buffer, parser.field_start, parser.field_len, parser.mark, p-parser.mark);
|
361
353
|
}
|
362
354
|
break;
|
363
355
|
case 6:
|
364
356
|
// line 27 "ext/puma_http11/http11_parser.java.rl"
|
365
357
|
{
|
366
|
-
|
367
|
-
parser.request_method.call(parser.data, parser.mark, p-parser.mark);
|
358
|
+
Http11.request_method(runtime, parser.data, parser.buffer, parser.mark, p-parser.mark);
|
368
359
|
}
|
369
360
|
break;
|
370
361
|
case 7:
|
371
|
-
// line
|
362
|
+
// line 30 "ext/puma_http11/http11_parser.java.rl"
|
372
363
|
{
|
373
|
-
|
374
|
-
parser.request_uri.call(parser.data, parser.mark, p-parser.mark);
|
364
|
+
Http11.request_uri(runtime, parser.data, parser.buffer, parser.mark, p-parser.mark);
|
375
365
|
}
|
376
366
|
break;
|
377
367
|
case 8:
|
378
|
-
// line
|
368
|
+
// line 33 "ext/puma_http11/http11_parser.java.rl"
|
379
369
|
{
|
380
|
-
|
381
|
-
parser.fragment.call(parser.data, parser.mark, p-parser.mark);
|
370
|
+
Http11.fragment(runtime, parser.data, parser.buffer, parser.mark, p-parser.mark);
|
382
371
|
}
|
383
372
|
break;
|
384
373
|
case 9:
|
385
|
-
// line
|
374
|
+
// line 37 "ext/puma_http11/http11_parser.java.rl"
|
386
375
|
{parser.query_start = p; }
|
387
376
|
break;
|
388
377
|
case 10:
|
389
|
-
// line
|
378
|
+
// line 38 "ext/puma_http11/http11_parser.java.rl"
|
390
379
|
{
|
391
|
-
|
392
|
-
parser.query_string.call(parser.data, parser.query_start, p-parser.query_start);
|
380
|
+
Http11.query_string(runtime, parser.data, parser.buffer, parser.query_start, p-parser.query_start);
|
393
381
|
}
|
394
382
|
break;
|
395
383
|
case 11:
|
396
|
-
// line
|
384
|
+
// line 42 "ext/puma_http11/http11_parser.java.rl"
|
397
385
|
{
|
398
|
-
|
399
|
-
parser.http_version.call(parser.data, parser.mark, p-parser.mark);
|
386
|
+
Http11.http_version(runtime, parser.data, parser.buffer, parser.mark, p-parser.mark);
|
400
387
|
}
|
401
388
|
break;
|
402
389
|
case 12:
|
403
|
-
// line
|
390
|
+
// line 46 "ext/puma_http11/http11_parser.java.rl"
|
404
391
|
{
|
405
|
-
|
406
|
-
parser.request_path.call(parser.data, parser.mark, p-parser.mark);
|
392
|
+
Http11.request_path(runtime, parser.data, parser.buffer, parser.mark, p-parser.mark);
|
407
393
|
}
|
408
394
|
break;
|
409
395
|
case 13:
|
410
|
-
// line
|
411
|
-
{
|
396
|
+
// line 50 "ext/puma_http11/http11_parser.java.rl"
|
397
|
+
{
|
412
398
|
parser.body_start = p + 1;
|
413
|
-
|
414
|
-
parser.header_done.call(parser.data, p + 1, pe - p - 1);
|
399
|
+
http.header_done(runtime, parser.data, parser.buffer, p + 1, pe - p - 1);
|
415
400
|
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
|
416
401
|
}
|
417
402
|
break;
|
418
|
-
// line
|
403
|
+
// line 406 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
|
419
404
|
}
|
420
405
|
}
|
421
406
|
}
|
@@ -435,11 +420,11 @@ case 5:
|
|
435
420
|
break; }
|
436
421
|
}
|
437
422
|
|
438
|
-
// line
|
423
|
+
// line 116 "ext/puma_http11/http11_parser.java.rl"
|
439
424
|
|
440
425
|
parser.cs = cs;
|
441
426
|
parser.nread += (p - off);
|
442
|
-
|
427
|
+
|
443
428
|
assert p <= pe : "buffer overflow after parsing execute";
|
444
429
|
assert parser.nread <= len : "nread longer than length";
|
445
430
|
assert parser.body_start <= len : "body starts after buffer end";
|
@@ -200,6 +200,8 @@ void http_field(puma_parser* hp, const char *field, size_t flen,
|
|
200
200
|
f = rb_str_new(hp->buf, new_size);
|
201
201
|
}
|
202
202
|
|
203
|
+
while (vlen > 0 && isspace(value[vlen - 1])) vlen--;
|
204
|
+
|
203
205
|
/* check for duplicate header */
|
204
206
|
v = rb_hash_aref(hp->request, f);
|
205
207
|
|
data/lib/puma/binder.rb
CHANGED
@@ -5,6 +5,7 @@ require 'socket'
|
|
5
5
|
|
6
6
|
require 'puma/const'
|
7
7
|
require 'puma/util'
|
8
|
+
require 'puma/minissl/context_builder'
|
8
9
|
|
9
10
|
module Puma
|
10
11
|
class Binder
|
@@ -105,6 +106,7 @@ module Puma
|
|
105
106
|
io = add_tcp_listener uri.host, uri.port, opt, bak
|
106
107
|
|
107
108
|
@ios.each do |i|
|
109
|
+
next unless TCPServer === i
|
108
110
|
addr = if i.local_address.ipv6?
|
109
111
|
"[#{i.local_address.ip_unpack[0]}]:#{i.local_address.ip_unpack[1]}"
|
110
112
|
else
|
@@ -153,64 +155,7 @@ module Puma
|
|
153
155
|
@listeners << [str, io]
|
154
156
|
when "ssl"
|
155
157
|
params = Util.parse_query uri.query
|
156
|
-
|
157
|
-
|
158
|
-
MiniSSL.check
|
159
|
-
|
160
|
-
ctx = MiniSSL::Context.new
|
161
|
-
|
162
|
-
if defined?(JRUBY_VERSION)
|
163
|
-
unless params['keystore']
|
164
|
-
@events.error "Please specify the Java keystore via 'keystore='"
|
165
|
-
end
|
166
|
-
|
167
|
-
ctx.keystore = params['keystore']
|
168
|
-
|
169
|
-
unless params['keystore-pass']
|
170
|
-
@events.error "Please specify the Java keystore password via 'keystore-pass='"
|
171
|
-
end
|
172
|
-
|
173
|
-
ctx.keystore_pass = params['keystore-pass']
|
174
|
-
ctx.ssl_cipher_list = params['ssl_cipher_list'] if params['ssl_cipher_list']
|
175
|
-
else
|
176
|
-
unless params['key']
|
177
|
-
@events.error "Please specify the SSL key via 'key='"
|
178
|
-
end
|
179
|
-
|
180
|
-
ctx.key = params['key']
|
181
|
-
|
182
|
-
unless params['cert']
|
183
|
-
@events.error "Please specify the SSL cert via 'cert='"
|
184
|
-
end
|
185
|
-
|
186
|
-
ctx.cert = params['cert']
|
187
|
-
|
188
|
-
if ['peer', 'force_peer'].include?(params['verify_mode'])
|
189
|
-
unless params['ca']
|
190
|
-
@events.error "Please specify the SSL ca via 'ca='"
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
ctx.ca = params['ca'] if params['ca']
|
195
|
-
ctx.ssl_cipher_filter = params['ssl_cipher_filter'] if params['ssl_cipher_filter']
|
196
|
-
end
|
197
|
-
|
198
|
-
ctx.no_tlsv1 = true if params['no_tlsv1'] == 'true'
|
199
|
-
ctx.no_tlsv1_1 = true if params['no_tlsv1_1'] == 'true'
|
200
|
-
|
201
|
-
if params['verify_mode']
|
202
|
-
ctx.verify_mode = case params['verify_mode']
|
203
|
-
when "peer"
|
204
|
-
MiniSSL::VERIFY_PEER
|
205
|
-
when "force_peer"
|
206
|
-
MiniSSL::VERIFY_PEER | MiniSSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
207
|
-
when "none"
|
208
|
-
MiniSSL::VERIFY_NONE
|
209
|
-
else
|
210
|
-
@events.error "Please specify a valid verify_mode="
|
211
|
-
MiniSSL::VERIFY_NONE
|
212
|
-
end
|
213
|
-
end
|
158
|
+
ctx = MiniSSL::ContextBuilder.new(params, @events).context
|
214
159
|
|
215
160
|
if fd = @inherited_fds.delete(str)
|
216
161
|
logger.log "* Inherited #{str}"
|
@@ -360,7 +305,7 @@ module Puma
|
|
360
305
|
# Tell the server to listen on +path+ as a UNIX domain socket.
|
361
306
|
#
|
362
307
|
def add_unix_listener(path, umask=nil, mode=nil, backlog=1024)
|
363
|
-
@unix_paths << path
|
308
|
+
@unix_paths << path unless File.exist? path
|
364
309
|
|
365
310
|
# Let anyone connect by default
|
366
311
|
umask ||= 0
|
@@ -398,7 +343,7 @@ module Puma
|
|
398
343
|
end
|
399
344
|
|
400
345
|
def inherit_unix_listener(path, fd)
|
401
|
-
@unix_paths << path
|
346
|
+
@unix_paths << path unless File.exist? path
|
402
347
|
|
403
348
|
if fd.kind_of? TCPServer
|
404
349
|
s = fd
|
@@ -419,7 +364,8 @@ module Puma
|
|
419
364
|
io.close
|
420
365
|
uri = URI.parse(l)
|
421
366
|
next unless uri.scheme == 'unix'
|
422
|
-
|
367
|
+
unix_path = "#{uri.host}#{uri.path}"
|
368
|
+
File.unlink unix_path if @unix_paths.include? unix_path
|
423
369
|
end
|
424
370
|
end
|
425
371
|
|