puma 4.3.12-java → 5.0.0.beta1-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.

Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +58 -41
  3. data/LICENSE +23 -20
  4. data/README.md +17 -11
  5. data/bin/puma-wild +0 -0
  6. data/docs/architecture.md +0 -0
  7. data/docs/deployment.md +3 -1
  8. data/docs/fork_worker.md +31 -0
  9. data/docs/images/puma-connection-flow-no-reactor.png +0 -0
  10. data/docs/images/puma-connection-flow.png +0 -0
  11. data/docs/images/puma-general-arch.png +0 -0
  12. data/docs/jungle/README.md +13 -0
  13. data/{tools → docs}/jungle/rc.d/README.md +0 -0
  14. data/{tools → docs}/jungle/rc.d/puma +0 -0
  15. data/{tools → docs}/jungle/rc.d/puma.conf +0 -0
  16. data/{tools → docs}/jungle/upstart/README.md +0 -0
  17. data/{tools → docs}/jungle/upstart/puma-manager.conf +0 -0
  18. data/{tools → docs}/jungle/upstart/puma.conf +0 -0
  19. data/docs/nginx.md +0 -0
  20. data/docs/plugins.md +0 -0
  21. data/docs/restart.md +0 -0
  22. data/docs/signals.md +1 -0
  23. data/docs/systemd.md +1 -63
  24. data/ext/puma_http11/PumaHttp11Service.java +2 -4
  25. data/ext/puma_http11/ext_help.h +0 -0
  26. data/ext/puma_http11/extconf.rb +3 -10
  27. data/ext/puma_http11/http11_parser.c +11 -26
  28. data/ext/puma_http11/http11_parser.h +0 -0
  29. data/ext/puma_http11/http11_parser.java.rl +0 -0
  30. data/ext/puma_http11/http11_parser.rl +1 -3
  31. data/ext/puma_http11/http11_parser_common.rl +1 -1
  32. data/ext/puma_http11/mini_ssl.c +47 -82
  33. data/ext/puma_http11/org/jruby/puma/Http11.java +3 -3
  34. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +46 -48
  35. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +0 -0
  36. data/ext/puma_http11/puma_http11.c +2 -38
  37. data/lib/puma/accept_nonblock.rb +0 -0
  38. data/lib/puma/app/status.rb +16 -5
  39. data/lib/puma/binder.rb +62 -60
  40. data/lib/puma/cli.rb +7 -15
  41. data/lib/puma/client.rb +38 -78
  42. data/lib/puma/cluster.rb +179 -74
  43. data/lib/puma/commonlogger.rb +0 -0
  44. data/lib/puma/configuration.rb +30 -42
  45. data/lib/puma/const.rb +5 -8
  46. data/lib/puma/control_cli.rb +27 -17
  47. data/lib/puma/detect.rb +8 -0
  48. data/lib/puma/dsl.rb +70 -34
  49. data/lib/puma/events.rb +0 -0
  50. data/lib/puma/io_buffer.rb +9 -2
  51. data/lib/puma/jruby_restart.rb +0 -58
  52. data/lib/puma/launcher.rb +41 -29
  53. data/lib/puma/minissl/context_builder.rb +0 -0
  54. data/lib/puma/minissl.rb +13 -8
  55. data/lib/puma/null_io.rb +1 -1
  56. data/lib/puma/plugin/tmp_restart.rb +0 -0
  57. data/lib/puma/plugin.rb +1 -10
  58. data/lib/puma/puma_http11.jar +0 -0
  59. data/lib/puma/rack/builder.rb +0 -4
  60. data/lib/puma/rack/urlmap.rb +0 -0
  61. data/lib/puma/rack_default.rb +0 -0
  62. data/lib/puma/reactor.rb +6 -1
  63. data/lib/puma/runner.rb +5 -34
  64. data/lib/puma/server.rb +74 -206
  65. data/lib/puma/single.rb +7 -64
  66. data/lib/puma/state_file.rb +5 -2
  67. data/lib/puma/thread_pool.rb +85 -47
  68. data/lib/puma/util.rb +0 -0
  69. data/lib/puma.rb +4 -0
  70. data/lib/rack/handler/puma.rb +1 -3
  71. data/tools/{docker/Dockerfile → Dockerfile} +0 -0
  72. data/tools/trickletest.rb +0 -0
  73. metadata +18 -22
  74. data/docs/tcp_mode.md +0 -96
  75. data/ext/puma_http11/io_buffer.c +0 -155
  76. data/ext/puma_http11/org/jruby/puma/IOBuffer.java +0 -72
  77. data/lib/puma/tcp_logger.rb +0 -41
  78. data/tools/jungle/README.md +0 -19
  79. data/tools/jungle/init.d/README.md +0 -61
  80. data/tools/jungle/init.d/puma +0 -421
  81. data/tools/jungle/init.d/run-puma +0 -18
