puma 2.7.0 → 3.1.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 (79) hide show
  1. checksums.yaml +5 -13
  2. data/DEPLOYMENT.md +91 -0
  3. data/Gemfile +3 -2
  4. data/History.txt +624 -1
  5. data/Manifest.txt +15 -3
  6. data/README.md +129 -14
  7. data/Rakefile +3 -3
  8. data/bin/puma-wild +31 -0
  9. data/bin/pumactl +1 -1
  10. data/docs/nginx.md +1 -1
  11. data/docs/signals.md +43 -0
  12. data/ext/puma_http11/extconf.rb +7 -2
  13. data/ext/puma_http11/http11_parser.java.rl +5 -5
  14. data/ext/puma_http11/io_buffer.c +1 -1
  15. data/ext/puma_http11/mini_ssl.c +233 -18
  16. data/ext/puma_http11/org/jruby/puma/Http11.java +12 -3
  17. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +39 -39
  18. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +245 -195
  19. data/ext/puma_http11/puma_http11.c +12 -4
  20. data/lib/puma.rb +1 -0
  21. data/lib/puma/app/status.rb +7 -0
  22. data/lib/puma/binder.rb +108 -39
  23. data/lib/puma/capistrano.rb +23 -6
  24. data/lib/puma/cli.rb +141 -446
  25. data/lib/puma/client.rb +48 -1
  26. data/lib/puma/cluster.rb +207 -58
  27. data/lib/puma/commonlogger.rb +107 -0
  28. data/lib/puma/configuration.rb +262 -235
  29. data/lib/puma/const.rb +97 -14
  30. data/lib/puma/control_cli.rb +85 -77
  31. data/lib/puma/convenient.rb +23 -0
  32. data/lib/puma/daemon_ext.rb +11 -4
  33. data/lib/puma/detect.rb +8 -1
  34. data/lib/puma/dsl.rb +456 -0
  35. data/lib/puma/events.rb +35 -18
  36. data/lib/puma/jruby_restart.rb +1 -1
  37. data/lib/puma/launcher.rb +399 -0
  38. data/lib/puma/minissl.rb +49 -20
  39. data/lib/puma/null_io.rb +15 -0
  40. data/lib/puma/plugin.rb +104 -0
  41. data/lib/puma/plugin/tmp_restart.rb +35 -0
  42. data/lib/puma/rack/backports/uri/common_18.rb +56 -0
  43. data/lib/puma/rack/backports/uri/common_192.rb +52 -0
  44. data/lib/puma/rack/backports/uri/common_193.rb +29 -0
  45. data/lib/puma/rack/builder.rb +295 -0
  46. data/lib/puma/rack/urlmap.rb +90 -0
  47. data/lib/puma/reactor.rb +14 -1
  48. data/lib/puma/runner.rb +35 -17
  49. data/lib/puma/server.rb +161 -58
  50. data/lib/puma/single.rb +15 -10
  51. data/lib/puma/state_file.rb +29 -0
  52. data/lib/puma/thread_pool.rb +88 -13
  53. data/lib/puma/util.rb +123 -0
  54. data/lib/rack/handler/puma.rb +35 -29
  55. data/puma.gemspec +2 -4
  56. data/tools/jungle/init.d/README.md +2 -2
  57. data/tools/jungle/init.d/puma +69 -7
  58. data/tools/jungle/upstart/puma.conf +8 -2
  59. metadata +51 -71
  60. data/COPYING +0 -55
  61. data/TODO +0 -5
  62. data/lib/puma/rack_patch.rb +0 -45
  63. data/test/test_app_status.rb +0 -92
  64. data/test/test_cli.rb +0 -173
  65. data/test/test_config.rb +0 -16
  66. data/test/test_http10.rb +0 -27
  67. data/test/test_http11.rb +0 -145
  68. data/test/test_integration.rb +0 -165
  69. data/test/test_iobuffer.rb +0 -38
  70. data/test/test_minissl.rb +0 -25
  71. data/test/test_null_io.rb +0 -31
  72. data/test/test_persistent.rb +0 -238
  73. data/test/test_puma_server.rb +0 -292
  74. data/test/test_rack_handler.rb +0 -10
  75. data/test/test_rack_server.rb +0 -141
  76. data/test/test_tcp_rack.rb +0 -42
  77. data/test/test_thread_pool.rb +0 -156
  78. data/test/test_unix_socket.rb +0 -39
  79. data/test/test_ws.rb +0 -89
