puma 2.0.0.b5 → 5.0.0.beta1

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 (106) hide show
  1. checksums.yaml +7 -0
  2. data/History.md +1598 -0
  3. data/LICENSE +23 -20
  4. data/README.md +222 -62
  5. data/bin/puma-wild +31 -0
  6. data/bin/pumactl +1 -1
  7. data/docs/architecture.md +37 -0
  8. data/docs/deployment.md +113 -0
  9. data/docs/fork_worker.md +31 -0
  10. data/docs/images/puma-connection-flow-no-reactor.png +0 -0
  11. data/docs/images/puma-connection-flow.png +0 -0
  12. data/docs/images/puma-general-arch.png +0 -0
  13. data/docs/jungle/README.md +13 -0
  14. data/docs/jungle/rc.d/README.md +74 -0
  15. data/docs/jungle/rc.d/puma +61 -0
  16. data/docs/jungle/rc.d/puma.conf +10 -0
  17. data/docs/jungle/upstart/README.md +61 -0
  18. data/docs/jungle/upstart/puma-manager.conf +31 -0
  19. data/docs/jungle/upstart/puma.conf +69 -0
  20. data/docs/nginx.md +5 -10
  21. data/docs/plugins.md +38 -0
  22. data/docs/restart.md +41 -0
  23. data/docs/signals.md +97 -0
  24. data/docs/systemd.md +228 -0
  25. data/ext/puma_http11/PumaHttp11Service.java +2 -2
  26. data/ext/puma_http11/extconf.rb +23 -2
  27. data/ext/puma_http11/http11_parser.c +301 -482
  28. data/ext/puma_http11/http11_parser.h +13 -11
  29. data/ext/puma_http11/http11_parser.java.rl +26 -42
  30. data/ext/puma_http11/http11_parser.rl +22 -21
  31. data/ext/puma_http11/http11_parser_common.rl +5 -5
  32. data/ext/puma_http11/mini_ssl.c +377 -18
  33. data/ext/puma_http11/org/jruby/puma/Http11.java +108 -107
  34. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +137 -170
  35. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +265 -191
  36. data/ext/puma_http11/puma_http11.c +57 -81
  37. data/lib/puma.rb +25 -4
  38. data/lib/puma/accept_nonblock.rb +7 -1
  39. data/lib/puma/app/status.rb +61 -24
  40. data/lib/puma/binder.rb +212 -78
  41. data/lib/puma/cli.rb +149 -644
  42. data/lib/puma/client.rb +316 -65
  43. data/lib/puma/cluster.rb +659 -0
  44. data/lib/puma/commonlogger.rb +108 -0
  45. data/lib/puma/configuration.rb +279 -180
  46. data/lib/puma/const.rb +126 -39
  47. data/lib/puma/control_cli.rb +183 -96
  48. data/lib/puma/detect.rb +20 -1
  49. data/lib/puma/dsl.rb +776 -0
  50. data/lib/puma/events.rb +91 -23
  51. data/lib/puma/io_buffer.rb +9 -5
  52. data/lib/puma/jruby_restart.rb +9 -5
  53. data/lib/puma/launcher.rb +487 -0
  54. data/lib/puma/minissl.rb +239 -93
  55. data/lib/puma/minissl/context_builder.rb +76 -0
  56. data/lib/puma/null_io.rb +22 -12
  57. data/lib/puma/plugin.rb +111 -0
  58. data/lib/puma/plugin/tmp_restart.rb +36 -0
  59. data/lib/puma/rack/builder.rb +297 -0
  60. data/lib/puma/rack/urlmap.rb +93 -0
  61. data/lib/puma/rack_default.rb +9 -0
  62. data/lib/puma/reactor.rb +290 -43
  63. data/lib/puma/runner.rb +163 -0
  64. data/lib/puma/server.rb +493 -126
  65. data/lib/puma/single.rb +66 -0
  66. data/lib/puma/state_file.rb +34 -0
  67. data/lib/puma/thread_pool.rb +228 -47
  68. data/lib/puma/util.rb +115 -0
  69. data/lib/rack/handler/puma.rb +78 -31
  70. data/tools/Dockerfile +16 -0
  71. data/tools/trickletest.rb +44 -0
  72. metadata +60 -155
  73. data/COPYING +0 -55
  74. data/Gemfile +0 -8
  75. data/History.txt +0 -196
  76. data/Manifest.txt +0 -56
  77. data/Rakefile +0 -121
  78. data/TODO +0 -5
  79. data/docs/config.md +0 -0
  80. data/ext/puma_http11/io_buffer.c +0 -154
  81. data/lib/puma/capistrano.rb +0 -26
  82. data/lib/puma/compat.rb +0 -11
  83. data/lib/puma/daemon_ext.rb +0 -20
  84. data/lib/puma/delegation.rb +0 -11
  85. data/lib/puma/java_io_buffer.rb +0 -45
  86. data/lib/puma/rack_patch.rb +0 -25
  87. data/puma.gemspec +0 -45
  88. data/test/test_app_status.rb +0 -88
  89. data/test/test_cli.rb +0 -171
  90. data/test/test_config.rb +0 -16
  91. data/test/test_http10.rb +0 -27
  92. data/test/test_http11.rb +0 -126
  93. data/test/test_integration.rb +0 -150
  94. data/test/test_iobuffer.rb +0 -38
  95. data/test/test_minissl.rb +0 -22
  96. data/test/test_null_io.rb +0 -31
  97. data/test/test_persistent.rb +0 -238
  98. data/test/test_puma_server.rb +0 -128
  99. data/test/test_rack_handler.rb +0 -10
  100. data/test/test_rack_server.rb +0 -141
  101. data/test/test_thread_pool.rb +0 -146
  102. data/test/test_unix_socket.rb +0 -39
  103. data/test/test_ws.rb +0 -89
  104. data/tools/jungle/README.md +0 -54
  105. data/tools/jungle/puma +0 -332
  106. data/tools/jungle/run-puma +0 -3