@@ -62,65 +62,44 @@ ms_conn* engine_alloc(VALUE klass, VALUE* obj) {
62
62
  return conn;
63
63
  }
64
64
 
65
- DH *get_dh2048(void) {
66
- /* `openssl dhparam -C 2048`
65
+ DH *get_dh1024() {
66
+ /* `openssl dhparam 1024 -C`
67
67
  * -----BEGIN DH PARAMETERS-----
68
- * MIIBCAKCAQEAjmh1uQHdTfxOyxEbKAV30fUfzqMDF/ChPzjfyzl2jcrqQMhrk76o
69
- * 2NPNXqxHwsddMZ1RzvU8/jl+uhRuPWjXCFZbhET4N1vrviZM3VJhV8PPHuiVOACO
70
- * y32jFd+Szx4bo2cXSK83hJ6jRd+0asP1awWjz9/06dFkrILCXMIfQLo0D8rqmppn
71
- * EfDDAwuudCpM9kcDmBRAm9JsKbQ6gzZWjkc5+QWSaQofojIHbjvj3xzguaCJn+oQ
72
- * vHWM+hsAnaOgEwCyeZ3xqs+/5lwSbkE/tqJW98cEZGygBUVo9jxZRZx6KOfjpdrb
73
- * yenO9LJr/qtyrZB31WJbqxI0m0AKTAO8UwIBAg==
68
+ * MIGHAoGBALPwcEv0OstmQCZdfHw0N5r+07lmXMxkpQacy1blwj0LUqC+Divp6pBk
69
+ * usTJ9W2/dOYr1X7zi6yXNLp4oLzc/31PUL3D9q8CpGS7vPz5gijKSw9BwCTT5z9+
70
+ * KF9v46qw8XqT5HHV87sWFlGQcVFq+pEkA2kPikkKZ/X/CCcpCAV7AgEC
74
71
  * -----END DH PARAMETERS-----
75
72
  */
76
- static unsigned char dh2048_p[] = {
77
- 0x8E, 0x68, 0x75, 0xB9, 0x01, 0xDD, 0x4D, 0xFC, 0x4E, 0xCB,
78
- 0x11, 0x1B, 0x28, 0x05, 0x77, 0xD1, 0xF5, 0x1F, 0xCE, 0xA3,
79
- 0x03, 0x17, 0xF0, 0xA1, 0x3F, 0x38, 0xDF, 0xCB, 0x39, 0x76,
80
- 0x8D, 0xCA, 0xEA, 0x40, 0xC8, 0x6B, 0x93, 0xBE, 0xA8, 0xD8,
81
- 0xD3, 0xCD, 0x5E, 0xAC, 0x47, 0xC2, 0xC7, 0x5D, 0x31, 0x9D,
82
- 0x51, 0xCE, 0xF5, 0x3C, 0xFE, 0x39, 0x7E, 0xBA, 0x14, 0x6E,
83
- 0x3D, 0x68, 0xD7, 0x08, 0x56, 0x5B, 0x84, 0x44, 0xF8, 0x37,
84
- 0x5B, 0xEB, 0xBE, 0x26, 0x4C, 0xDD, 0x52, 0x61, 0x57, 0xC3,
85
- 0xCF, 0x1E, 0xE8, 0x95, 0x38, 0x00, 0x8E, 0xCB, 0x7D, 0xA3,
86
- 0x15, 0xDF, 0x92, 0xCF, 0x1E, 0x1B, 0xA3, 0x67, 0x17, 0x48,
87
- 0xAF, 0x37, 0x84, 0x9E, 0xA3, 0x45, 0xDF, 0xB4, 0x6A, 0xC3,
88
- 0xF5, 0x6B, 0x05, 0xA3, 0xCF, 0xDF, 0xF4, 0xE9, 0xD1, 0x64,
89
- 0xAC, 0x82, 0xC2, 0x5C, 0xC2, 0x1F, 0x40, 0xBA, 0x34, 0x0F,
90
- 0xCA, 0xEA, 0x9A, 0x9A, 0x67, 0x11, 0xF0, 0xC3, 0x03, 0x0B,
91
- 0xAE, 0x74, 0x2A, 0x4C, 0xF6, 0x47, 0x03, 0x98, 0x14, 0x40,
92
- 0x9B, 0xD2, 0x6C, 0x29, 0xB4, 0x3A, 0x83, 0x36, 0x56, 0x8E,
93
- 0x47, 0x39, 0xF9, 0x05, 0x92, 0x69, 0x0A, 0x1F, 0xA2, 0x32,
94
- 0x07, 0x6E, 0x3B, 0xE3, 0xDF, 0x1C, 0xE0, 0xB9, 0xA0, 0x89,
95
- 0x9F, 0xEA, 0x10, 0xBC, 0x75, 0x8C, 0xFA, 0x1B, 0x00, 0x9D,
96
- 0xA3, 0xA0, 0x13, 0x00, 0xB2, 0x79, 0x9D, 0xF1, 0xAA, 0xCF,
97
- 0xBF, 0xE6, 0x5C, 0x12, 0x6E, 0x41, 0x3F, 0xB6, 0xA2, 0x56,
98
- 0xF7, 0xC7, 0x04, 0x64, 0x6C, 0xA0, 0x05, 0x45, 0x68, 0xF6,
99
- 0x3C, 0x59, 0x45, 0x9C, 0x7A, 0x28, 0xE7, 0xE3, 0xA5, 0xDA,
100
- 0xDB, 0xC9, 0xE9, 0xCE, 0xF4, 0xB2, 0x6B, 0xFE, 0xAB, 0x72,
101
- 0xAD, 0x90, 0x77, 0xD5, 0x62, 0x5B, 0xAB, 0x12, 0x34, 0x9B,
102
- 0x40, 0x0A, 0x4C, 0x03, 0xBC, 0x53
73
+ static unsigned char dh1024_p[] = {
74
+ 0xB3,0xF0,0x70,0x4B,0xF4,0x3A,0xCB,0x66,0x40,0x26,0x5D,0x7C,
75
+ 0x7C,0x34,0x37,0x9A,0xFE,0xD3,0xB9,0x66,0x5C,0xCC,0x64,0xA5,
76
+ 0x06,0x9C,0xCB,0x56,0xE5,0xC2,0x3D,0x0B,0x52,0xA0,0xBE,0x0E,
77
+ 0x2B,0xE9,0xEA,0x90,0x64,0xBA,0xC4,0xC9,0xF5,0x6D,0xBF,0x74,
78
+ 0xE6,0x2B,0xD5,0x7E,0xF3,0x8B,0xAC,0x97,0x34,0xBA,0x78,0xA0,
79
+ 0xBC,0xDC,0xFF,0x7D,0x4F,0x50,0xBD,0xC3,0xF6,0xAF,0x02,0xA4,
80
+ 0x64,0xBB,0xBC,0xFC,0xF9,0x82,0x28,0xCA,0x4B,0x0F,0x41,0xC0,
81
+ 0x24,0xD3,0xE7,0x3F,0x7E,0x28,0x5F,0x6F,0xE3,0xAA,0xB0,0xF1,
82
+ 0x7A,0x93,0xE4,0x71,0xD5,0xF3,0xBB,0x16,0x16,0x51,0x90,0x71,
83
+ 0x51,0x6A,0xFA,0x91,0x24,0x03,0x69,0x0F,0x8A,0x49,0x0A,0x67,
84
+ 0xF5,0xFF,0x08,0x27,0x29,0x08,0x05,0x7B
103
85
  };
104
- static unsigned char dh2048_g[] = { 0x02 };
86
+ static unsigned char dh1024_g[] = { 0x02 };
105
87
 
106
88
  DH *dh;
107
- #if !(OPENSSL_VERSION_NUMBER < 0x10100005L || defined(LIBRESSL_VERSION_NUMBER))
108
- BIGNUM *p, *g;
109
- #endif
110
-
111
89
  dh = DH_new();
112
90
 
113
91
  #if OPENSSL_VERSION_NUMBER < 0x10100005L || defined(LIBRESSL_VERSION_NUMBER)
114
- dh->p = BN_bin2bn(dh2048_p, sizeof(dh2048_p), NULL);
115
- dh->g = BN_bin2bn(dh2048_g, sizeof(dh2048_g), NULL);
92
+ dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
93
+ dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
116
94
 
117
95
  if ((dh->p == NULL) || (dh->g == NULL)) {
118
96
  DH_free(dh);
119
97
  return NULL;
120
98
  }
121
99
  #else
122
- p = BN_bin2bn(dh2048_p, sizeof(dh2048_p), NULL);
123
- g = BN_bin2bn(dh2048_g, sizeof(dh2048_g), NULL);
100
+ BIGNUM *p, *g;
101
+ p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
102
+ g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
124
103
 
125
104
  if (p == NULL || g == NULL || !DH_set0_pqg(dh, p, NULL, g)) {
126
105
  DH_free(dh);
@@ -160,7 +139,7 @@ static int engine_verify_callback(int preverify_ok, X509_STORE_CTX* ctx) {
160
139
  }
161
140
 
162
141
  VALUE engine_init_server(VALUE self, VALUE mini_ssl_ctx) {
163
- VALUE obj, session_id_bytes;
142
+ VALUE obj;
164
143
  SSL_CTX* ctx;
165
144
  SSL* ssl;
166
145
  int min, ssl_options;
@@ -219,7 +198,7 @@ VALUE engine_init_server(VALUE self, VALUE mini_ssl_ctx) {
219
198
  else {
220
199
  min = TLS1_VERSION;
221
200
  }
222
-
201
+
223
202
  SSL_CTX_set_min_proto_version(ctx, min);
224
203
 
225
204
  SSL_CTX_set_options(ctx, ssl_options);
@@ -247,21 +226,7 @@ VALUE engine_init_server(VALUE self, VALUE mini_ssl_ctx) {
247
226
  SSL_CTX_set_cipher_list(ctx, "HIGH:!aNULL@STRENGTH");
248
227
  }
249
228
 
250
- // Random.bytes available in Ruby 2.5 and later, Random::DEFAULT deprecated in 3.0
251
- session_id_bytes = rb_funcall(
252
- #ifdef HAVE_RANDOM_BYTES
253
- rb_cRandom,
254
- #else
255
- rb_const_get(rb_cRandom, rb_intern_const("DEFAULT")),
256
- #endif
257
- rb_intern_const("bytes"),
258
- 1, ULL2NUM(SSL_MAX_SSL_SESSION_ID_LENGTH));
259
-
260
- SSL_CTX_set_session_id_context(ctx,
261
- (unsigned char *) RSTRING_PTR(session_id_bytes),
262
- SSL_MAX_SSL_SESSION_ID_LENGTH);
263
-
264
- DH *dh = get_dh2048();
229
+ DH *dh = get_dh1024();
265
230
  SSL_CTX_set_tmp_dh(ctx, dh);
266
231
 
267
232
  #if OPENSSL_VERSION_NUMBER < 0x10002000L
@@ -528,27 +493,27 @@ void Init_mini_ssl(VALUE puma) {
528
493
  #else
529
494
  rb_define_const(mod, "OPENSSL_LIBRARY_VERSION", rb_str_new2(SSLeay_version(SSLEAY_VERSION)));
530
495
  #endif
531
-
532
- #if defined(OPENSSL_NO_SSL3) || defined(OPENSSL_NO_SSL3_METHOD)
533
- /* True if SSL3 is not available */
534
- rb_define_const(mod, "OPENSSL_NO_SSL3", Qtrue);
535
- #else
536
- rb_define_const(mod, "OPENSSL_NO_SSL3", Qfalse);
537
- #endif
538
-
539
- #if defined(OPENSSL_NO_TLS1) || defined(OPENSSL_NO_TLS1_METHOD)
540
- /* True if TLS1 is not available */
541
- rb_define_const(mod, "OPENSSL_NO_TLS1", Qtrue);
542
- #else
543
- rb_define_const(mod, "OPENSSL_NO_TLS1", Qfalse);
544
- #endif
545
-
546
- #if defined(OPENSSL_NO_TLS1_1) || defined(OPENSSL_NO_TLS1_1_METHOD)
547
- /* True if TLS1_1 is not available */
548
- rb_define_const(mod, "OPENSSL_NO_TLS1_1", Qtrue);
549
- #else
550
- rb_define_const(mod, "OPENSSL_NO_TLS1_1", Qfalse);
551
- #endif
496
+
497
+ #if defined(OPENSSL_NO_SSL3) || defined(OPENSSL_NO_SSL3_METHOD)
498
+ /* True if SSL3 is not available */
499
+ rb_define_const(mod, "OPENSSL_NO_SSL3", Qtrue);
500
+ #else
501
+ rb_define_const(mod, "OPENSSL_NO_SSL3", Qfalse);
502
+ #endif
503
+
504
+ #if defined(OPENSSL_NO_TLS1) || defined(OPENSSL_NO_TLS1_METHOD)
505
+ /* True if TLS1 is not available */
506
+ rb_define_const(mod, "OPENSSL_NO_TLS1", Qtrue);
507
+ #else
508
+ rb_define_const(mod, "OPENSSL_NO_TLS1", Qfalse);
509
+ #endif
510
+
511
+ #if defined(OPENSSL_NO_TLS1_1) || defined(OPENSSL_NO_TLS1_1_METHOD)
512
+ /* True if TLS1_1 is not available */
513
+ rb_define_const(mod, "OPENSSL_NO_TLS1_1", Qtrue);
514
+ #else
515
+ rb_define_const(mod, "OPENSSL_NO_TLS1_1", Qfalse);
516
+ #endif
552
517
 
553
518
  rb_define_singleton_method(mod, "check", noop, 0);
554
519
 
@@ -30,8 +30,8 @@ public class Http11 extends RubyObject {
30
30
  public final static String MAX_REQUEST_URI_LENGTH_ERR = "HTTP element REQUEST_URI is longer than the 12288 allowed length.";
31
31
  public final static int MAX_FRAGMENT_LENGTH = 1024;
32
32
  public final static String MAX_FRAGMENT_LENGTH_ERR = "HTTP element REQUEST_PATH is longer than the 1024 allowed length.";
33
- public final static int MAX_REQUEST_PATH_LENGTH = 2048;
34
- public final static String MAX_REQUEST_PATH_LENGTH_ERR = "HTTP element REQUEST_PATH is longer than the 2048 allowed length.";
33
+ public final static int MAX_REQUEST_PATH_LENGTH = 8192;
34
+ public final static String MAX_REQUEST_PATH_LENGTH_ERR = "HTTP element REQUEST_PATH is longer than the 8192 allowed length.";
35
35
  public final static int MAX_QUERY_STRING_LENGTH = 1024 * 10;
36
36
  public final static String MAX_QUERY_STRING_LENGTH_ERR = "HTTP element QUERY_STRING is longer than the 10240 allowed length.";
37
37
  public final static int MAX_HEADER_LENGTH = 1024 * (80 + 32);
@@ -197,7 +197,7 @@ public class Http11 extends RubyObject {
197
197
  validateMaxLength(runtime, parser.nread,MAX_HEADER_LENGTH, MAX_HEADER_LENGTH_ERR);
198
198
 
199
199
  if(hp.has_error()) {
200
- throw newHTTPParserError(runtime, "Invalid HTTP format, parsing fails.");
200
+ throw newHTTPParserError(runtime, "Invalid HTTP format, parsing fails. Are you trying to open an SSL connection to a non-SSL Puma?");
201
201
  } else {
202
202
  return runtime.newFixnum(parser.nread);
203
203
  }
@@ -34,9 +34,9 @@ private static short[] init__puma_parser_key_offsets_0()
34
34
  {
35
35
  return new short [] {
36
36
  0, 0, 8, 17, 27, 29, 30, 31, 32, 33, 34, 36,
37
- 39, 41, 44, 45, 61, 62, 78, 85, 91, 99, 107, 117,
38
- 125, 134, 142, 150, 159, 168, 177, 186, 195, 204, 213, 222,
39
- 231, 240, 249, 258, 267, 276, 285, 294, 303, 312, 313
37
+ 39, 41, 44, 45, 61, 62, 78, 80, 81, 89, 97, 107,
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
40
40
  };
41
41
  }
42
42
 
@@ -52,27 +52,26 @@ private static char[] init__puma_parser_trans_keys_0()
52
52
  46, 48, 57, 48, 57, 13, 48, 57, 10, 13, 33, 124,
53
53
  126, 35, 39, 42, 43, 45, 46, 48, 57, 65, 90, 94,
54
54
  122, 10, 33, 58, 124, 126, 35, 39, 42, 43, 45, 46,
55
- 48, 57, 65, 90, 94, 122, 13, 32, 127, 0, 8, 10,
56
- 31, 13, 127, 0, 8, 10, 31, 32, 60, 62, 127, 0,
57
- 31, 34, 35, 32, 60, 62, 127, 0, 31, 34, 35, 43,
58
- 58, 45, 46, 48, 57, 65, 90, 97, 122, 32, 34, 35,
59
- 60, 62, 127, 0, 31, 32, 34, 35, 60, 62, 63, 127,
60
- 0, 31, 32, 34, 35, 60, 62, 127, 0, 31, 32, 34,
61
- 35, 60, 62, 127, 0, 31, 32, 36, 95, 45, 46, 48,
62
- 57, 65, 90, 32, 36, 95, 45, 46, 48, 57, 65, 90,
63
- 32, 36, 95, 45, 46, 48, 57, 65, 90, 32, 36, 95,
64
- 45, 46, 48, 57, 65, 90, 32, 36, 95, 45, 46, 48,
65
- 57, 65, 90, 32, 36, 95, 45, 46, 48, 57, 65, 90,
66
- 32, 36, 95, 45, 46, 48, 57, 65, 90, 32, 36, 95,
67
- 45, 46, 48, 57, 65, 90, 32, 36, 95, 45, 46, 48,
68
- 57, 65, 90, 32, 36, 95, 45, 46, 48, 57, 65, 90,
69
- 32, 36, 95, 45, 46, 48, 57, 65, 90, 32, 36, 95,
70
- 45, 46, 48, 57, 65, 90, 32, 36, 95, 45, 46, 48,
71
- 57, 65, 90, 32, 36, 95, 45, 46, 48, 57, 65, 90,
72
- 32, 36, 95, 45, 46, 48, 57, 65, 90, 32, 36, 95,
73
- 45, 46, 48, 57, 65, 90, 32, 36, 95, 45, 46, 48,
74
- 57, 65, 90, 32, 36, 95, 45, 46, 48, 57, 65, 90,
75
- 32, 0
55
+ 48, 57, 65, 90, 94, 122, 13, 32, 13, 32, 60, 62,
56
+ 127, 0, 31, 34, 35, 32, 60, 62, 127, 0, 31, 34,
57
+ 35, 43, 58, 45, 46, 48, 57, 65, 90, 97, 122, 32,
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
76
75
  };
77
76
  }
78
77
 
@@ -83,7 +82,7 @@ private static byte[] init__puma_parser_single_lengths_0()
83
82
  {
84
83
  return new byte [] {
85
84
  0, 2, 3, 4, 2, 1, 1, 1, 1, 1, 0, 1,
86
- 0, 1, 1, 4, 1, 4, 3, 2, 4, 4, 2, 6,
85
+ 0, 1, 1, 4, 1, 4, 2, 1, 4, 4, 2, 6,
87
86
  7, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3,
88
87
  3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 0
89
88
  };
@@ -96,7 +95,7 @@ private static byte[] init__puma_parser_range_lengths_0()
96
95
  {
97
96
  return new byte [] {
98
97
  0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 1, 1,
99
- 1, 1, 0, 6, 0, 6, 2, 2, 2, 2, 4, 1,
98
+ 1, 1, 0, 6, 0, 6, 0, 0, 2, 2, 4, 1,
100
99
  1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
101
100
  3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0
102
101
  };
@@ -109,9 +108,9 @@ private static short[] init__puma_parser_index_offsets_0()
109
108
  {
110
109
  return new short [] {
111
110
  0, 0, 6, 13, 21, 24, 26, 28, 30, 32, 34, 36,
112
- 39, 41, 44, 46, 57, 59, 70, 76, 81, 88, 95, 102,
113
- 110, 119, 127, 135, 142, 149, 156, 163, 170, 177, 184, 191,
114
- 198, 205, 212, 219, 226, 233, 240, 247, 254, 261, 263
111
+ 39, 41, 44, 46, 57, 59, 70, 73, 75, 82, 89, 96,
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
115
114
  };
116
115
  }
117
116
 
@@ -127,23 +126,22 @@ private static byte[] init__puma_parser_indicies_0()
127
126
  16, 15, 1, 17, 1, 18, 17, 1, 19, 1, 20, 21,
128
127
  21, 21, 21, 21, 21, 21, 21, 21, 1, 22, 1, 23,
129
128
  24, 23, 23, 23, 23, 23, 23, 23, 23, 1, 26, 27,
130
- 1, 1, 1, 25, 29, 1, 1, 1, 28, 30, 1, 1,
131
- 1, 1, 1, 31, 32, 1, 1, 1, 1, 1, 33, 34,
132
- 35, 34, 34, 34, 34, 1, 8, 1, 9, 1, 1, 1,
133
- 1, 35, 36, 1, 38, 1, 1, 39, 1, 1, 37, 40,
134
- 1, 42, 1, 1, 1, 1, 41, 43, 1, 45, 1, 1,
135
- 1, 1, 44, 2, 46, 46, 46, 46, 46, 1, 2, 47,
136
- 47, 47, 47, 47, 1, 2, 48, 48, 48, 48, 48, 1,
137
- 2, 49, 49, 49, 49, 49, 1, 2, 50, 50, 50, 50,
138
- 50, 1, 2, 51, 51, 51, 51, 51, 1, 2, 52, 52,
139
- 52, 52, 52, 1, 2, 53, 53, 53, 53, 53, 1, 2,
140
- 54, 54, 54, 54, 54, 1, 2, 55, 55, 55, 55, 55,
141
- 1, 2, 56, 56, 56, 56, 56, 1, 2, 57, 57, 57,
142
- 57, 57, 1, 2, 58, 58, 58, 58, 58, 1, 2, 59,
143
- 59, 59, 59, 59, 1, 2, 60, 60, 60, 60, 60, 1,
144
- 2, 61, 61, 61, 61, 61, 1, 2, 62, 62, 62, 62,
145
- 62, 1, 2, 63, 63, 63, 63, 63, 1, 2, 1, 1,
146
- 0
129
+ 25, 29, 28, 30, 1, 1, 1, 1, 1, 31, 32, 1,
130
+ 1, 1, 1, 1, 33, 34, 35, 34, 34, 34, 34, 1,
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
147
145
  };
148
146
  }
149
147
 
@@ -219,7 +217,7 @@ static final int puma_parser_en_main = 1;
219
217
  cs = puma_parser_start;
220
218
  }
221
219
 
222
- // line 88 "ext/puma_http11/http11_parser.java.rl"
220
+ // line 90 "ext/puma_http11/http11_parser.java.rl"
223
221
 
224
222
  body_start = 0;
225
223
  content_len = 0;
@@ -422,7 +420,7 @@ case 5:
422
420
  break; }
423
421
  }
424
422
 
425
- // line 114 "ext/puma_http11/http11_parser.java.rl"
423
+ // line 116 "ext/puma_http11/http11_parser.java.rl"
426
424
 
427
425
  parser.cs = cs;
428
426
  parser.nread += (p - off);
File without changes
@@ -54,7 +54,7 @@ DEF_MAX_LENGTH(FIELD_NAME, 256);
54
54
  DEF_MAX_LENGTH(FIELD_VALUE, 80 * 1024);
55
55
  DEF_MAX_LENGTH(REQUEST_URI, 1024 * 12);
56
56
  DEF_MAX_LENGTH(FRAGMENT, 1024); /* Don't know if this length is specified somewhere or not */
57
- DEF_MAX_LENGTH(REQUEST_PATH, 2048);
57
+ DEF_MAX_LENGTH(REQUEST_PATH, 8196);
58
58
  DEF_MAX_LENGTH(QUERY_STRING, (1024 * 10));
59
59
  DEF_MAX_LENGTH(HEADER, (1024 * (80 + 32)));
60
60
 
@@ -112,21 +112,6 @@ static struct common_field common_http_fields[] = {
112
112
  # undef f
113
113
  };
114
114
 
115
- /*
116
- * qsort(3) and bsearch(3) improve average performance slightly, but may
117
- * not be worth it for lack of portability to certain platforms...
118
- */
119
- #if defined(HAVE_QSORT_BSEARCH)
120
- /* sort by length, then by name if there's a tie */
121
- static int common_field_cmp(const void *a, const void *b)
122
- {
123
- struct common_field *cfa = (struct common_field *)a;
124
- struct common_field *cfb = (struct common_field *)b;
125
- signed long diff = cfa->len - cfb->len;
126
- return diff ? diff : memcmp(cfa->name, cfb->name, cfa->len);
127
- }
128
- #endif /* HAVE_QSORT_BSEARCH */
129
-
130
115
  static void init_common_fields(void)
131
116
  {
132
117
  unsigned i;
@@ -143,28 +128,10 @@ static void init_common_fields(void)
143
128
  }
144
129
  rb_global_variable(&cf->value);
145
130
  }
146
-
147
- #if defined(HAVE_QSORT_BSEARCH)
148
- qsort(common_http_fields,
149
- ARRAY_SIZE(common_http_fields),
150
- sizeof(struct common_field),
151
- common_field_cmp);
152
- #endif /* HAVE_QSORT_BSEARCH */
153
131
  }
154
132
 
155
133
  static VALUE find_common_field_value(const char *field, size_t flen)
156
134
  {
157
- #if defined(HAVE_QSORT_BSEARCH)
158
- struct common_field key;
159
- struct common_field *found;
160
- key.name = field;
161
- key.len = (signed long)flen;
162
- found = (struct common_field *)bsearch(&key, common_http_fields,
163
- ARRAY_SIZE(common_http_fields),
164
- sizeof(struct common_field),
165
- common_field_cmp);
166
- return found ? found->value : Qnil;
167
- #else /* !HAVE_QSORT_BSEARCH */
168
135
  unsigned i;
169
136
  struct common_field *cf = common_http_fields;
170
137
  for(i = 0; i < ARRAY_SIZE(common_http_fields); i++, cf++) {
@@ -172,7 +139,6 @@ static VALUE find_common_field_value(const char *field, size_t flen)
172
139
  return cf->value;
173
140
  }
174
141
  return Qnil;
175
- #endif /* !HAVE_QSORT_BSEARCH */
176
142
  }
177
143
 
178
144
  void http_field(puma_parser* hp, const char *field, size_t flen,
@@ -401,7 +367,7 @@ VALUE HttpParser_execute(VALUE self, VALUE req_hash, VALUE data, VALUE start)
401
367
  VALIDATE_MAX_LENGTH(puma_parser_nread(http), HEADER);
402
368
 
403
369
  if(puma_parser_has_error(http)) {
404
- rb_raise(eHttpParserError, "%s", "Invalid HTTP format, parsing fails.");
370
+ rb_raise(eHttpParserError, "%s", "Invalid HTTP format, parsing fails. Are you trying to open an SSL connection to a non-SSL Puma?");
405
371
  } else {
406
372
  return INT2FIX(puma_parser_nread(http));
407
373
  }
@@ -468,7 +434,6 @@ VALUE HttpParser_body(VALUE self) {
468
434
  return http->body;
469
435
  }
470
436
 
471
- void Init_io_buffer(VALUE puma);
472
437
  void Init_mini_ssl(VALUE mod);
473
438
 
474
439
  void Init_puma_http11()
@@ -498,6 +463,5 @@ void Init_puma_http11()
498
463
  rb_define_method(cHttpParser, "body", HttpParser_body, 0);
499
464
  init_common_fields();
500
465
 
501
- Init_io_buffer(mPuma);
502
466
  Init_mini_ssl(mPuma);
503
467
  }
File without changes
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'json'
4
+
3
5
  module Puma
4
6
  module App
5
7
  # Check out {#call}'s source code to see what actions this web application
@@ -17,10 +19,6 @@ module Puma
17
19
  return rack_response(403, 'Invalid auth token', 'text/plain')
18
20
  end
19
21
 
20
- if env['PATH_INFO'] =~ /\/(gc-stats|stats|thread-backtraces)$/
21
- require 'json'
22
- end
23
-
24
22
  case env['PATH_INFO']
25
23
  when /\/stop$/
26
24
  @cli.stop
@@ -56,7 +54,20 @@ module Puma
56
54
  rack_response(200, GC.stat.to_json)
57
55
 
58
56
  when /\/stats$/
59
- rack_response(200, @cli.stats)
57
+ rack_response(200, @cli.stats.to_json)
58
+
59
+ when /\/thread-backtraces$/
60
+ backtraces = []
61
+ @cli.thread_status do |name, backtrace|
62
+ backtraces << { name: name, backtrace: backtrace }
63
+ end
64
+
65
+ rack_response(200, backtraces.to_json)
66
+
67
+ when /\/refork$/
68
+ Process.kill "SIGURG", $$
69
+ rack_response(200, OK_STATUS)
70
+
60
71
  else
61
72
  rack_response 404, "Unsupported action", 'text/plain'
62
73
  end