@@ -116,7 +116,7 @@ static VALUE buf_to_str(VALUE self) {
116
116
  struct buf_int* b;
117
117
  Data_Get_Struct(self, struct buf_int, b);
118
118
 
119
- return rb_str_new(b->top, b->cur - b->top);
119
+ return rb_str_new((const char*)(b->top), b->cur - b->top);
120
120
  }
121
121
 
122
122
  static VALUE buf_used(VALUE self) {
@@ -1,9 +1,25 @@
1
1
  #define RSTRING_NOT_MODIFIED 1
2
+
2
3
  #include <ruby.h>
4
+ #include <ruby/version.h>
5
+
6
+ #if RUBY_API_VERSION_MAJOR == 1
3
7
  #include <rubyio.h>
8
+ #else
9
+ #include <ruby/io.h>
10
+ #endif
11
+
12
+ #ifdef HAVE_OPENSSL_BIO_H
13
+
4
14
  #include <openssl/bio.h>
5
15
  #include <openssl/ssl.h>
16
+ #include <openssl/dh.h>
6
17
  #include <openssl/err.h>
18
+ #include <openssl/x509.h>
19
+
20
+ #ifndef SSL_OP_NO_COMPRESSION
21
+ #define SSL_OP_NO_COMPRESSION 0
22
+ #endif
7
23
 
8
24
  typedef struct {
9
25
  BIO* read;
@@ -12,9 +28,19 @@ typedef struct {
12
28
  SSL_CTX* ctx;
13
29
  } ms_conn;
14
30
 
31
+ typedef struct {
32
+ unsigned char* buf;
33
+ int bytes;
34
+ } ms_cert_buf;
35
+
15
36
  void engine_free(ms_conn* conn) {
16
- BIO_free(conn->read);
17
- BIO_free(conn->write);
37
+ ms_cert_buf* cert_buf = (ms_cert_buf*)SSL_get_app_data(conn->ssl);
38
+ if(cert_buf) {
39
+ OPENSSL_free(cert_buf->buf);
40
+ free(cert_buf);
41
+ }
42
+ SSL_free(conn->ssl);
43
+ SSL_CTX_free(conn->ctx);
18
44
 
19
45
  free(conn);
20
46
  }
@@ -36,27 +62,122 @@ ms_conn* engine_alloc(VALUE klass, VALUE* obj) {
36
62
  return conn;
37
63
  }
38
64
 
39
- VALUE engine_init_server(VALUE self, VALUE key, VALUE cert) {
65
+ DH *get_dh1024() {
66
+ /* `openssl dhparam 1024 -C`
67
+ * -----BEGIN DH PARAMETERS-----
68
+ * MIGHAoGBALPwcEv0OstmQCZdfHw0N5r+07lmXMxkpQacy1blwj0LUqC+Divp6pBk
69
+ * usTJ9W2/dOYr1X7zi6yXNLp4oLzc/31PUL3D9q8CpGS7vPz5gijKSw9BwCTT5z9+
70
+ * KF9v46qw8XqT5HHV87sWFlGQcVFq+pEkA2kPikkKZ/X/CCcpCAV7AgEC
71
+ * -----END DH PARAMETERS-----
72
+ */
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
85
+ };
86
+ static unsigned char dh1024_g[] = { 0x02 };
87
+
88
+ DH *dh;
89
+ dh = DH_new();
90
+ dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
91
+ dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
92
+
93
+ if ((dh->p == NULL) || (dh->g == NULL)) {
94
+ DH_free(dh);
95
+ return NULL;
96
+ }
97
+
98
+ return dh;
99
+ }
100
+
101
+ static int engine_verify_callback(int preverify_ok, X509_STORE_CTX* ctx) {
102
+ X509* err_cert;
103
+ SSL* ssl;
104
+ int bytes;
105
+ unsigned char* buf = NULL;
106
+
107
+ if(!preverify_ok) {
108
+ err_cert = X509_STORE_CTX_get_current_cert(ctx);
109
+ if(err_cert) {
110
+ /*
111
+ * Save the failed certificate for inspection/logging.
112
+ */
113
+ bytes = i2d_X509(err_cert, &buf);
114
+ if(bytes > 0) {
115
+ ms_cert_buf* cert_buf = (ms_cert_buf*)malloc(sizeof(ms_cert_buf));
116
+ cert_buf->buf = buf;
117
+ cert_buf->bytes = bytes;
118
+ ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
119
+ SSL_set_app_data(ssl, cert_buf);
120
+ }
121
+ }
122
+ }
123
+
124
+ return preverify_ok;
125
+ }
126
+
127
+ VALUE engine_init_server(VALUE self, VALUE mini_ssl_ctx) {
40
128
  VALUE obj;
41
129
  SSL_CTX* ctx;
42
130
  SSL* ssl;
43
131
 
44
132
  ms_conn* conn = engine_alloc(self, &obj);
45
133
 
46
- StringValue(key);
47
- StringValue(cert);
134
+ ID sym_key = rb_intern("key");
135
+ VALUE key = rb_funcall(mini_ssl_ctx, sym_key, 0);
136
+
137
+ ID sym_cert = rb_intern("cert");
138
+ VALUE cert = rb_funcall(mini_ssl_ctx, sym_cert, 0);
139
+
140
+ ID sym_ca = rb_intern("ca");
141
+ VALUE ca = rb_funcall(mini_ssl_ctx, sym_ca, 0);
142
+
143
+ ID sym_verify_mode = rb_intern("verify_mode");
144
+ VALUE verify_mode = rb_funcall(mini_ssl_ctx, sym_verify_mode, 0);
48
145
 
49
146
  ctx = SSL_CTX_new(SSLv23_server_method());
50
147
  conn->ctx = ctx;
51
148
 
52
- SSL_CTX_use_certificate_file(ctx, RSTRING_PTR(cert), SSL_FILETYPE_PEM);
149
+ SSL_CTX_use_certificate_chain_file(ctx, RSTRING_PTR(cert));
53
150
  SSL_CTX_use_PrivateKey_file(ctx, RSTRING_PTR(key), SSL_FILETYPE_PEM);
54
- /* SSL_CTX_set_options(ctx, SSL_OP_SINGLE_DH_USE); */
55
151
 
56
- ssl = SSL_new(ctx);
152
+ if (!NIL_P(ca)) {
153
+ SSL_CTX_load_verify_locations(ctx, RSTRING_PTR(ca), NULL);
154
+ }
155
+
156
+ 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);
157
+ SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF);
158
+
159
+ SSL_CTX_set_cipher_list(ctx, "HIGH:!aNULL@STRENGTH");
160
+
161
+ DH *dh = get_dh1024();
162
+ SSL_CTX_set_tmp_dh(ctx, dh);
163
+
164
+ #ifndef OPENSSL_NO_ECDH
165
+ EC_KEY *ecdh = EC_KEY_new_by_curve_name(NID_secp521r1);
166
+ if (ecdh) {
167
+ SSL_CTX_set_tmp_ecdh(ctx, ecdh);
168
+ EC_KEY_free(ecdh);
169
+ }
170
+ #endif
171
+
172
+ ssl = SSL_new(ctx);
57
173
  conn->ssl = ssl;
174
+ SSL_set_app_data(ssl, NULL);
58
175
 
59
- /* SSL_set_verify(ssl, SSL_VERIFY_NONE, NULL); */
176
+ if (NIL_P(verify_mode)) {
177
+ /* SSL_set_verify(ssl, SSL_VERIFY_NONE, NULL); */
178
+ } else {
179
+ SSL_set_verify(ssl, NUM2INT(verify_mode), engine_verify_callback);
180
+ }
60
181
 
61
182
  SSL_set_bio(ssl, conn->read, conn->write);
62
183
 
@@ -70,6 +191,7 @@ VALUE engine_init_client(VALUE klass) {
70
191
 
71
192
  conn->ctx = SSL_CTX_new(DTLSv1_method());
72
193
  conn->ssl = SSL_new(conn->ctx);
194
+ SSL_set_app_data(conn->ssl, NULL);
73
195
  SSL_set_verify(conn->ssl, SSL_VERIFY_NONE, NULL);
74
196
 
75
197
  SSL_set_bio(conn->ssl, conn->read, conn->write);
@@ -98,20 +220,46 @@ VALUE engine_inject(VALUE self, VALUE str) {
98
220
  static VALUE eError;
99
221
 
100
222
  void raise_error(SSL* ssl, int result) {
101
- int error = SSL_get_error(ssl, result);
102
- char* msg = ERR_error_string(error, NULL);
223
+ char buf[512];
224
+ char msg[512];
225
+ const char* err_str;
226
+ int err = errno;
227
+ int ssl_err = SSL_get_error(ssl, result);
228
+ int verify_err = SSL_get_verify_result(ssl);
229
+
230
+ if(SSL_ERROR_SYSCALL == ssl_err) {
231
+ snprintf(msg, sizeof(msg), "System error: %s - %d", strerror(err), err);
232
+
233
+ } else if(SSL_ERROR_SSL == ssl_err) {
234
+ if(X509_V_OK != verify_err) {
235
+ err_str = X509_verify_cert_error_string(verify_err);
236
+ snprintf(msg, sizeof(msg),
237
+ "OpenSSL certificate verification error: %s - %d",
238
+ err_str, verify_err);
239
+
240
+ } else {
241
+ err = ERR_get_error();
242
+ ERR_error_string_n(err, buf, sizeof(buf));
243
+ snprintf(msg, sizeof(msg), "OpenSSL error: %s - %d", buf, err);
244
+
245
+ }
246
+ } else {
247
+ snprintf(msg, sizeof(msg), "Unknown OpenSSL error: %d", ssl_err);
248
+ }
103
249
 
104
250
  ERR_clear_error();
105
- rb_raise(eError, "OpenSSL error: %s - %d", msg, error);
251
+ rb_raise(eError, "%s", msg);
106
252
  }
107
253
 
108
254
  VALUE engine_read(VALUE self) {
109
255
  ms_conn* conn;
110
256
  char buf[512];
111
- int bytes, n;
257
+ int bytes, error;
112
258
 
113
259
  Data_Get_Struct(self, ms_conn, conn);
114
260
 
261
+ ERR_clear_error();
262
+
115
263
  bytes = SSL_read(conn->ssl, (void*)buf, sizeof(buf));
116
264
 
117
265
  if(bytes > 0) {
@@ -120,24 +268,27 @@ VALUE engine_read(VALUE self) {
120
268
 
121
269
  if(SSL_want_read(conn->ssl)) return Qnil;
122
270
 
123
- if(SSL_get_error(conn->ssl, bytes) == SSL_ERROR_ZERO_RETURN) {
271
+ error = SSL_get_error(conn->ssl, bytes);
272
+
273
+ if(error == SSL_ERROR_ZERO_RETURN) {
124
274
  rb_eof_error();
275
+ } else {
276
+ raise_error(conn->ssl, bytes);
125
277
  }
126
278
 
127
- raise_error(conn->ssl, bytes);
128
-
129
279
  return Qnil;
130
280
  }
131
281
 
132
282
  VALUE engine_write(VALUE self, VALUE str) {
133
283
  ms_conn* conn;
134
- char buf[512];
135
284
  int bytes;
136
285
 
137
286
  Data_Get_Struct(self, ms_conn, conn);
138
287
 
139
288
  StringValue(str);
140
289
 
290
+ ERR_clear_error();
291
+
141
292
  bytes = SSL_write(conn->ssl, (void*)RSTRING_PTR(str), (int)RSTRING_LEN(str));
142
293
  if(bytes > 0) {
143
294
  return INT2FIX(bytes);
@@ -171,6 +322,49 @@ VALUE engine_extract(VALUE self) {
171
322
  return Qnil;
172
323
  }
173
324
 
325
+ VALUE engine_peercert(VALUE self) {
326
+ ms_conn* conn;
327
+ X509* cert;
328
+ int bytes;
329
+ unsigned char* buf = NULL;
330
+ ms_cert_buf* cert_buf = NULL;
331
+ VALUE rb_cert_buf;
332
+
333
+ Data_Get_Struct(self, ms_conn, conn);
334
+
335
+ cert = SSL_get_peer_certificate(conn->ssl);
336
+ if(!cert) {
337
+ /*
338
+ * See if there was a failed certificate associated with this client.
339
+ */
340
+ cert_buf = (ms_cert_buf*)SSL_get_app_data(conn->ssl);
341
+ if(!cert_buf) {
342
+ return Qnil;
343
+ }
344
+ buf = cert_buf->buf;
345
+ bytes = cert_buf->bytes;
346
+
347
+ } else {
348
+ bytes = i2d_X509(cert, &buf);
349
+ X509_free(cert);
350
+
351
+ if(bytes < 0) {
352
+ return Qnil;
353
+ }
354
+ }
355
+
356
+ rb_cert_buf = rb_str_new((const char*)(buf), bytes);
357
+ if(!cert_buf) {
358
+ OPENSSL_free(buf);
359
+ }
360
+
361
+ return rb_cert_buf;
362
+ }
363
+
364
+ VALUE noop(VALUE self) {
365
+ return Qnil;
366
+ }
367
+
174
368
  void Init_mini_ssl(VALUE puma) {
175
369
  VALUE mod, eng;
176
370
 
@@ -182,9 +376,11 @@ void Init_mini_ssl(VALUE puma) {
182
376
  mod = rb_define_module_under(puma, "MiniSSL");
183
377
  eng = rb_define_class_under(mod, "Engine", rb_cObject);
184
378
 
379
+ rb_define_singleton_method(mod, "check", noop, 0);
380
+
185
381
  eError = rb_define_class_under(mod, "SSLError", rb_eStandardError);
186
382
 
187
- rb_define_singleton_method(eng, "server", engine_init_server, 2);
383
+ rb_define_singleton_method(eng, "server", engine_init_server, 1);
188
384
  rb_define_singleton_method(eng, "client", engine_init_client, 0);
189
385
 
190
386
  rb_define_method(eng, "inject", engine_inject, 1);
@@ -192,4 +388,23 @@ void Init_mini_ssl(VALUE puma) {
192
388
 
193
389
  rb_define_method(eng, "write", engine_write, 1);
194
390
  rb_define_method(eng, "extract", engine_extract, 0);
391
+
392
+ rb_define_method(eng, "peercert", engine_peercert, 0);
393
+ }
394
+
395
+ #else
396
+
397
+ VALUE raise_error(VALUE self) {
398
+ rb_raise(rb_eStandardError, "SSL not available in this build");
399
+ return Qnil;
400
+ }
401
+
402
+ void Init_mini_ssl(VALUE puma) {
403
+ VALUE mod, eng;
404
+
405
+ mod = rb_define_module_under(puma, "MiniSSL");
406
+ rb_define_class_under(mod, "SSLError", rb_eStandardError);
407
+
408
+ rb_define_singleton_method(mod, "check", raise_error, 0);
195
409
  }
410
+ #endif
@@ -82,11 +82,11 @@ public class Http11 extends RubyObject {
82
82
  private Http11Parser.FieldCB http_field = new Http11Parser.FieldCB() {
83
83
  public void call(Object data, int field, int flen, int value, int vlen) {
84
84
  RubyHash req = (RubyHash)data;
85
- RubyString v,f;
85
+ RubyString f;
86
+ IRubyObject v;
86
87
  validateMaxLength(flen, MAX_FIELD_NAME_LENGTH, MAX_FIELD_NAME_LENGTH_ERR);
87
88
  validateMaxLength(vlen, MAX_FIELD_VALUE_LENGTH, MAX_FIELD_VALUE_LENGTH_ERR);
88
89
 
89
- v = RubyString.newString(runtime, new ByteList(Http11.this.hp.parser.buffer,value,vlen));
90
90
  ByteList b = new ByteList(Http11.this.hp.parser.buffer,field,flen);
91
91
  for(int i = 0,j = b.length();i<j;i++) {
92
92
  if((b.get(i) & 0xFF) == '-') {
@@ -104,7 +104,16 @@ public class Http11 extends RubyObject {
104
104
  f = RubyString.newString(runtime, "HTTP_");
105
105
  f.cat(b);
106
106
  }
107
- req.op_aset(req.getRuntime().getCurrentContext(), f,v);
107
+
108
+ b = new ByteList(Http11.this.hp.parser.buffer, value, vlen);
109
+ v = req.op_aref(req.getRuntime().getCurrentContext(), f);
110
+ if (v.isNil()) {
111
+ req.op_aset(req.getRuntime().getCurrentContext(), f, RubyString.newString(runtime, b));
112
+ } else {
113
+ RubyString vs = v.convertToString();
114
+ vs.cat(RubyString.newString(runtime, ", "));
115
+ vs.cat(b);
116
+ }
108
117
  }
109
118
  };
110
119
 
@@ -15,7 +15,7 @@ public class Http11Parser {
15
15
  /** Data **/
16
16
 
17
17
  // line 18 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
18
- private static byte[] init__http_parser_actions_0()
18
+ private static byte[] init__puma_parser_actions_0()
19
19
  {
20
20
  return new byte [] {
21
21
  0, 1, 0, 1, 2, 1, 3, 1, 4, 1, 5, 1,
@@ -25,10 +25,10 @@ private static byte[] init__http_parser_actions_0()
25
25
  };
26
26
  }
27
27
 
28
- private static final byte _http_parser_actions[] = init__http_parser_actions_0();
28
+ private static final byte _puma_parser_actions[] = init__puma_parser_actions_0();
29
29
 
30
30
 
31
- private static short[] init__http_parser_key_offsets_0()
31
+ private static short[] init__puma_parser_key_offsets_0()
32
32
  {
33
33
  return new short [] {
34
34
  0, 0, 8, 17, 27, 29, 30, 31, 32, 33, 34, 36,
@@ -39,10 +39,10 @@ private static short[] init__http_parser_key_offsets_0()
39
39
  };
40
40
  }
41
41
 
42
- private static final short _http_parser_key_offsets[] = init__http_parser_key_offsets_0();
42
+ private static final short _puma_parser_key_offsets[] = init__puma_parser_key_offsets_0();
43
43
 
44
44
 
45
- private static char[] init__http_parser_trans_keys_0()
45
+ private static char[] init__puma_parser_trans_keys_0()
46
46
  {
47
47
  return new char [] {
48
48
  36, 95, 45, 46, 48, 57, 65, 90, 32, 36, 95, 45,
@@ -80,10 +80,10 @@ private static char[] init__http_parser_trans_keys_0()
80
80
  };
81
81
  }
82
82
 
83
- private static final char _http_parser_trans_keys[] = init__http_parser_trans_keys_0();
83
+ private static final char _puma_parser_trans_keys[] = init__puma_parser_trans_keys_0();
84
84
 
85
85
 
86
- private static byte[] init__http_parser_single_lengths_0()
86
+ private static byte[] init__puma_parser_single_lengths_0()
87
87
  {
88
88
  return new byte [] {
89
89
  0, 2, 3, 4, 2, 1, 1, 1, 1, 1, 0, 1,
@@ -94,10 +94,10 @@ private static byte[] init__http_parser_single_lengths_0()
94
94
  };
95
95
  }
96
96
 
97
- private static final byte _http_parser_single_lengths[] = init__http_parser_single_lengths_0();
97
+ private static final byte _puma_parser_single_lengths[] = init__puma_parser_single_lengths_0();
98
98
 
99
99
 
100
- private static byte[] init__http_parser_range_lengths_0()
100
+ private static byte[] init__puma_parser_range_lengths_0()
101
101
  {
102
102
  return new byte [] {
103
103
  0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 1, 1,
@@ -108,10 +108,10 @@ private static byte[] init__http_parser_range_lengths_0()
108
108
  };
109
109
  }
110
110
 
111
- private static final byte _http_parser_range_lengths[] = init__http_parser_range_lengths_0();
111
+ private static final byte _puma_parser_range_lengths[] = init__puma_parser_range_lengths_0();
112
112
 
113
113
 
114
- private static short[] init__http_parser_index_offsets_0()
114
+ private static short[] init__puma_parser_index_offsets_0()
115
115
  {
116
116
  return new short [] {
117
117
  0, 0, 6, 13, 21, 24, 26, 28, 30, 32, 34, 36,
@@ -122,10 +122,10 @@ private static short[] init__http_parser_index_offsets_0()
122
122
  };
123
123
  }
124
124
 
125
- private static final short _http_parser_index_offsets[] = init__http_parser_index_offsets_0();
125
+ private static final short _puma_parser_index_offsets[] = init__puma_parser_index_offsets_0();
126
126
 
127
127
 
128
- private static byte[] init__http_parser_indicies_0()
128
+ private static byte[] init__puma_parser_indicies_0()
129
129
  {
130
130
  return new byte [] {
131
131
  0, 0, 0, 0, 0, 1, 2, 3, 3, 3, 3, 3,
@@ -158,10 +158,10 @@ private static byte[] init__http_parser_indicies_0()
158
158
  };
159
159
  }
160
160
 
161
- private static final byte _http_parser_indicies[] = init__http_parser_indicies_0();
161
+ private static final byte _puma_parser_indicies[] = init__puma_parser_indicies_0();
162
162
 
163
163
 
164
- private static byte[] init__http_parser_trans_targs_0()
164
+ private static byte[] init__puma_parser_trans_targs_0()
165
165
  {
166
166
  return new byte [] {
167
167
  2, 0, 3, 38, 4, 24, 28, 25, 5, 20, 6, 7,
@@ -174,10 +174,10 @@ private static byte[] init__http_parser_trans_targs_0()
174
174
  };
175
175
  }
176
176
 
177
- private static final byte _http_parser_trans_targs[] = init__http_parser_trans_targs_0();
177
+ private static final byte _puma_parser_trans_targs[] = init__puma_parser_trans_targs_0();
178
178
 
179
179
 
180
- private static byte[] init__http_parser_trans_actions_0()
180
+ private static byte[] init__puma_parser_trans_actions_0()
181
181
  {
182
182
  return new byte [] {
183
183
  1, 0, 11, 0, 1, 1, 1, 1, 13, 13, 1, 0,
@@ -190,14 +190,14 @@ private static byte[] init__http_parser_trans_actions_0()
190
190
  };
191
191
  }
192
192
 
193
- private static final byte _http_parser_trans_actions[] = init__http_parser_trans_actions_0();
193
+ private static final byte _puma_parser_trans_actions[] = init__puma_parser_trans_actions_0();
194
194
 
195
195
 
196
- static final int http_parser_start = 1;
197
- static final int http_parser_first_final = 57;
198
- static final int http_parser_error = 0;
196
+ static final int puma_parser_start = 1;
197
+ static final int puma_parser_first_final = 57;
198
+ static final int puma_parser_error = 0;
199
199
 
200
- static final int http_parser_en_main = 1;
200
+ static final int puma_parser_en_main = 1;
201
201
 
202
202
 
203
203
  // line 69 "ext/puma_http11/http11_parser.java.rl"
@@ -238,7 +238,7 @@ static final int http_parser_en_main = 1;
238
238
 
239
239
  // line 240 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
240
240
  {
241
- cs = http_parser_start;
241
+ cs = puma_parser_start;
242
242
  }
243
243
 
244
244
  // line 104 "ext/puma_http11/http11_parser.java.rl"
@@ -290,9 +290,9 @@ static final int http_parser_en_main = 1;
290
290
  }
291
291
  case 1:
292
292
  _match: do {
293
- _keys = _http_parser_key_offsets[cs];
294
- _trans = _http_parser_index_offsets[cs];
295
- _klen = _http_parser_single_lengths[cs];
293
+ _keys = _puma_parser_key_offsets[cs];
294
+ _trans = _puma_parser_index_offsets[cs];
295
+ _klen = _puma_parser_single_lengths[cs];
296
296
  if ( _klen > 0 ) {
297
297
  int _lower = _keys;
298
298
  int _mid;
@@ -302,9 +302,9 @@ case 1:
302
302
  break;
303
303
 
304
304
  _mid = _lower + ((_upper-_lower) >> 1);
305
- if ( data[p] < _http_parser_trans_keys[_mid] )
305
+ if ( data[p] < _puma_parser_trans_keys[_mid] )
306
306
  _upper = _mid - 1;
307
- else if ( data[p] > _http_parser_trans_keys[_mid] )
307
+ else if ( data[p] > _puma_parser_trans_keys[_mid] )
308
308
  _lower = _mid + 1;
309
309
  else {
310
310
  _trans += (_mid - _keys);
@@ -315,7 +315,7 @@ case 1:
315
315
  _trans += _klen;
316
316
  }
317
317
 
318
- _klen = _http_parser_range_lengths[cs];
318
+ _klen = _puma_parser_range_lengths[cs];
319
319
  if ( _klen > 0 ) {
320
320
  int _lower = _keys;
321
321
  int _mid;
@@ -325,9 +325,9 @@ case 1:
325
325
  break;
326
326
 
327
327
  _mid = _lower + (((_upper-_lower) >> 1) & ~1);
328
- if ( data[p] < _http_parser_trans_keys[_mid] )
328
+ if ( data[p] < _puma_parser_trans_keys[_mid] )
329
329
  _upper = _mid - 2;
330
- else if ( data[p] > _http_parser_trans_keys[_mid+1] )
330
+ else if ( data[p] > _puma_parser_trans_keys[_mid+1] )
331
331
  _lower = _mid + 2;
332
332
  else {
333
333
  _trans += ((_mid - _keys)>>1);
@@ -338,15 +338,15 @@ case 1:
338
338
  }
339
339
  } while (false);
340
340
 
341
- _trans = _http_parser_indicies[_trans];
342
- cs = _http_parser_trans_targs[_trans];
341
+ _trans = _puma_parser_indicies[_trans];
342
+ cs = _puma_parser_trans_targs[_trans];
343
343
 
344
- if ( _http_parser_trans_actions[_trans] != 0 ) {
345
- _acts = _http_parser_trans_actions[_trans];
346
- _nacts = (int) _http_parser_actions[_acts++];
344
+ if ( _puma_parser_trans_actions[_trans] != 0 ) {
345
+ _acts = _puma_parser_trans_actions[_trans];
346
+ _nacts = (int) _puma_parser_actions[_acts++];
347
347
  while ( _nacts-- > 0 )
348
348
  {
349
- switch ( _http_parser_actions[_acts++] )
349
+ switch ( _puma_parser_actions[_acts++] )
350
350
  {
351
351
  case 0:
352
352
  // line 13 "ext/puma_http11/http11_parser.java.rl"
@@ -479,10 +479,10 @@ case 5:
479
479
  }
480
480
 
481
481
  public boolean has_error() {
482
- return parser.cs == http_parser_error;
482
+ return parser.cs == puma_parser_error;
483
483
  }
484
484
 
485
485
  public boolean is_finished() {
486
- return parser.cs == http_parser_first_final;
486
+ return parser.cs == puma_parser_first_final;
487
487
  }
488
488
  }