@@ -11,7 +11,6 @@ import org.jruby.RubyString;
11
11
  import org.jruby.anno.JRubyMethod;
12
12
 
13
13
  import org.jruby.runtime.ObjectAllocator;
14
- import org.jruby.runtime.ThreadContext;
15
14
  import org.jruby.runtime.builtin.IRubyObject;
16
15
 
17
16
  import org.jruby.exceptions.RaiseException;
@@ -20,6 +19,7 @@ import org.jruby.util.ByteList;
20
19
 
21
20
  /**
22
21
  * @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
22
+ * @author <a href="mailto:headius@headius.com">Charles Oliver Nutter</a>
23
23
  */
24
24
  public class Http11 extends RubyObject {
25
25
  public final static int MAX_FIELD_NAME_LENGTH = 256;
@@ -30,13 +30,23 @@ 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 = 1024;
34
- public final static String MAX_REQUEST_PATH_LENGTH_ERR = "HTTP element REQUEST_PATH is longer than the 1024 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);
38
38
  public final static String MAX_HEADER_LENGTH_ERR = "HTTP element HEADER is longer than the 114688 allowed length.";
39
39
 
40
+ public static final ByteList CONTENT_TYPE_BYTELIST = new ByteList(ByteList.plain("CONTENT_TYPE"));
41
+ public static final ByteList CONTENT_LENGTH_BYTELIST = new ByteList(ByteList.plain("CONTENT_LENGTH"));
42
+ public static final ByteList HTTP_PREFIX_BYTELIST = new ByteList(ByteList.plain("HTTP_"));
43
+ public static final ByteList COMMA_SPACE_BYTELIST = new ByteList(ByteList.plain(", "));
44
+ public static final ByteList REQUEST_METHOD_BYTELIST = new ByteList(ByteList.plain("REQUEST_METHOD"));
45
+ public static final ByteList REQUEST_URI_BYTELIST = new ByteList(ByteList.plain("REQUEST_URI"));
46
+ public static final ByteList FRAGMENT_BYTELIST = new ByteList(ByteList.plain("FRAGMENT"));
47
+ public static final ByteList REQUEST_PATH_BYTELIST = new ByteList(ByteList.plain("REQUEST_PATH"));
48
+ public static final ByteList QUERY_STRING_BYTELIST = new ByteList(ByteList.plain("QUERY_STRING"));
49
+ public static final ByteList HTTP_VERSION_BYTELIST = new ByteList(ByteList.plain("HTTP_VERSION"));
40
50
 
41
51
  private static ObjectAllocator ALLOCATOR = new ObjectAllocator() {
42
52
  public IRubyObject allocate(Ruby runtime, RubyClass klass) {
@@ -53,118 +63,104 @@ public class Http11 extends RubyObject {
53
63
  }
54
64
 
55
65
  private Ruby runtime;
56
- private RubyClass eHttpParserError;
57
66
  private Http11Parser hp;
58
67
  private RubyString body;
59
68
 
60
69
  public Http11(Ruby runtime, RubyClass clazz) {
61
70
  super(runtime,clazz);
62
71
  this.runtime = runtime;
63
- this.eHttpParserError = (RubyClass)runtime.getModule("Puma").getConstant("HttpParserError");
64
72
  this.hp = new Http11Parser();
65
- this.hp.parser.http_field = http_field;
66
- this.hp.parser.request_method = request_method;
67
- this.hp.parser.request_uri = request_uri;
68
- this.hp.parser.fragment = fragment;
69
- this.hp.parser.request_path = request_path;
70
- this.hp.parser.query_string = query_string;
71
- this.hp.parser.http_version = http_version;
72
- this.hp.parser.header_done = header_done;
73
73
  this.hp.parser.init();
74
74
  }
75
75
 
76
- public void validateMaxLength(int len, int max, String msg) {
76
+ public static void validateMaxLength(Ruby runtime, int len, int max, String msg) {
77
77
  if(len>max) {
78
- throw new RaiseException(runtime, eHttpParserError, msg, true);
78
+ throw newHTTPParserError(runtime, msg);
79
79
  }
80
80
  }
81
81
 
82
- private Http11Parser.FieldCB http_field = new Http11Parser.FieldCB() {
83
- public void call(Object data, int field, int flen, int value, int vlen) {
84
- RubyHash req = (RubyHash)data;
85
- RubyString v,f;
86
- validateMaxLength(flen, MAX_FIELD_NAME_LENGTH, MAX_FIELD_NAME_LENGTH_ERR);
87
- validateMaxLength(vlen, MAX_FIELD_VALUE_LENGTH, MAX_FIELD_VALUE_LENGTH_ERR);
88
-
89
- v = RubyString.newString(runtime, new ByteList(Http11.this.hp.parser.buffer,value,vlen));
90
- ByteList b = new ByteList(Http11.this.hp.parser.buffer,field,flen);
91
- for(int i = 0,j = b.length();i<j;i++) {
92
- if((b.get(i) & 0xFF) == '-') {
93
- b.set(i, (byte)'_');
94
- } else {
95
- b.set(i, (byte)Character.toUpperCase((char)b.get(i)));
96
- }
97
- }
98
-
99
- String as = b.toString();
100
-
101
- if(as.equals("CONTENT_LENGTH") || as.equals("CONTENT_TYPE")) {
102
- f = RubyString.newString(runtime, b);
103
- } else {
104
- f = RubyString.newString(runtime, "HTTP_");
105
- f.cat(b);
106
- }
107
- req.op_aset(req.getRuntime().getCurrentContext(), f,v);
108
- }
109
- };
82
+ private static RaiseException newHTTPParserError(Ruby runtime, String msg) {
83
+ return runtime.newRaiseException(getHTTPParserError(runtime), msg);
84
+ }
110
85
 
111
- private Http11Parser.ElementCB request_method = new Http11Parser.ElementCB() {
112
- public void call(Object data, int at, int length) {
113
- RubyHash req = (RubyHash)data;
114
- RubyString val = RubyString.newString(runtime,new ByteList(hp.parser.buffer,at,length));
115
- req.op_aset(req.getRuntime().getCurrentContext(), runtime.newString("REQUEST_METHOD"),val);
116
- }
117
- };
118
-
119
- private Http11Parser.ElementCB request_uri = new Http11Parser.ElementCB() {
120
- public void call(Object data, int at, int length) {
121
- RubyHash req = (RubyHash)data;
122
- validateMaxLength(length, MAX_REQUEST_URI_LENGTH, MAX_REQUEST_URI_LENGTH_ERR);
123
- RubyString val = RubyString.newString(runtime,new ByteList(hp.parser.buffer,at,length));
124
- req.op_aset(req.getRuntime().getCurrentContext(), runtime.newString("REQUEST_URI"),val);
125
- }
126
- };
127
-
128
- private Http11Parser.ElementCB fragment = new Http11Parser.ElementCB() {
129
- public void call(Object data, int at, int length) {
130
- RubyHash req = (RubyHash)data;
131
- validateMaxLength(length, MAX_FRAGMENT_LENGTH, MAX_FRAGMENT_LENGTH_ERR);
132
- RubyString val = RubyString.newString(runtime,new ByteList(hp.parser.buffer,at,length));
133
- req.op_aset(req.getRuntime().getCurrentContext(), runtime.newString("FRAGMENT"),val);
134
- }
135
- };
136
-
137
- private Http11Parser.ElementCB request_path = new Http11Parser.ElementCB() {
138
- public void call(Object data, int at, int length) {
139
- RubyHash req = (RubyHash)data;
140
- validateMaxLength(length, MAX_REQUEST_PATH_LENGTH, MAX_REQUEST_PATH_LENGTH_ERR);
141
- RubyString val = RubyString.newString(runtime,new ByteList(hp.parser.buffer,at,length));
142
- req.op_aset(req.getRuntime().getCurrentContext(), runtime.newString("REQUEST_PATH"),val);
143
- }
144
- };
145
-
146
- private Http11Parser.ElementCB query_string = new Http11Parser.ElementCB() {
147
- public void call(Object data, int at, int length) {
148
- RubyHash req = (RubyHash)data;
149
- validateMaxLength(length, MAX_QUERY_STRING_LENGTH, MAX_QUERY_STRING_LENGTH_ERR);
150
- RubyString val = RubyString.newString(runtime,new ByteList(hp.parser.buffer,at,length));
151
- req.op_aset(req.getRuntime().getCurrentContext(), runtime.newString("QUERY_STRING"),val);
152
- }
153
- };
86
+ private static RubyClass getHTTPParserError(Ruby runtime) {
87
+ // Cheaper to look this up lazily than cache eagerly and consume a field, since it's rarely encountered
88
+ return (RubyClass)runtime.getModule("Puma").getConstant("HttpParserError");
89
+ }
154
90
 
155
- private Http11Parser.ElementCB http_version = new Http11Parser.ElementCB() {
156
- public void call(Object data, int at, int length) {
157
- RubyHash req = (RubyHash)data;
158
- RubyString val = RubyString.newString(runtime,new ByteList(hp.parser.buffer,at,length));
159
- req.op_aset(req.getRuntime().getCurrentContext(), runtime.newString("HTTP_VERSION"),val);
91
+ public static void http_field(Ruby runtime, RubyHash req, ByteList buffer, int field, int flen, int value, int vlen) {
92
+ RubyString f;
93
+ IRubyObject v;
94
+ validateMaxLength(runtime, flen, MAX_FIELD_NAME_LENGTH, MAX_FIELD_NAME_LENGTH_ERR);
95
+ validateMaxLength(runtime, vlen, MAX_FIELD_VALUE_LENGTH, MAX_FIELD_VALUE_LENGTH_ERR);
96
+
97
+ ByteList b = new ByteList(buffer,field,flen);
98
+ for(int i = 0,j = b.length();i<j;i++) {
99
+ int bite = b.get(i) & 0xFF;
100
+ if(bite == '-') {
101
+ b.set(i, (byte)'_');
102
+ } else {
103
+ b.set(i, (byte)Character.toUpperCase(bite));
160
104
  }
161
- };
105
+ }
162
106
 
163
- private Http11Parser.ElementCB header_done = new Http11Parser.ElementCB() {
164
- public void call(Object data, int at, int length) {
165
- body = RubyString.newString(runtime, new ByteList(hp.parser.buffer, at, length));
166
- }
167
- };
107
+ while (vlen > 0 && Character.isWhitespace(buffer.get(value + vlen - 1))) vlen--;
108
+
109
+ if (b.equals(CONTENT_LENGTH_BYTELIST) || b.equals(CONTENT_TYPE_BYTELIST)) {
110
+ f = RubyString.newString(runtime, b);
111
+ } else {
112
+ f = RubyString.newStringShared(runtime, HTTP_PREFIX_BYTELIST);
113
+ f.cat(b);
114
+ }
115
+
116
+ b = new ByteList(buffer, value, vlen);
117
+ v = req.fastARef(f);
118
+ if (v == null || v.isNil()) {
119
+ req.fastASet(f, RubyString.newString(runtime, b));
120
+ } else {
121
+ RubyString vs = v.convertToString();
122
+ vs.cat(COMMA_SPACE_BYTELIST);
123
+ vs.cat(b);
124
+ }
125
+ }
126
+
127
+ public static void request_method(Ruby runtime, RubyHash req, ByteList buffer, int at, int length) {
128
+ RubyString val = RubyString.newString(runtime,new ByteList(buffer,at,length));
129
+ req.fastASet(RubyString.newStringShared(runtime, REQUEST_METHOD_BYTELIST),val);
130
+ }
131
+
132
+ public static void request_uri(Ruby runtime, RubyHash req, ByteList buffer, int at, int length) {
133
+ validateMaxLength(runtime, length, MAX_REQUEST_URI_LENGTH, MAX_REQUEST_URI_LENGTH_ERR);
134
+ RubyString val = RubyString.newString(runtime,new ByteList(buffer,at,length));
135
+ req.fastASet(RubyString.newStringShared(runtime, REQUEST_URI_BYTELIST),val);
136
+ }
137
+
138
+ public static void fragment(Ruby runtime, RubyHash req, ByteList buffer, int at, int length) {
139
+ validateMaxLength(runtime, length, MAX_FRAGMENT_LENGTH, MAX_FRAGMENT_LENGTH_ERR);
140
+ RubyString val = RubyString.newString(runtime,new ByteList(buffer,at,length));
141
+ req.fastASet(RubyString.newStringShared(runtime, FRAGMENT_BYTELIST),val);
142
+ }
143
+
144
+ public static void request_path(Ruby runtime, RubyHash req, ByteList buffer, int at, int length) {
145
+ validateMaxLength(runtime, length, MAX_REQUEST_PATH_LENGTH, MAX_REQUEST_PATH_LENGTH_ERR);
146
+ RubyString val = RubyString.newString(runtime,new ByteList(buffer,at,length));
147
+ req.fastASet(RubyString.newStringShared(runtime, REQUEST_PATH_BYTELIST),val);
148
+ }
149
+
150
+ public static void query_string(Ruby runtime, RubyHash req, ByteList buffer, int at, int length) {
151
+ validateMaxLength(runtime, length, MAX_QUERY_STRING_LENGTH, MAX_QUERY_STRING_LENGTH_ERR);
152
+ RubyString val = RubyString.newString(runtime,new ByteList(buffer,at,length));
153
+ req.fastASet(RubyString.newStringShared(runtime, QUERY_STRING_BYTELIST),val);
154
+ }
155
+
156
+ public static void http_version(Ruby runtime, RubyHash req, ByteList buffer, int at, int length) {
157
+ RubyString val = RubyString.newString(runtime,new ByteList(buffer,at,length));
158
+ req.fastASet(RubyString.newStringShared(runtime, HTTP_VERSION_BYTELIST),val);
159
+ }
160
+
161
+ public void header_done(Ruby runtime, RubyHash req, ByteList buffer, int at, int length) {
162
+ body = RubyString.newStringShared(runtime, new ByteList(buffer, at, length));
163
+ }
168
164
 
169
165
  @JRubyMethod
170
166
  public IRubyObject initialize() {
@@ -186,19 +182,24 @@ public class Http11 extends RubyObject {
186
182
 
187
183
  @JRubyMethod
188
184
  public IRubyObject execute(IRubyObject req_hash, IRubyObject data, IRubyObject start) {
189
- int from = 0;
190
- from = RubyNumeric.fix2int(start);
185
+ int from = RubyNumeric.fix2int(start);
191
186
  ByteList d = ((RubyString)data).getByteList();
192
187
  if(from >= d.length()) {
193
- throw new RaiseException(runtime, eHttpParserError, "Requested start is after data buffer end.", true);
188
+ throw newHTTPParserError(runtime, "Requested start is after data buffer end.");
194
189
  } else {
195
- this.hp.parser.data = req_hash;
196
- this.hp.execute(d,from);
197
- validateMaxLength(this.hp.parser.nread,MAX_HEADER_LENGTH, MAX_HEADER_LENGTH_ERR);
198
- if(this.hp.has_error()) {
199
- throw new RaiseException(runtime, eHttpParserError, "Invalid HTTP format, parsing fails.", true);
190
+ Http11Parser hp = this.hp;
191
+ Http11Parser.HttpParser parser = hp.parser;
192
+
193
+ parser.data = (RubyHash) req_hash;
194
+
195
+ hp.execute(runtime, this, d,from);
196
+
197
+ validateMaxLength(runtime, parser.nread,MAX_HEADER_LENGTH, MAX_HEADER_LENGTH_ERR);
198
+
199
+ if(hp.has_error()) {
200
+ throw newHTTPParserError(runtime, "Invalid HTTP format, parsing fails. Are you trying to open an SSL connection to a non-SSL Puma?");
200
201
  } else {
201
- return runtime.newFixnum(this.hp.parser.nread);
202
+ return runtime.newFixnum(parser.nread);
202
203
  }
203
204
  }
204
205
  }
@@ -217,7 +218,7 @@ public class Http11 extends RubyObject {
217
218
  public IRubyObject nread() {
218
219
  return runtime.newFixnum(this.hp.parser.nread);
219
220
  }
220
-
221
+
221
222
  @JRubyMethod
222
223
  public IRubyObject body() {
223
224
  return body;
@@ -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,13 +11,13 @@ public class Http11Parser {
9
11
  /** Machine **/
10
12
 
11
13
 
12
- // line 65 "ext/puma_http11/http11_parser.java.rl"
14
+ // line 58 "ext/puma_http11/http11_parser.java.rl"
13
15
 
14
16
 
15
17
  /** Data **/
16
18
 
17
- // line 18 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
18
- private static byte[] init__http_parser_actions_0()
19
+ // line 20 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
20
+ private static byte[] init__puma_parser_actions_0()
19
21
  {
20
22
  return new byte [] {
21
23
  0, 1, 0, 1, 2, 1, 3, 1, 4, 1, 5, 1,
@@ -25,24 +27,23 @@ private static byte[] init__http_parser_actions_0()
25
27
  };
26
28
  }
27
29
 
28
- private static final byte _http_parser_actions[] = init__http_parser_actions_0();
30
+ private static final byte _puma_parser_actions[] = init__puma_parser_actions_0();
29
31
 
30
32
 
31
- private static short[] init__http_parser_key_offsets_0()
33
+ private static short[] init__puma_parser_key_offsets_0()
32
34
  {
33
35
  return new short [] {
34
36
  0, 0, 8, 17, 27, 29, 30, 31, 32, 33, 34, 36,
35
- 39, 41, 44, 45, 61, 62, 78, 80, 81, 90, 99, 105,
36
- 111, 121, 130, 136, 142, 153, 159, 165, 175, 181, 187, 196,
37
- 205, 211, 217, 226, 235, 244, 253, 262, 271, 280, 289, 298,
38
- 307, 316, 325, 334, 343, 352, 361, 370, 379, 380
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
39
40
  };
40
41
  }
41
42
 
42
- private static final short _http_parser_key_offsets[] = init__http_parser_key_offsets_0();
43
+ private static final short _puma_parser_key_offsets[] = init__puma_parser_key_offsets_0();
43
44
 
44
45
 
45
- private static char[] init__http_parser_trans_keys_0()
46
+ private static char[] init__puma_parser_trans_keys_0()
46
47
  {
47
48
  return new char [] {
48
49
  36, 95, 45, 46, 48, 57, 65, 90, 32, 36, 95, 45,
@@ -51,81 +52,72 @@ private static char[] init__http_parser_trans_keys_0()
51
52
  46, 48, 57, 48, 57, 13, 48, 57, 10, 13, 33, 124,
52
53
  126, 35, 39, 42, 43, 45, 46, 48, 57, 65, 90, 94,
53
54
  122, 10, 33, 58, 124, 126, 35, 39, 42, 43, 45, 46,
54
- 48, 57, 65, 90, 94, 122, 13, 32, 13, 32, 37, 60,
55
- 62, 127, 0, 31, 34, 35, 32, 37, 60, 62, 127, 0,
56
- 31, 34, 35, 48, 57, 65, 70, 97, 102, 48, 57, 65,
57
- 70, 97, 102, 43, 58, 45, 46, 48, 57, 65, 90, 97,
58
- 122, 32, 34, 35, 37, 60, 62, 127, 0, 31, 48, 57,
59
- 65, 70, 97, 102, 48, 57, 65, 70, 97, 102, 32, 34,
60
- 35, 37, 59, 60, 62, 63, 127, 0, 31, 48, 57, 65,
61
- 70, 97, 102, 48, 57, 65, 70, 97, 102, 32, 34, 35,
62
- 37, 60, 62, 63, 127, 0, 31, 48, 57, 65, 70, 97,
63
- 102, 48, 57, 65, 70, 97, 102, 32, 34, 35, 37, 60,
64
- 62, 127, 0, 31, 32, 34, 35, 37, 60, 62, 127, 0,
65
- 31, 48, 57, 65, 70, 97, 102, 48, 57, 65, 70, 97,
66
- 102, 32, 36, 95, 45, 46, 48, 57, 65, 90, 32, 36,
67
- 95, 45, 46, 48, 57, 65, 90, 32, 36, 95, 45, 46,
68
- 48, 57, 65, 90, 32, 36, 95, 45, 46, 48, 57, 65,
69
- 90, 32, 36, 95, 45, 46, 48, 57, 65, 90, 32, 36,
70
- 95, 45, 46, 48, 57, 65, 90, 32, 36, 95, 45, 46,
71
- 48, 57, 65, 90, 32, 36, 95, 45, 46, 48, 57, 65,
72
- 90, 32, 36, 95, 45, 46, 48, 57, 65, 90, 32, 36,
73
- 95, 45, 46, 48, 57, 65, 90, 32, 36, 95, 45, 46,
74
- 48, 57, 65, 90, 32, 36, 95, 45, 46, 48, 57, 65,
75
- 90, 32, 36, 95, 45, 46, 48, 57, 65, 90, 32, 36,
76
- 95, 45, 46, 48, 57, 65, 90, 32, 36, 95, 45, 46,
77
- 48, 57, 65, 90, 32, 36, 95, 45, 46, 48, 57, 65,
78
- 90, 32, 36, 95, 45, 46, 48, 57, 65, 90, 32, 36,
79
- 95, 45, 46, 48, 57, 65, 90, 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
80
75
  };
81
76
  }
82
77
 
83
- private static final char _http_parser_trans_keys[] = init__http_parser_trans_keys_0();
78
+ private static final char _puma_parser_trans_keys[] = init__puma_parser_trans_keys_0();
84
79
 
85
80
 
86
- private static byte[] init__http_parser_single_lengths_0()
81
+ private static byte[] init__puma_parser_single_lengths_0()
87
82
  {
88
83
  return new byte [] {
89
84
  0, 2, 3, 4, 2, 1, 1, 1, 1, 1, 0, 1,
90
- 0, 1, 1, 4, 1, 4, 2, 1, 5, 5, 0, 0,
91
- 2, 7, 0, 0, 9, 0, 0, 8, 0, 0, 7, 7,
92
- 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
93
- 3, 3, 3, 3, 3, 3, 3, 3, 1, 0
85
+ 0, 1, 1, 4, 1, 4, 2, 1, 4, 4, 2, 6,
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
94
88
  };
95
89
  }
96
90
 
97
- private static final byte _http_parser_single_lengths[] = init__http_parser_single_lengths_0();
91
+ private static final byte _puma_parser_single_lengths[] = init__puma_parser_single_lengths_0();
98
92
 
99
93
 
100
- private static byte[] init__http_parser_range_lengths_0()
94
+ private static byte[] init__puma_parser_range_lengths_0()
101
95
  {
102
96
  return new byte [] {
103
97
  0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 1, 1,
104
- 1, 1, 0, 6, 0, 6, 0, 0, 2, 2, 3, 3,
105
- 4, 1, 3, 3, 1, 3, 3, 1, 3, 3, 1, 1,
106
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
107
- 3, 3, 3, 3, 3, 3, 3, 3, 0, 0
98
+ 1, 1, 0, 6, 0, 6, 0, 0, 2, 2, 4, 1,
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
108
101
  };
109
102
  }
110
103
 
111
- private static final byte _http_parser_range_lengths[] = init__http_parser_range_lengths_0();
104
+ private static final byte _puma_parser_range_lengths[] = init__puma_parser_range_lengths_0();
112
105
 
113
106
 
114
- private static short[] init__http_parser_index_offsets_0()
107
+ private static short[] init__puma_parser_index_offsets_0()
115
108
  {
116
109
  return new short [] {
117
110
  0, 0, 6, 13, 21, 24, 26, 28, 30, 32, 34, 36,
118
- 39, 41, 44, 46, 57, 59, 70, 73, 75, 83, 91, 95,
119
- 99, 106, 115, 119, 123, 134, 138, 142, 152, 156, 160, 169,
120
- 178, 182, 186, 193, 200, 207, 214, 221, 228, 235, 242, 249,
121
- 256, 263, 270, 277, 284, 291, 298, 305, 312, 314
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
122
114
  };
123
115
  }
124
116
 
125
- private static final short _http_parser_index_offsets[] = init__http_parser_index_offsets_0();
117
+ private static final short _puma_parser_index_offsets[] = init__puma_parser_index_offsets_0();
126
118
 
127
119
 
128
- private static byte[] init__http_parser_indicies_0()
120
+ private static byte[] init__puma_parser_indicies_0()
129
121
  {
130
122
  return new byte [] {
131
123
  0, 0, 0, 0, 0, 1, 2, 3, 3, 3, 3, 3,
@@ -134,80 +126,73 @@ private static byte[] init__http_parser_indicies_0()
134
126
  16, 15, 1, 17, 1, 18, 17, 1, 19, 1, 20, 21,
135
127
  21, 21, 21, 21, 21, 21, 21, 21, 1, 22, 1, 23,
136
128
  24, 23, 23, 23, 23, 23, 23, 23, 23, 1, 26, 27,
137
- 25, 29, 28, 30, 32, 1, 1, 1, 1, 1, 31, 33,
138
- 35, 1, 1, 1, 1, 1, 34, 36, 36, 36, 1, 34,
139
- 34, 34, 1, 37, 38, 37, 37, 37, 37, 1, 8, 1,
140
- 9, 39, 1, 1, 1, 1, 38, 40, 40, 40, 1, 38,
141
- 38, 38, 1, 41, 1, 43, 44, 45, 1, 1, 46, 1,
142
- 1, 42, 47, 47, 47, 1, 42, 42, 42, 1, 8, 1,
143
- 9, 49, 1, 1, 50, 1, 1, 48, 51, 51, 51, 1,
144
- 48, 48, 48, 1, 52, 1, 54, 55, 1, 1, 1, 1,
145
- 53, 56, 1, 58, 59, 1, 1, 1, 1, 57, 60, 60,
146
- 60, 1, 57, 57, 57, 1, 2, 61, 61, 61, 61, 61,
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,
147
143
  1, 2, 62, 62, 62, 62, 62, 1, 2, 63, 63, 63,
148
- 63, 63, 1, 2, 64, 64, 64, 64, 64, 1, 2, 65,
149
- 65, 65, 65, 65, 1, 2, 66, 66, 66, 66, 66, 1,
150
- 2, 67, 67, 67, 67, 67, 1, 2, 68, 68, 68, 68,
151
- 68, 1, 2, 69, 69, 69, 69, 69, 1, 2, 70, 70,
152
- 70, 70, 70, 1, 2, 71, 71, 71, 71, 71, 1, 2,
153
- 72, 72, 72, 72, 72, 1, 2, 73, 73, 73, 73, 73,
154
- 1, 2, 74, 74, 74, 74, 74, 1, 2, 75, 75, 75,
155
- 75, 75, 1, 2, 76, 76, 76, 76, 76, 1, 2, 77,
156
- 77, 77, 77, 77, 1, 2, 78, 78, 78, 78, 78, 1,
157
- 2, 1, 1, 0
144
+ 63, 63, 1, 2, 1, 1, 0
158
145
  };
159
146
  }
160
147
 
161
- private static final byte _http_parser_indicies[] = init__http_parser_indicies_0();
148
+ private static final byte _puma_parser_indicies[] = init__puma_parser_indicies_0();
162
149
 
163
150
 
164
- private static byte[] init__http_parser_trans_targs_0()
151
+ private static byte[] init__puma_parser_trans_targs_0()
165
152
  {
166
153
  return new byte [] {
167
- 2, 0, 3, 38, 4, 24, 28, 25, 5, 20, 6, 7,
168
- 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 57, 17,
169
- 18, 19, 14, 18, 19, 14, 5, 21, 22, 5, 21, 22,
170
- 23, 24, 25, 26, 27, 5, 28, 20, 29, 31, 34, 30,
171
- 31, 32, 34, 33, 5, 35, 20, 36, 5, 35, 20, 36,
172
- 37, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
173
- 50, 51, 52, 53, 54, 55, 56
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
+ 18, 19, 14, 18, 19, 14, 5, 21, 5, 21, 22, 23,
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
174
160
  };
175
161
  }
176
162
 
177
- private static final byte _http_parser_trans_targs[] = init__http_parser_trans_targs_0();
163
+ private static final byte _puma_parser_trans_targs[] = init__puma_parser_trans_targs_0();
178
164
 
179
165
 
180
- private static byte[] init__http_parser_trans_actions_0()
166
+ private static byte[] init__puma_parser_trans_actions_0()
181
167
  {
182
168
  return new byte [] {
183
169
  1, 0, 11, 0, 1, 1, 1, 1, 13, 13, 1, 0,
184
170
  0, 0, 0, 0, 0, 0, 19, 0, 0, 28, 23, 3,
185
- 5, 7, 31, 7, 0, 9, 25, 1, 1, 15, 0, 0,
186
- 0, 0, 0, 0, 0, 37, 0, 37, 0, 21, 21, 0,
187
- 0, 0, 0, 0, 40, 17, 40, 17, 34, 0, 34, 0,
171
+ 5, 7, 31, 7, 0, 9, 25, 1, 15, 0, 0, 0,
172
+ 37, 0, 37, 21, 40, 17, 40, 34, 0, 34, 0, 0,
188
173
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
189
- 0, 0, 0, 0, 0, 0, 0
174
+ 0, 0, 0, 0
190
175
  };
191
176
  }
192
177
 
193
- private static final byte _http_parser_trans_actions[] = init__http_parser_trans_actions_0();
178
+ private static final byte _puma_parser_trans_actions[] = init__puma_parser_trans_actions_0();
194
179
 
195
180
 
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;
181
+ static final int puma_parser_start = 1;
182
+ static final int puma_parser_first_final = 46;
183
+ static final int puma_parser_error = 0;
199
184
 
200
- static final int http_parser_en_main = 1;
185
+ static final int puma_parser_en_main = 1;
201
186
 
202
187
 
203
- // line 69 "ext/puma_http11/http11_parser.java.rl"
188
+ // line 62 "ext/puma_http11/http11_parser.java.rl"
204
189
 
205
190
  public static interface ElementCB {
206
- public void call(Object data, int at, int length);
191
+ public void call(Ruby runtime, RubyHash data, ByteList buffer, int at, int length);
207
192
  }
208
193
 
209
194
  public static interface FieldCB {
210
- public void call(Object data, int field, int flen, int value, int vlen);
195
+ public void call(Ruby runtime, RubyHash data, ByteList buffer, int field, int flen, int value, int vlen);
211
196
  }
212
197
 
213
198
  public static class HttpParser {
@@ -220,28 +205,19 @@ static final int http_parser_en_main = 1;
220
205
  int field_len;
221
206
  int query_start;
222
207
 
223
- Object data;
208
+ RubyHash data;
224
209
  ByteList buffer;
225
210
 
226
- public FieldCB http_field;
227
- public ElementCB request_method;
228
- public ElementCB request_uri;
229
- public ElementCB fragment;
230
- public ElementCB request_path;
231
- public ElementCB query_string;
232
- public ElementCB http_version;
233
- public ElementCB header_done;
234
-
235
211
  public void init() {
236
212
  cs = 0;
237
213
 
238
214
 
239
- // line 240 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
215
+ // line 218 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
240
216
  {
241
- cs = http_parser_start;
217
+ cs = puma_parser_start;
242
218
  }
243
219
 
244
- // line 104 "ext/puma_http11/http11_parser.java.rl"
220
+ // line 90 "ext/puma_http11/http11_parser.java.rl"
245
221
 
246
222
  body_start = 0;
247
223
  content_len = 0;
@@ -254,7 +230,7 @@ static final int http_parser_en_main = 1;
254
230
 
255
231
  public final HttpParser parser = new HttpParser();
256
232
 
257
- public int execute(ByteList buffer, int off) {
233
+ public int execute(Ruby runtime, Http11 http, ByteList buffer, int off) {
258
234
  int p, pe;
259
235
  int cs = parser.cs;
260
236
  int len = buffer.length();
@@ -268,7 +244,7 @@ static final int http_parser_en_main = 1;
268
244
  parser.buffer = buffer;
269
245
 
270
246
 
271
- // line 272 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
247
+ // line 250 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
272
248
  {
273
249
  int _klen;
274
250
  int _trans = 0;
@@ -290,9 +266,9 @@ static final int http_parser_en_main = 1;
290
266
  }
291
267
  case 1:
292
268
  _match: do {
293
- _keys = _http_parser_key_offsets[cs];
294
- _trans = _http_parser_index_offsets[cs];
295
- _klen = _http_parser_single_lengths[cs];
269
+ _keys = _puma_parser_key_offsets[cs];
270
+ _trans = _puma_parser_index_offsets[cs];
271
+ _klen = _puma_parser_single_lengths[cs];
296
272
  if ( _klen > 0 ) {
297
273
  int _lower = _keys;
298
274
  int _mid;
@@ -302,9 +278,9 @@ case 1:
302
278
  break;
303
279
 
304
280
  _mid = _lower + ((_upper-_lower) >> 1);
305
- if ( data[p] < _http_parser_trans_keys[_mid] )
281
+ if ( data[p] < _puma_parser_trans_keys[_mid] )
306
282
  _upper = _mid - 1;
307
- else if ( data[p] > _http_parser_trans_keys[_mid] )
283
+ else if ( data[p] > _puma_parser_trans_keys[_mid] )
308
284
  _lower = _mid + 1;
309
285
  else {
310
286
  _trans += (_mid - _keys);
@@ -315,7 +291,7 @@ case 1:
315
291
  _trans += _klen;
316
292
  }
317
293
 
318
- _klen = _http_parser_range_lengths[cs];
294
+ _klen = _puma_parser_range_lengths[cs];
319
295
  if ( _klen > 0 ) {
320
296
  int _lower = _keys;
321
297
  int _mid;
@@ -325,9 +301,9 @@ case 1:
325
301
  break;
326
302
 
327
303
  _mid = _lower + (((_upper-_lower) >> 1) & ~1);
328
- if ( data[p] < _http_parser_trans_keys[_mid] )
304
+ if ( data[p] < _puma_parser_trans_keys[_mid] )
329
305
  _upper = _mid - 2;
330
- else if ( data[p] > _http_parser_trans_keys[_mid+1] )
306
+ else if ( data[p] > _puma_parser_trans_keys[_mid+1] )
331
307
  _lower = _mid + 2;
332
308
  else {
333
309
  _trans += ((_mid - _keys)>>1);
@@ -338,102 +314,93 @@ case 1:
338
314
  }
339
315
  } while (false);
340
316
 
341
- _trans = _http_parser_indicies[_trans];
342
- cs = _http_parser_trans_targs[_trans];
317
+ _trans = _puma_parser_indicies[_trans];
318
+ cs = _puma_parser_trans_targs[_trans];
343
319
 
344
- if ( _http_parser_trans_actions[_trans] != 0 ) {
345
- _acts = _http_parser_trans_actions[_trans];
346
- _nacts = (int) _http_parser_actions[_acts++];
320
+ if ( _puma_parser_trans_actions[_trans] != 0 ) {
321
+ _acts = _puma_parser_trans_actions[_trans];
322
+ _nacts = (int) _puma_parser_actions[_acts++];
347
323
  while ( _nacts-- > 0 )
348
324
  {
349
- switch ( _http_parser_actions[_acts++] )
325
+ switch ( _puma_parser_actions[_acts++] )
350
326
  {
351
327
  case 0:
352
- // line 13 "ext/puma_http11/http11_parser.java.rl"
328
+ // line 15 "ext/puma_http11/http11_parser.java.rl"
353
329
  {parser.mark = p; }
354
330
  break;
355
331
  case 1:
356
- // line 15 "ext/puma_http11/http11_parser.java.rl"
332
+ // line 17 "ext/puma_http11/http11_parser.java.rl"
357
333
  { parser.field_start = p; }
358
334
  break;
359
335
  case 2:
360
- // line 16 "ext/puma_http11/http11_parser.java.rl"
336
+ // line 18 "ext/puma_http11/http11_parser.java.rl"
361
337
  { /* FIXME stub */ }
362
338
  break;
363
339
  case 3:
364
- // line 17 "ext/puma_http11/http11_parser.java.rl"
340
+ // line 19 "ext/puma_http11/http11_parser.java.rl"
365
341
  {
366
342
  parser.field_len = p-parser.field_start;
367
343
  }
368
344
  break;
369
345
  case 4:
370
- // line 21 "ext/puma_http11/http11_parser.java.rl"
346
+ // line 23 "ext/puma_http11/http11_parser.java.rl"
371
347
  { parser.mark = p; }
372
348
  break;
373
349
  case 5:
374
- // line 22 "ext/puma_http11/http11_parser.java.rl"
375
- {
376
- if(parser.http_field != null) {
377
- parser.http_field.call(parser.data, parser.field_start, parser.field_len, parser.mark, p-parser.mark);
378
- }
350
+ // line 24 "ext/puma_http11/http11_parser.java.rl"
351
+ {
352
+ Http11.http_field(runtime, parser.data, parser.buffer, parser.field_start, parser.field_len, parser.mark, p-parser.mark);
379
353
  }
380
354
  break;
381
355
  case 6:
382
356
  // line 27 "ext/puma_http11/http11_parser.java.rl"
383
- {
384
- if(parser.request_method != null)
385
- parser.request_method.call(parser.data, parser.mark, p-parser.mark);
357
+ {
358
+ Http11.request_method(runtime, parser.data, parser.buffer, parser.mark, p-parser.mark);
386
359
  }
387
360
  break;
388
361
  case 7:
389
- // line 31 "ext/puma_http11/http11_parser.java.rl"
390
- {
391
- if(parser.request_uri != null)
392
- parser.request_uri.call(parser.data, parser.mark, p-parser.mark);
362
+ // line 30 "ext/puma_http11/http11_parser.java.rl"
363
+ {
364
+ Http11.request_uri(runtime, parser.data, parser.buffer, parser.mark, p-parser.mark);
393
365
  }
394
366
  break;
395
367
  case 8:
396
- // line 35 "ext/puma_http11/http11_parser.java.rl"
397
- {
398
- if(parser.fragment != null)
399
- parser.fragment.call(parser.data, parser.mark, p-parser.mark);
368
+ // line 33 "ext/puma_http11/http11_parser.java.rl"
369
+ {
370
+ Http11.fragment(runtime, parser.data, parser.buffer, parser.mark, p-parser.mark);
400
371
  }
401
372
  break;
402
373
  case 9:
403
- // line 40 "ext/puma_http11/http11_parser.java.rl"
374
+ // line 37 "ext/puma_http11/http11_parser.java.rl"
404
375
  {parser.query_start = p; }
405
376
  break;
406
377
  case 10:
407
- // line 41 "ext/puma_http11/http11_parser.java.rl"
408
- {
409
- if(parser.query_string != null)
410
- parser.query_string.call(parser.data, parser.query_start, p-parser.query_start);
378
+ // line 38 "ext/puma_http11/http11_parser.java.rl"
379
+ {
380
+ Http11.query_string(runtime, parser.data, parser.buffer, parser.query_start, p-parser.query_start);
411
381
  }
412
382
  break;
413
383
  case 11:
414
- // line 46 "ext/puma_http11/http11_parser.java.rl"
415
- {
416
- if(parser.http_version != null)
417
- parser.http_version.call(parser.data, parser.mark, p-parser.mark);
384
+ // line 42 "ext/puma_http11/http11_parser.java.rl"
385
+ {
386
+ Http11.http_version(runtime, parser.data, parser.buffer, parser.mark, p-parser.mark);
418
387
  }
419
388
  break;
420
389
  case 12:
421
- // line 51 "ext/puma_http11/http11_parser.java.rl"
390
+ // line 46 "ext/puma_http11/http11_parser.java.rl"
422
391
  {
423
- if(parser.request_path != null)
424
- 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);
425
393
  }
426
394
  break;
427
395
  case 13:
428
- // line 56 "ext/puma_http11/http11_parser.java.rl"
396
+ // line 50 "ext/puma_http11/http11_parser.java.rl"
429
397
  {
430
- parser.body_start = p + 1;
431
- if(parser.header_done != null)
432
- parser.header_done.call(parser.data, p + 1, pe - p - 1);
398
+ parser.body_start = p + 1;
399
+ http.header_done(runtime, parser.data, parser.buffer, p + 1, pe - p - 1);
433
400
  { p += 1; _goto_targ = 5; if (true) continue _goto;}
434
401
  }
435
402
  break;
436
- // line 437 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
403
+ // line 406 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
437
404
  }
438
405
  }
439
406
  }
@@ -453,7 +420,7 @@ case 5:
453
420
  break; }
454
421
  }
455
422
 
456
- // line 130 "ext/puma_http11/http11_parser.java.rl"
423
+ // line 116 "ext/puma_http11/http11_parser.java.rl"
457
424
 
458
425
  parser.cs = cs;
459
426
  parser.nread += (p - off);
@@ -479,10 +446,10 @@ case 5:
479
446
  }
480
447
 
481
448
  public boolean has_error() {
482
- return parser.cs == http_parser_error;
449
+ return parser.cs == puma_parser_error;
483
450
  }
484
451
 
485
452
  public boolean is_finished() {
486
- return parser.cs == http_parser_first_final;
453
+ return parser.cs == puma_parser_first_final;
487
454
  }
488
455
  }