wendell-puma 2.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/COPYING +55 -0
  3. data/DEPLOYMENT.md +92 -0
  4. data/Gemfile +17 -0
  5. data/History.txt +588 -0
  6. data/LICENSE +26 -0
  7. data/Manifest.txt +68 -0
  8. data/README.md +251 -0
  9. data/Rakefile +158 -0
  10. data/bin/puma +10 -0
  11. data/bin/puma-wild +31 -0
  12. data/bin/pumactl +12 -0
  13. data/docs/config.md +0 -0
  14. data/docs/nginx.md +80 -0
  15. data/docs/signals.md +43 -0
  16. data/ext/puma_http11/PumaHttp11Service.java +17 -0
  17. data/ext/puma_http11/ext_help.h +15 -0
  18. data/ext/puma_http11/extconf.rb +9 -0
  19. data/ext/puma_http11/http11_parser.c +1225 -0
  20. data/ext/puma_http11/http11_parser.h +64 -0
  21. data/ext/puma_http11/http11_parser.java.rl +161 -0
  22. data/ext/puma_http11/http11_parser.rl +146 -0
  23. data/ext/puma_http11/http11_parser_common.rl +54 -0
  24. data/ext/puma_http11/io_buffer.c +155 -0
  25. data/ext/puma_http11/mini_ssl.c +198 -0
  26. data/ext/puma_http11/org/jruby/puma/Http11.java +225 -0
  27. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +488 -0
  28. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +391 -0
  29. data/ext/puma_http11/puma_http11.c +491 -0
  30. data/lib/puma.rb +14 -0
  31. data/lib/puma/accept_nonblock.rb +23 -0
  32. data/lib/puma/app/status.rb +59 -0
  33. data/lib/puma/binder.rb +298 -0
  34. data/lib/puma/capistrano.rb +86 -0
  35. data/lib/puma/cli.rb +606 -0
  36. data/lib/puma/client.rb +289 -0
  37. data/lib/puma/cluster.rb +404 -0
  38. data/lib/puma/compat.rb +18 -0
  39. data/lib/puma/configuration.rb +377 -0
  40. data/lib/puma/const.rb +165 -0
  41. data/lib/puma/control_cli.rb +251 -0
  42. data/lib/puma/daemon_ext.rb +25 -0
  43. data/lib/puma/delegation.rb +11 -0
  44. data/lib/puma/detect.rb +4 -0
  45. data/lib/puma/events.rb +130 -0
  46. data/lib/puma/io_buffer.rb +7 -0
  47. data/lib/puma/java_io_buffer.rb +45 -0
  48. data/lib/puma/jruby_restart.rb +83 -0
  49. data/lib/puma/minissl.rb +187 -0
  50. data/lib/puma/null_io.rb +34 -0
  51. data/lib/puma/rack_default.rb +7 -0
  52. data/lib/puma/rack_patch.rb +45 -0
  53. data/lib/puma/reactor.rb +183 -0
  54. data/lib/puma/runner.rb +146 -0
  55. data/lib/puma/server.rb +801 -0
  56. data/lib/puma/single.rb +102 -0
  57. data/lib/puma/tcp_logger.rb +32 -0
  58. data/lib/puma/thread_pool.rb +185 -0
  59. data/lib/puma/util.rb +9 -0
  60. data/lib/rack/handler/puma.rb +66 -0
  61. data/test/test_app_status.rb +92 -0
  62. data/test/test_cli.rb +173 -0
  63. data/test/test_config.rb +26 -0
  64. data/test/test_http10.rb +27 -0
  65. data/test/test_http11.rb +144 -0
  66. data/test/test_integration.rb +165 -0
  67. data/test/test_iobuffer.rb +38 -0
  68. data/test/test_minissl.rb +29 -0
  69. data/test/test_null_io.rb +31 -0
  70. data/test/test_persistent.rb +238 -0
  71. data/test/test_puma_server.rb +288 -0
  72. data/test/test_puma_server_ssl.rb +137 -0
  73. data/test/test_rack_handler.rb +10 -0
  74. data/test/test_rack_server.rb +141 -0
  75. data/test/test_tcp_rack.rb +42 -0
  76. data/test/test_thread_pool.rb +156 -0
  77. data/test/test_unix_socket.rb +39 -0
  78. data/test/test_ws.rb +89 -0
  79. data/tools/jungle/README.md +9 -0
  80. data/tools/jungle/init.d/README.md +54 -0
  81. data/tools/jungle/init.d/puma +332 -0
  82. data/tools/jungle/init.d/run-puma +3 -0
  83. data/tools/jungle/upstart/README.md +61 -0
  84. data/tools/jungle/upstart/puma-manager.conf +31 -0
  85. data/tools/jungle/upstart/puma.conf +63 -0
  86. data/tools/trickletest.rb +45 -0
  87. data/wendell-puma.gemspec +55 -0
  88. metadata +225 -0
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (c) 2011 Evan Phoenix
4
+ #
5
+
6
+ require 'puma/cli'
7
+
8
+ cli = Puma::CLI.new ARGV
9
+
10
+ cli.run
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (c) 2014 Evan Phoenix
4
+ #
5
+
6
+ require 'rubygems'
7
+
8
+ gems = ARGV.shift
9
+
10
+ inc = ""
11
+
12
+ if gems == "-I"
13
+ inc = ARGV.shift
14
+ $LOAD_PATH.concat inc.split(":")
15
+ gems = ARGV.shift
16
+ end
17
+
18
+ gems.split(",").each do |s|
19
+ name, ver = s.split(":",2)
20
+ gem name, ver
21
+ end
22
+
23
+ module Puma; end
24
+
25
+ Puma.const_set("WILD_ARGS", ["-I", inc, gems])
26
+
27
+ require 'puma/cli'
28
+
29
+ cli = Puma::CLI.new ARGV
30
+
31
+ cli.run
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'puma/control_cli'
4
+
5
+ cli = Puma::ControlCLI.new ARGV.dup
6
+
7
+ begin
8
+ cli.run
9
+ rescue => e
10
+ STDERR.puts e.message
11
+ exit 1
12
+ end
File without changes
@@ -0,0 +1,80 @@
1
+ # Nginx configuration example file
2
+
3
+ This is a very common setup using an upstream. It was adapted from some Capistrano recipe I found on the Internet a while ago.
4
+
5
+ ```
6
+ upstream myapp {
7
+ server unix:///myapp/tmp/puma.sock;
8
+ }
9
+
10
+ server {
11
+ listen 80;
12
+ server_name myapp.com;
13
+
14
+ # ~2 seconds is often enough for most folks to parse HTML/CSS and
15
+ # retrieve needed images/icons/frames, connections are cheap in
16
+ # nginx so increasing this is generally safe...
17
+ keepalive_timeout 5;
18
+
19
+ # path for static files
20
+ root /myapp/public;
21
+ access_log /myapp/log/nginx.access.log;
22
+ error_log /myapp/log/nginx.error.log info;
23
+
24
+ # this rewrites all the requests to the maintenance.html
25
+ # page if it exists in the doc root. This is for capistrano's
26
+ # disable web task
27
+ if (-f $document_root/maintenance.html) {
28
+ rewrite ^(.*)$ /maintenance.html last;
29
+ break;
30
+ }
31
+
32
+ location / {
33
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
34
+ proxy_set_header Host $http_host;
35
+
36
+ # If the file exists as a static file serve it directly without
37
+ # running all the other rewite tests on it
38
+ if (-f $request_filename) {
39
+ break;
40
+ }
41
+
42
+ # check for index.html for directory index
43
+ # if its there on the filesystem then rewite
44
+ # the url to add /index.html to the end of it
45
+ # and then break to send it to the next config rules.
46
+ if (-f $request_filename/index.html) {
47
+ rewrite (.*) $1/index.html break;
48
+ }
49
+
50
+ # this is the meat of the rack page caching config
51
+ # it adds .html to the end of the url and then checks
52
+ # the filesystem for that file. If it exists, then we
53
+ # rewite the url to have explicit .html on the end
54
+ # and then send it on its way to the next config rule.
55
+ # if there is no file on the fs then it sets all the
56
+ # necessary headers and proxies to our upstream pumas
57
+ if (-f $request_filename.html) {
58
+ rewrite (.*) $1.html break;
59
+ }
60
+
61
+ if (!-f $request_filename) {
62
+ proxy_pass http://myapp;
63
+ break;
64
+ }
65
+ }
66
+
67
+ # Now this supposedly should work as it gets the filenames with querystrings that Rails provides.
68
+ # BUT there's a chance it could break the ajax calls.
69
+ location ~* \.(ico|css|gif|jpe?g|png|js)(\?[0-9]+)?$ {
70
+ expires max;
71
+ break;
72
+ }
73
+
74
+ # Error pages
75
+ # error_page 500 502 503 504 /500.html;
76
+ location = /500.html {
77
+ root /myapp/current/public;
78
+ }
79
+ }
80
+ ```
@@ -0,0 +1,43 @@
1
+ The [unix signal](http://en.wikipedia.org/wiki/Unix_signal) is a method of sending messages between [processes](http://en.wikipedia.org/wiki/Process_(computing)). When a signal is sent, the operating system interrupts the target process's normal flow of execution. There are standard signals that are used to stop a process but there are also custom signals that can be used for other purposes. This document is an attempt to list all supported signals that Puma will respond to. In general, signals need only be sent to the master process of a cluster.
2
+
3
+ ## Sending Signals
4
+
5
+ If you are new to signals it can be useful to see how they can be used. When a process is created in a *nix like operating system it will have a [PID - or process identifier](http://en.wikipedia.org/wiki/Process_identifier) that can be used to send signals to the process. For demonstration we will create an infinitely running process by tailing a file:
6
+
7
+ ```sh
8
+ $ echo "foo" >> my.log
9
+ $ irb
10
+ > pid = Process.spawn 'tail -f my.log'
11
+ ```
12
+
13
+ From here we can see that the tail process is running by using the `ps` command:
14
+
15
+ ```sh
16
+ $ ps aux | grep tail
17
+ schneems 87152 0.0 0.0 2432772 492 s032 S+ 12:46PM 0:00.00 tail -f my.log
18
+ ```
19
+
20
+ You can send a signal in Ruby using the [Process module](http://www.ruby-doc.org/core-2.1.1/Process.html#kill-method):
21
+
22
+ ```
23
+ $ irb
24
+ > puts pid
25
+ => 87152
26
+ Process.detach(pid) # http://ruby-doc.org/core-2.1.1/Process.html#method-c-detach
27
+ Process.kill("TERM", pid)
28
+ ```
29
+
30
+ Now you will see via `ps` that there is no more `tail` process. Sometimes when referring to signals the `SIG` prefix will be used for instance `SIGTERM` is equivalent to sending `TERM` via `Process.kill`.
31
+
32
+ ## Puma Signals
33
+
34
+ Puma cluster responds to these signals:
35
+
36
+ - `TTIN` increment the worker count by 1
37
+ - `TTOU` decrement the worker count by 1
38
+ - `TERM` send `TERM` to worker. Worker will attempt to finish then exit.
39
+ - `USR2` restart workers
40
+ - `USR1` restart workers in phases, a rolling restart.
41
+ - `HUP` reopen log files defined in stdout_redirect configuration parameter
42
+ - `INT` equivalent of sending Ctrl-C to cluster. Will attempt to finish then exit.
43
+ - `CHLD`
@@ -0,0 +1,17 @@
1
+ package puma;
2
+
3
+ import java.io.IOException;
4
+
5
+ import org.jruby.Ruby;
6
+ import org.jruby.runtime.load.BasicLibraryService;
7
+
8
+ import org.jruby.puma.Http11;
9
+ import org.jruby.puma.MiniSSL;
10
+
11
+ public class PumaHttp11Service implements BasicLibraryService {
12
+ public boolean basicLoad(final Ruby runtime) throws IOException {
13
+ Http11.createHttp11(runtime);
14
+ MiniSSL.createMiniSSL(runtime);
15
+ return true;
16
+ }
17
+ }
@@ -0,0 +1,15 @@
1
+ #ifndef ext_help_h
2
+ #define ext_help_h
3
+
4
+ #define RAISE_NOT_NULL(T) if(T == NULL) rb_raise(rb_eArgError, "%s", "NULL found for " # T " when shouldn't be.");
5
+ #define DATA_GET(from,type,name) Data_Get_Struct(from,type,name); RAISE_NOT_NULL(name);
6
+ #define REQUIRE_TYPE(V, T) if(TYPE(V) != T) rb_raise(rb_eTypeError, "%s", "Wrong argument type for " # V " required " # T);
7
+ #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
8
+
9
+ #ifdef DEBUG
10
+ #define TRACE() fprintf(stderr, "> %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__)
11
+ #else
12
+ #define TRACE()
13
+ #endif
14
+
15
+ #endif
@@ -0,0 +1,9 @@
1
+ require 'mkmf'
2
+
3
+ dir_config("puma_http11")
4
+
5
+ if %w'ssl ssleay32'.find {|ssl| have_library(ssl, 'SSL_CTX_new')} and
6
+ %w'crypto libeay32'.find {|crypto| have_library(crypto, 'BIO_read')}
7
+
8
+ create_makefile("puma/puma_http11")
9
+ end
@@ -0,0 +1,1225 @@
1
+
2
+ #line 1 "ext/http11/http11_parser.rl"
3
+ /**
4
+ * Copyright (c) 2005 Zed A. Shaw
5
+ * You can redistribute it and/or modify it under the same terms as Ruby.
6
+ */
7
+ #include "http11_parser.h"
8
+ #include <stdio.h>
9
+ #include <assert.h>
10
+ #include <stdlib.h>
11
+ #include <ctype.h>
12
+ #include <string.h>
13
+
14
+ /*
15
+ * capitalizes all lower-case ASCII characters,
16
+ * converts dashes to underscores.
17
+ */
18
+ static void snake_upcase_char(char *c)
19
+ {
20
+ if (*c >= 'a' && *c <= 'z')
21
+ *c &= ~0x20;
22
+ else if (*c == '-')
23
+ *c = '_';
24
+ }
25
+
26
+ #define LEN(AT, FPC) (FPC - buffer - parser->AT)
27
+ #define MARK(M,FPC) (parser->M = (FPC) - buffer)
28
+ #define PTR_TO(F) (buffer + parser->F)
29
+
30
+ /** Machine **/
31
+
32
+
33
+ #line 78 "ext/http11/http11_parser.rl"
34
+
35
+
36
+ /** Data **/
37
+
38
+ #line 39 "ext/http11/http11_parser.c"
39
+ static const int puma_parser_start = 1;
40
+ static const int puma_parser_first_final = 57;
41
+ static const int puma_parser_error = 0;
42
+
43
+ static const int puma_parser_en_main = 1;
44
+
45
+
46
+ #line 82 "ext/http11/http11_parser.rl"
47
+
48
+ int puma_parser_init(puma_parser *parser) {
49
+ int cs = 0;
50
+
51
+ #line 52 "ext/http11/http11_parser.c"
52
+ {
53
+ cs = puma_parser_start;
54
+ }
55
+
56
+ #line 86 "ext/http11/http11_parser.rl"
57
+ parser->cs = cs;
58
+ parser->body_start = 0;
59
+ parser->content_len = 0;
60
+ parser->mark = 0;
61
+ parser->nread = 0;
62
+ parser->field_len = 0;
63
+ parser->field_start = 0;
64
+ parser->request = Qnil;
65
+ parser->body = Qnil;
66
+
67
+ return 1;
68
+ }
69
+
70
+
71
+ /** exec **/
72
+ size_t puma_parser_execute(puma_parser *parser, const char *buffer, size_t len, size_t off) {
73
+ const char *p, *pe;
74
+ int cs = parser->cs;
75
+
76
+ assert(off <= len && "offset past end of buffer");
77
+
78
+ p = buffer+off;
79
+ pe = buffer+len;
80
+
81
+ /* assert(*pe == '\0' && "pointer does not end on NUL"); */
82
+ assert(pe - p == len - off && "pointers aren't same distance");
83
+
84
+
85
+ #line 86 "ext/http11/http11_parser.c"
86
+ {
87
+ if ( p == pe )
88
+ goto _test_eof;
89
+ switch ( cs )
90
+ {
91
+ case 1:
92
+ switch( (*p) ) {
93
+ case 36: goto tr0;
94
+ case 95: goto tr0;
95
+ }
96
+ if ( (*p) < 48 ) {
97
+ if ( 45 <= (*p) && (*p) <= 46 )
98
+ goto tr0;
99
+ } else if ( (*p) > 57 ) {
100
+ if ( 65 <= (*p) && (*p) <= 90 )
101
+ goto tr0;
102
+ } else
103
+ goto tr0;
104
+ goto st0;
105
+ st0:
106
+ cs = 0;
107
+ goto _out;
108
+ tr0:
109
+ #line 34 "ext/http11/http11_parser.rl"
110
+ { MARK(mark, p); }
111
+ goto st2;
112
+ st2:
113
+ if ( ++p == pe )
114
+ goto _test_eof2;
115
+ case 2:
116
+ #line 117 "ext/http11/http11_parser.c"
117
+ switch( (*p) ) {
118
+ case 32: goto tr2;
119
+ case 36: goto st38;
120
+ case 95: goto st38;
121
+ }
122
+ if ( (*p) < 48 ) {
123
+ if ( 45 <= (*p) && (*p) <= 46 )
124
+ goto st38;
125
+ } else if ( (*p) > 57 ) {
126
+ if ( 65 <= (*p) && (*p) <= 90 )
127
+ goto st38;
128
+ } else
129
+ goto st38;
130
+ goto st0;
131
+ tr2:
132
+ #line 47 "ext/http11/http11_parser.rl"
133
+ {
134
+ parser->request_method(parser, PTR_TO(mark), LEN(mark, p));
135
+ }
136
+ goto st3;
137
+ st3:
138
+ if ( ++p == pe )
139
+ goto _test_eof3;
140
+ case 3:
141
+ #line 142 "ext/http11/http11_parser.c"
142
+ switch( (*p) ) {
143
+ case 42: goto tr4;
144
+ case 43: goto tr5;
145
+ case 47: goto tr6;
146
+ case 58: goto tr7;
147
+ }
148
+ if ( (*p) < 65 ) {
149
+ if ( 45 <= (*p) && (*p) <= 57 )
150
+ goto tr5;
151
+ } else if ( (*p) > 90 ) {
152
+ if ( 97 <= (*p) && (*p) <= 122 )
153
+ goto tr5;
154
+ } else
155
+ goto tr5;
156
+ goto st0;
157
+ tr4:
158
+ #line 34 "ext/http11/http11_parser.rl"
159
+ { MARK(mark, p); }
160
+ goto st4;
161
+ st4:
162
+ if ( ++p == pe )
163
+ goto _test_eof4;
164
+ case 4:
165
+ #line 166 "ext/http11/http11_parser.c"
166
+ switch( (*p) ) {
167
+ case 32: goto tr8;
168
+ case 35: goto tr9;
169
+ }
170
+ goto st0;
171
+ tr8:
172
+ #line 50 "ext/http11/http11_parser.rl"
173
+ {
174
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
175
+ }
176
+ goto st5;
177
+ tr31:
178
+ #line 34 "ext/http11/http11_parser.rl"
179
+ { MARK(mark, p); }
180
+ #line 53 "ext/http11/http11_parser.rl"
181
+ {
182
+ parser->fragment(parser, PTR_TO(mark), LEN(mark, p));
183
+ }
184
+ goto st5;
185
+ tr34:
186
+ #line 53 "ext/http11/http11_parser.rl"
187
+ {
188
+ parser->fragment(parser, PTR_TO(mark), LEN(mark, p));
189
+ }
190
+ goto st5;
191
+ tr42:
192
+ #line 66 "ext/http11/http11_parser.rl"
193
+ {
194
+ parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
195
+ }
196
+ #line 50 "ext/http11/http11_parser.rl"
197
+ {
198
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
199
+ }
200
+ goto st5;
201
+ tr53:
202
+ #line 57 "ext/http11/http11_parser.rl"
203
+ { MARK(query_start, p); }
204
+ #line 58 "ext/http11/http11_parser.rl"
205
+ {
206
+ parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
207
+ }
208
+ #line 50 "ext/http11/http11_parser.rl"
209
+ {
210
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
211
+ }
212
+ goto st5;
213
+ tr57:
214
+ #line 58 "ext/http11/http11_parser.rl"
215
+ {
216
+ parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
217
+ }
218
+ #line 50 "ext/http11/http11_parser.rl"
219
+ {
220
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
221
+ }
222
+ goto st5;
223
+ st5:
224
+ if ( ++p == pe )
225
+ goto _test_eof5;
226
+ case 5:
227
+ #line 228 "ext/http11/http11_parser.c"
228
+ if ( (*p) == 72 )
229
+ goto tr10;
230
+ goto st0;
231
+ tr10:
232
+ #line 34 "ext/http11/http11_parser.rl"
233
+ { MARK(mark, p); }
234
+ goto st6;
235
+ st6:
236
+ if ( ++p == pe )
237
+ goto _test_eof6;
238
+ case 6:
239
+ #line 240 "ext/http11/http11_parser.c"
240
+ if ( (*p) == 84 )
241
+ goto st7;
242
+ goto st0;
243
+ st7:
244
+ if ( ++p == pe )
245
+ goto _test_eof7;
246
+ case 7:
247
+ if ( (*p) == 84 )
248
+ goto st8;
249
+ goto st0;
250
+ st8:
251
+ if ( ++p == pe )
252
+ goto _test_eof8;
253
+ case 8:
254
+ if ( (*p) == 80 )
255
+ goto st9;
256
+ goto st0;
257
+ st9:
258
+ if ( ++p == pe )
259
+ goto _test_eof9;
260
+ case 9:
261
+ if ( (*p) == 47 )
262
+ goto st10;
263
+ goto st0;
264
+ st10:
265
+ if ( ++p == pe )
266
+ goto _test_eof10;
267
+ case 10:
268
+ if ( 48 <= (*p) && (*p) <= 57 )
269
+ goto st11;
270
+ goto st0;
271
+ st11:
272
+ if ( ++p == pe )
273
+ goto _test_eof11;
274
+ case 11:
275
+ if ( (*p) == 46 )
276
+ goto st12;
277
+ if ( 48 <= (*p) && (*p) <= 57 )
278
+ goto st11;
279
+ goto st0;
280
+ st12:
281
+ if ( ++p == pe )
282
+ goto _test_eof12;
283
+ case 12:
284
+ if ( 48 <= (*p) && (*p) <= 57 )
285
+ goto st13;
286
+ goto st0;
287
+ st13:
288
+ if ( ++p == pe )
289
+ goto _test_eof13;
290
+ case 13:
291
+ if ( (*p) == 13 )
292
+ goto tr18;
293
+ if ( 48 <= (*p) && (*p) <= 57 )
294
+ goto st13;
295
+ goto st0;
296
+ tr18:
297
+ #line 62 "ext/http11/http11_parser.rl"
298
+ {
299
+ parser->http_version(parser, PTR_TO(mark), LEN(mark, p));
300
+ }
301
+ goto st14;
302
+ tr26:
303
+ #line 43 "ext/http11/http11_parser.rl"
304
+ { MARK(mark, p); }
305
+ #line 44 "ext/http11/http11_parser.rl"
306
+ {
307
+ parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
308
+ }
309
+ goto st14;
310
+ tr29:
311
+ #line 44 "ext/http11/http11_parser.rl"
312
+ {
313
+ parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
314
+ }
315
+ goto st14;
316
+ st14:
317
+ if ( ++p == pe )
318
+ goto _test_eof14;
319
+ case 14:
320
+ #line 321 "ext/http11/http11_parser.c"
321
+ if ( (*p) == 10 )
322
+ goto st15;
323
+ goto st0;
324
+ st15:
325
+ if ( ++p == pe )
326
+ goto _test_eof15;
327
+ case 15:
328
+ switch( (*p) ) {
329
+ case 13: goto st16;
330
+ case 33: goto tr21;
331
+ case 124: goto tr21;
332
+ case 126: goto tr21;
333
+ }
334
+ if ( (*p) < 45 ) {
335
+ if ( (*p) > 39 ) {
336
+ if ( 42 <= (*p) && (*p) <= 43 )
337
+ goto tr21;
338
+ } else if ( (*p) >= 35 )
339
+ goto tr21;
340
+ } else if ( (*p) > 46 ) {
341
+ if ( (*p) < 65 ) {
342
+ if ( 48 <= (*p) && (*p) <= 57 )
343
+ goto tr21;
344
+ } else if ( (*p) > 90 ) {
345
+ if ( 94 <= (*p) && (*p) <= 122 )
346
+ goto tr21;
347
+ } else
348
+ goto tr21;
349
+ } else
350
+ goto tr21;
351
+ goto st0;
352
+ st16:
353
+ if ( ++p == pe )
354
+ goto _test_eof16;
355
+ case 16:
356
+ if ( (*p) == 10 )
357
+ goto tr22;
358
+ goto st0;
359
+ tr22:
360
+ #line 70 "ext/http11/http11_parser.rl"
361
+ {
362
+ parser->body_start = p - buffer + 1;
363
+ parser->header_done(parser, p + 1, pe - p - 1);
364
+ {p++; cs = 57; goto _out;}
365
+ }
366
+ goto st57;
367
+ st57:
368
+ if ( ++p == pe )
369
+ goto _test_eof57;
370
+ case 57:
371
+ #line 372 "ext/http11/http11_parser.c"
372
+ goto st0;
373
+ tr21:
374
+ #line 37 "ext/http11/http11_parser.rl"
375
+ { MARK(field_start, p); }
376
+ #line 38 "ext/http11/http11_parser.rl"
377
+ { snake_upcase_char((char *)p); }
378
+ goto st17;
379
+ tr23:
380
+ #line 38 "ext/http11/http11_parser.rl"
381
+ { snake_upcase_char((char *)p); }
382
+ goto st17;
383
+ st17:
384
+ if ( ++p == pe )
385
+ goto _test_eof17;
386
+ case 17:
387
+ #line 388 "ext/http11/http11_parser.c"
388
+ switch( (*p) ) {
389
+ case 33: goto tr23;
390
+ case 58: goto tr24;
391
+ case 124: goto tr23;
392
+ case 126: goto tr23;
393
+ }
394
+ if ( (*p) < 45 ) {
395
+ if ( (*p) > 39 ) {
396
+ if ( 42 <= (*p) && (*p) <= 43 )
397
+ goto tr23;
398
+ } else if ( (*p) >= 35 )
399
+ goto tr23;
400
+ } else if ( (*p) > 46 ) {
401
+ if ( (*p) < 65 ) {
402
+ if ( 48 <= (*p) && (*p) <= 57 )
403
+ goto tr23;
404
+ } else if ( (*p) > 90 ) {
405
+ if ( 94 <= (*p) && (*p) <= 122 )
406
+ goto tr23;
407
+ } else
408
+ goto tr23;
409
+ } else
410
+ goto tr23;
411
+ goto st0;
412
+ tr24:
413
+ #line 39 "ext/http11/http11_parser.rl"
414
+ {
415
+ parser->field_len = LEN(field_start, p);
416
+ }
417
+ goto st18;
418
+ tr27:
419
+ #line 43 "ext/http11/http11_parser.rl"
420
+ { MARK(mark, p); }
421
+ goto st18;
422
+ st18:
423
+ if ( ++p == pe )
424
+ goto _test_eof18;
425
+ case 18:
426
+ #line 427 "ext/http11/http11_parser.c"
427
+ switch( (*p) ) {
428
+ case 13: goto tr26;
429
+ case 32: goto tr27;
430
+ }
431
+ goto tr25;
432
+ tr25:
433
+ #line 43 "ext/http11/http11_parser.rl"
434
+ { MARK(mark, p); }
435
+ goto st19;
436
+ st19:
437
+ if ( ++p == pe )
438
+ goto _test_eof19;
439
+ case 19:
440
+ #line 441 "ext/http11/http11_parser.c"
441
+ if ( (*p) == 13 )
442
+ goto tr29;
443
+ goto st19;
444
+ tr9:
445
+ #line 50 "ext/http11/http11_parser.rl"
446
+ {
447
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
448
+ }
449
+ goto st20;
450
+ tr43:
451
+ #line 66 "ext/http11/http11_parser.rl"
452
+ {
453
+ parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
454
+ }
455
+ #line 50 "ext/http11/http11_parser.rl"
456
+ {
457
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
458
+ }
459
+ goto st20;
460
+ tr54:
461
+ #line 57 "ext/http11/http11_parser.rl"
462
+ { MARK(query_start, p); }
463
+ #line 58 "ext/http11/http11_parser.rl"
464
+ {
465
+ parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
466
+ }
467
+ #line 50 "ext/http11/http11_parser.rl"
468
+ {
469
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
470
+ }
471
+ goto st20;
472
+ tr58:
473
+ #line 58 "ext/http11/http11_parser.rl"
474
+ {
475
+ parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
476
+ }
477
+ #line 50 "ext/http11/http11_parser.rl"
478
+ {
479
+ parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
480
+ }
481
+ goto st20;
482
+ st20:
483
+ if ( ++p == pe )
484
+ goto _test_eof20;
485
+ case 20:
486
+ #line 487 "ext/http11/http11_parser.c"
487
+ switch( (*p) ) {
488
+ case 32: goto tr31;
489
+ case 37: goto tr32;
490
+ case 60: goto st0;
491
+ case 62: goto st0;
492
+ case 127: goto st0;
493
+ }
494
+ if ( (*p) > 31 ) {
495
+ if ( 34 <= (*p) && (*p) <= 35 )
496
+ goto st0;
497
+ } else if ( (*p) >= 0 )
498
+ goto st0;
499
+ goto tr30;
500
+ tr30:
501
+ #line 34 "ext/http11/http11_parser.rl"
502
+ { MARK(mark, p); }
503
+ goto st21;
504
+ st21:
505
+ if ( ++p == pe )
506
+ goto _test_eof21;
507
+ case 21:
508
+ #line 509 "ext/http11/http11_parser.c"
509
+ switch( (*p) ) {
510
+ case 32: goto tr34;
511
+ case 37: goto st22;
512
+ case 60: goto st0;
513
+ case 62: goto st0;
514
+ case 127: goto st0;
515
+ }
516
+ if ( (*p) > 31 ) {
517
+ if ( 34 <= (*p) && (*p) <= 35 )
518
+ goto st0;
519
+ } else if ( (*p) >= 0 )
520
+ goto st0;
521
+ goto st21;
522
+ tr32:
523
+ #line 34 "ext/http11/http11_parser.rl"
524
+ { MARK(mark, p); }
525
+ goto st22;
526
+ st22:
527
+ if ( ++p == pe )
528
+ goto _test_eof22;
529
+ case 22:
530
+ #line 531 "ext/http11/http11_parser.c"
531
+ if ( (*p) < 65 ) {
532
+ if ( 48 <= (*p) && (*p) <= 57 )
533
+ goto st23;
534
+ } else if ( (*p) > 70 ) {
535
+ if ( 97 <= (*p) && (*p) <= 102 )
536
+ goto st23;
537
+ } else
538
+ goto st23;
539
+ goto st0;
540
+ st23:
541
+ if ( ++p == pe )
542
+ goto _test_eof23;
543
+ case 23:
544
+ if ( (*p) < 65 ) {
545
+ if ( 48 <= (*p) && (*p) <= 57 )
546
+ goto st21;
547
+ } else if ( (*p) > 70 ) {
548
+ if ( 97 <= (*p) && (*p) <= 102 )
549
+ goto st21;
550
+ } else
551
+ goto st21;
552
+ goto st0;
553
+ tr5:
554
+ #line 34 "ext/http11/http11_parser.rl"
555
+ { MARK(mark, p); }
556
+ goto st24;
557
+ st24:
558
+ if ( ++p == pe )
559
+ goto _test_eof24;
560
+ case 24:
561
+ #line 562 "ext/http11/http11_parser.c"
562
+ switch( (*p) ) {
563
+ case 43: goto st24;
564
+ case 58: goto st25;
565
+ }
566
+ if ( (*p) < 48 ) {
567
+ if ( 45 <= (*p) && (*p) <= 46 )
568
+ goto st24;
569
+ } else if ( (*p) > 57 ) {
570
+ if ( (*p) > 90 ) {
571
+ if ( 97 <= (*p) && (*p) <= 122 )
572
+ goto st24;
573
+ } else if ( (*p) >= 65 )
574
+ goto st24;
575
+ } else
576
+ goto st24;
577
+ goto st0;
578
+ tr7:
579
+ #line 34 "ext/http11/http11_parser.rl"
580
+ { MARK(mark, p); }
581
+ goto st25;
582
+ st25:
583
+ if ( ++p == pe )
584
+ goto _test_eof25;
585
+ case 25:
586
+ #line 587 "ext/http11/http11_parser.c"
587
+ switch( (*p) ) {
588
+ case 32: goto tr8;
589
+ case 34: goto st0;
590
+ case 35: goto tr9;
591
+ case 37: goto st26;
592
+ case 60: goto st0;
593
+ case 62: goto st0;
594
+ case 127: goto st0;
595
+ }
596
+ if ( 0 <= (*p) && (*p) <= 31 )
597
+ goto st0;
598
+ goto st25;
599
+ st26:
600
+ if ( ++p == pe )
601
+ goto _test_eof26;
602
+ case 26:
603
+ if ( (*p) < 65 ) {
604
+ if ( 48 <= (*p) && (*p) <= 57 )
605
+ goto st27;
606
+ } else if ( (*p) > 70 ) {
607
+ if ( 97 <= (*p) && (*p) <= 102 )
608
+ goto st27;
609
+ } else
610
+ goto st27;
611
+ goto st0;
612
+ st27:
613
+ if ( ++p == pe )
614
+ goto _test_eof27;
615
+ case 27:
616
+ if ( (*p) < 65 ) {
617
+ if ( 48 <= (*p) && (*p) <= 57 )
618
+ goto st25;
619
+ } else if ( (*p) > 70 ) {
620
+ if ( 97 <= (*p) && (*p) <= 102 )
621
+ goto st25;
622
+ } else
623
+ goto st25;
624
+ goto st0;
625
+ tr6:
626
+ #line 34 "ext/http11/http11_parser.rl"
627
+ { MARK(mark, p); }
628
+ goto st28;
629
+ st28:
630
+ if ( ++p == pe )
631
+ goto _test_eof28;
632
+ case 28:
633
+ #line 634 "ext/http11/http11_parser.c"
634
+ switch( (*p) ) {
635
+ case 32: goto tr42;
636
+ case 34: goto st0;
637
+ case 35: goto tr43;
638
+ case 37: goto st29;
639
+ case 59: goto tr45;
640
+ case 60: goto st0;
641
+ case 62: goto st0;
642
+ case 63: goto tr46;
643
+ case 127: goto st0;
644
+ }
645
+ if ( 0 <= (*p) && (*p) <= 31 )
646
+ goto st0;
647
+ goto st28;
648
+ st29:
649
+ if ( ++p == pe )
650
+ goto _test_eof29;
651
+ case 29:
652
+ if ( (*p) < 65 ) {
653
+ if ( 48 <= (*p) && (*p) <= 57 )
654
+ goto st30;
655
+ } else if ( (*p) > 70 ) {
656
+ if ( 97 <= (*p) && (*p) <= 102 )
657
+ goto st30;
658
+ } else
659
+ goto st30;
660
+ goto st0;
661
+ st30:
662
+ if ( ++p == pe )
663
+ goto _test_eof30;
664
+ case 30:
665
+ if ( (*p) < 65 ) {
666
+ if ( 48 <= (*p) && (*p) <= 57 )
667
+ goto st28;
668
+ } else if ( (*p) > 70 ) {
669
+ if ( 97 <= (*p) && (*p) <= 102 )
670
+ goto st28;
671
+ } else
672
+ goto st28;
673
+ goto st0;
674
+ tr45:
675
+ #line 66 "ext/http11/http11_parser.rl"
676
+ {
677
+ parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
678
+ }
679
+ goto st31;
680
+ st31:
681
+ if ( ++p == pe )
682
+ goto _test_eof31;
683
+ case 31:
684
+ #line 685 "ext/http11/http11_parser.c"
685
+ switch( (*p) ) {
686
+ case 32: goto tr8;
687
+ case 34: goto st0;
688
+ case 35: goto tr9;
689
+ case 37: goto st32;
690
+ case 60: goto st0;
691
+ case 62: goto st0;
692
+ case 63: goto st34;
693
+ case 127: goto st0;
694
+ }
695
+ if ( 0 <= (*p) && (*p) <= 31 )
696
+ goto st0;
697
+ goto st31;
698
+ st32:
699
+ if ( ++p == pe )
700
+ goto _test_eof32;
701
+ case 32:
702
+ if ( (*p) < 65 ) {
703
+ if ( 48 <= (*p) && (*p) <= 57 )
704
+ goto st33;
705
+ } else if ( (*p) > 70 ) {
706
+ if ( 97 <= (*p) && (*p) <= 102 )
707
+ goto st33;
708
+ } else
709
+ goto st33;
710
+ goto st0;
711
+ st33:
712
+ if ( ++p == pe )
713
+ goto _test_eof33;
714
+ case 33:
715
+ if ( (*p) < 65 ) {
716
+ if ( 48 <= (*p) && (*p) <= 57 )
717
+ goto st31;
718
+ } else if ( (*p) > 70 ) {
719
+ if ( 97 <= (*p) && (*p) <= 102 )
720
+ goto st31;
721
+ } else
722
+ goto st31;
723
+ goto st0;
724
+ tr46:
725
+ #line 66 "ext/http11/http11_parser.rl"
726
+ {
727
+ parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
728
+ }
729
+ goto st34;
730
+ st34:
731
+ if ( ++p == pe )
732
+ goto _test_eof34;
733
+ case 34:
734
+ #line 735 "ext/http11/http11_parser.c"
735
+ switch( (*p) ) {
736
+ case 32: goto tr53;
737
+ case 34: goto st0;
738
+ case 35: goto tr54;
739
+ case 37: goto tr55;
740
+ case 60: goto st0;
741
+ case 62: goto st0;
742
+ case 127: goto st0;
743
+ }
744
+ if ( 0 <= (*p) && (*p) <= 31 )
745
+ goto st0;
746
+ goto tr52;
747
+ tr52:
748
+ #line 57 "ext/http11/http11_parser.rl"
749
+ { MARK(query_start, p); }
750
+ goto st35;
751
+ st35:
752
+ if ( ++p == pe )
753
+ goto _test_eof35;
754
+ case 35:
755
+ #line 756 "ext/http11/http11_parser.c"
756
+ switch( (*p) ) {
757
+ case 32: goto tr57;
758
+ case 34: goto st0;
759
+ case 35: goto tr58;
760
+ case 37: goto st36;
761
+ case 60: goto st0;
762
+ case 62: goto st0;
763
+ case 127: goto st0;
764
+ }
765
+ if ( 0 <= (*p) && (*p) <= 31 )
766
+ goto st0;
767
+ goto st35;
768
+ tr55:
769
+ #line 57 "ext/http11/http11_parser.rl"
770
+ { MARK(query_start, p); }
771
+ goto st36;
772
+ st36:
773
+ if ( ++p == pe )
774
+ goto _test_eof36;
775
+ case 36:
776
+ #line 777 "ext/http11/http11_parser.c"
777
+ if ( (*p) < 65 ) {
778
+ if ( 48 <= (*p) && (*p) <= 57 )
779
+ goto st37;
780
+ } else if ( (*p) > 70 ) {
781
+ if ( 97 <= (*p) && (*p) <= 102 )
782
+ goto st37;
783
+ } else
784
+ goto st37;
785
+ goto st0;
786
+ st37:
787
+ if ( ++p == pe )
788
+ goto _test_eof37;
789
+ case 37:
790
+ if ( (*p) < 65 ) {
791
+ if ( 48 <= (*p) && (*p) <= 57 )
792
+ goto st35;
793
+ } else if ( (*p) > 70 ) {
794
+ if ( 97 <= (*p) && (*p) <= 102 )
795
+ goto st35;
796
+ } else
797
+ goto st35;
798
+ goto st0;
799
+ st38:
800
+ if ( ++p == pe )
801
+ goto _test_eof38;
802
+ case 38:
803
+ switch( (*p) ) {
804
+ case 32: goto tr2;
805
+ case 36: goto st39;
806
+ case 95: goto st39;
807
+ }
808
+ if ( (*p) < 48 ) {
809
+ if ( 45 <= (*p) && (*p) <= 46 )
810
+ goto st39;
811
+ } else if ( (*p) > 57 ) {
812
+ if ( 65 <= (*p) && (*p) <= 90 )
813
+ goto st39;
814
+ } else
815
+ goto st39;
816
+ goto st0;
817
+ st39:
818
+ if ( ++p == pe )
819
+ goto _test_eof39;
820
+ case 39:
821
+ switch( (*p) ) {
822
+ case 32: goto tr2;
823
+ case 36: goto st40;
824
+ case 95: goto st40;
825
+ }
826
+ if ( (*p) < 48 ) {
827
+ if ( 45 <= (*p) && (*p) <= 46 )
828
+ goto st40;
829
+ } else if ( (*p) > 57 ) {
830
+ if ( 65 <= (*p) && (*p) <= 90 )
831
+ goto st40;
832
+ } else
833
+ goto st40;
834
+ goto st0;
835
+ st40:
836
+ if ( ++p == pe )
837
+ goto _test_eof40;
838
+ case 40:
839
+ switch( (*p) ) {
840
+ case 32: goto tr2;
841
+ case 36: goto st41;
842
+ case 95: goto st41;
843
+ }
844
+ if ( (*p) < 48 ) {
845
+ if ( 45 <= (*p) && (*p) <= 46 )
846
+ goto st41;
847
+ } else if ( (*p) > 57 ) {
848
+ if ( 65 <= (*p) && (*p) <= 90 )
849
+ goto st41;
850
+ } else
851
+ goto st41;
852
+ goto st0;
853
+ st41:
854
+ if ( ++p == pe )
855
+ goto _test_eof41;
856
+ case 41:
857
+ switch( (*p) ) {
858
+ case 32: goto tr2;
859
+ case 36: goto st42;
860
+ case 95: goto st42;
861
+ }
862
+ if ( (*p) < 48 ) {
863
+ if ( 45 <= (*p) && (*p) <= 46 )
864
+ goto st42;
865
+ } else if ( (*p) > 57 ) {
866
+ if ( 65 <= (*p) && (*p) <= 90 )
867
+ goto st42;
868
+ } else
869
+ goto st42;
870
+ goto st0;
871
+ st42:
872
+ if ( ++p == pe )
873
+ goto _test_eof42;
874
+ case 42:
875
+ switch( (*p) ) {
876
+ case 32: goto tr2;
877
+ case 36: goto st43;
878
+ case 95: goto st43;
879
+ }
880
+ if ( (*p) < 48 ) {
881
+ if ( 45 <= (*p) && (*p) <= 46 )
882
+ goto st43;
883
+ } else if ( (*p) > 57 ) {
884
+ if ( 65 <= (*p) && (*p) <= 90 )
885
+ goto st43;
886
+ } else
887
+ goto st43;
888
+ goto st0;
889
+ st43:
890
+ if ( ++p == pe )
891
+ goto _test_eof43;
892
+ case 43:
893
+ switch( (*p) ) {
894
+ case 32: goto tr2;
895
+ case 36: goto st44;
896
+ case 95: goto st44;
897
+ }
898
+ if ( (*p) < 48 ) {
899
+ if ( 45 <= (*p) && (*p) <= 46 )
900
+ goto st44;
901
+ } else if ( (*p) > 57 ) {
902
+ if ( 65 <= (*p) && (*p) <= 90 )
903
+ goto st44;
904
+ } else
905
+ goto st44;
906
+ goto st0;
907
+ st44:
908
+ if ( ++p == pe )
909
+ goto _test_eof44;
910
+ case 44:
911
+ switch( (*p) ) {
912
+ case 32: goto tr2;
913
+ case 36: goto st45;
914
+ case 95: goto st45;
915
+ }
916
+ if ( (*p) < 48 ) {
917
+ if ( 45 <= (*p) && (*p) <= 46 )
918
+ goto st45;
919
+ } else if ( (*p) > 57 ) {
920
+ if ( 65 <= (*p) && (*p) <= 90 )
921
+ goto st45;
922
+ } else
923
+ goto st45;
924
+ goto st0;
925
+ st45:
926
+ if ( ++p == pe )
927
+ goto _test_eof45;
928
+ case 45:
929
+ switch( (*p) ) {
930
+ case 32: goto tr2;
931
+ case 36: goto st46;
932
+ case 95: goto st46;
933
+ }
934
+ if ( (*p) < 48 ) {
935
+ if ( 45 <= (*p) && (*p) <= 46 )
936
+ goto st46;
937
+ } else if ( (*p) > 57 ) {
938
+ if ( 65 <= (*p) && (*p) <= 90 )
939
+ goto st46;
940
+ } else
941
+ goto st46;
942
+ goto st0;
943
+ st46:
944
+ if ( ++p == pe )
945
+ goto _test_eof46;
946
+ case 46:
947
+ switch( (*p) ) {
948
+ case 32: goto tr2;
949
+ case 36: goto st47;
950
+ case 95: goto st47;
951
+ }
952
+ if ( (*p) < 48 ) {
953
+ if ( 45 <= (*p) && (*p) <= 46 )
954
+ goto st47;
955
+ } else if ( (*p) > 57 ) {
956
+ if ( 65 <= (*p) && (*p) <= 90 )
957
+ goto st47;
958
+ } else
959
+ goto st47;
960
+ goto st0;
961
+ st47:
962
+ if ( ++p == pe )
963
+ goto _test_eof47;
964
+ case 47:
965
+ switch( (*p) ) {
966
+ case 32: goto tr2;
967
+ case 36: goto st48;
968
+ case 95: goto st48;
969
+ }
970
+ if ( (*p) < 48 ) {
971
+ if ( 45 <= (*p) && (*p) <= 46 )
972
+ goto st48;
973
+ } else if ( (*p) > 57 ) {
974
+ if ( 65 <= (*p) && (*p) <= 90 )
975
+ goto st48;
976
+ } else
977
+ goto st48;
978
+ goto st0;
979
+ st48:
980
+ if ( ++p == pe )
981
+ goto _test_eof48;
982
+ case 48:
983
+ switch( (*p) ) {
984
+ case 32: goto tr2;
985
+ case 36: goto st49;
986
+ case 95: goto st49;
987
+ }
988
+ if ( (*p) < 48 ) {
989
+ if ( 45 <= (*p) && (*p) <= 46 )
990
+ goto st49;
991
+ } else if ( (*p) > 57 ) {
992
+ if ( 65 <= (*p) && (*p) <= 90 )
993
+ goto st49;
994
+ } else
995
+ goto st49;
996
+ goto st0;
997
+ st49:
998
+ if ( ++p == pe )
999
+ goto _test_eof49;
1000
+ case 49:
1001
+ switch( (*p) ) {
1002
+ case 32: goto tr2;
1003
+ case 36: goto st50;
1004
+ case 95: goto st50;
1005
+ }
1006
+ if ( (*p) < 48 ) {
1007
+ if ( 45 <= (*p) && (*p) <= 46 )
1008
+ goto st50;
1009
+ } else if ( (*p) > 57 ) {
1010
+ if ( 65 <= (*p) && (*p) <= 90 )
1011
+ goto st50;
1012
+ } else
1013
+ goto st50;
1014
+ goto st0;
1015
+ st50:
1016
+ if ( ++p == pe )
1017
+ goto _test_eof50;
1018
+ case 50:
1019
+ switch( (*p) ) {
1020
+ case 32: goto tr2;
1021
+ case 36: goto st51;
1022
+ case 95: goto st51;
1023
+ }
1024
+ if ( (*p) < 48 ) {
1025
+ if ( 45 <= (*p) && (*p) <= 46 )
1026
+ goto st51;
1027
+ } else if ( (*p) > 57 ) {
1028
+ if ( 65 <= (*p) && (*p) <= 90 )
1029
+ goto st51;
1030
+ } else
1031
+ goto st51;
1032
+ goto st0;
1033
+ st51:
1034
+ if ( ++p == pe )
1035
+ goto _test_eof51;
1036
+ case 51:
1037
+ switch( (*p) ) {
1038
+ case 32: goto tr2;
1039
+ case 36: goto st52;
1040
+ case 95: goto st52;
1041
+ }
1042
+ if ( (*p) < 48 ) {
1043
+ if ( 45 <= (*p) && (*p) <= 46 )
1044
+ goto st52;
1045
+ } else if ( (*p) > 57 ) {
1046
+ if ( 65 <= (*p) && (*p) <= 90 )
1047
+ goto st52;
1048
+ } else
1049
+ goto st52;
1050
+ goto st0;
1051
+ st52:
1052
+ if ( ++p == pe )
1053
+ goto _test_eof52;
1054
+ case 52:
1055
+ switch( (*p) ) {
1056
+ case 32: goto tr2;
1057
+ case 36: goto st53;
1058
+ case 95: goto st53;
1059
+ }
1060
+ if ( (*p) < 48 ) {
1061
+ if ( 45 <= (*p) && (*p) <= 46 )
1062
+ goto st53;
1063
+ } else if ( (*p) > 57 ) {
1064
+ if ( 65 <= (*p) && (*p) <= 90 )
1065
+ goto st53;
1066
+ } else
1067
+ goto st53;
1068
+ goto st0;
1069
+ st53:
1070
+ if ( ++p == pe )
1071
+ goto _test_eof53;
1072
+ case 53:
1073
+ switch( (*p) ) {
1074
+ case 32: goto tr2;
1075
+ case 36: goto st54;
1076
+ case 95: goto st54;
1077
+ }
1078
+ if ( (*p) < 48 ) {
1079
+ if ( 45 <= (*p) && (*p) <= 46 )
1080
+ goto st54;
1081
+ } else if ( (*p) > 57 ) {
1082
+ if ( 65 <= (*p) && (*p) <= 90 )
1083
+ goto st54;
1084
+ } else
1085
+ goto st54;
1086
+ goto st0;
1087
+ st54:
1088
+ if ( ++p == pe )
1089
+ goto _test_eof54;
1090
+ case 54:
1091
+ switch( (*p) ) {
1092
+ case 32: goto tr2;
1093
+ case 36: goto st55;
1094
+ case 95: goto st55;
1095
+ }
1096
+ if ( (*p) < 48 ) {
1097
+ if ( 45 <= (*p) && (*p) <= 46 )
1098
+ goto st55;
1099
+ } else if ( (*p) > 57 ) {
1100
+ if ( 65 <= (*p) && (*p) <= 90 )
1101
+ goto st55;
1102
+ } else
1103
+ goto st55;
1104
+ goto st0;
1105
+ st55:
1106
+ if ( ++p == pe )
1107
+ goto _test_eof55;
1108
+ case 55:
1109
+ switch( (*p) ) {
1110
+ case 32: goto tr2;
1111
+ case 36: goto st56;
1112
+ case 95: goto st56;
1113
+ }
1114
+ if ( (*p) < 48 ) {
1115
+ if ( 45 <= (*p) && (*p) <= 46 )
1116
+ goto st56;
1117
+ } else if ( (*p) > 57 ) {
1118
+ if ( 65 <= (*p) && (*p) <= 90 )
1119
+ goto st56;
1120
+ } else
1121
+ goto st56;
1122
+ goto st0;
1123
+ st56:
1124
+ if ( ++p == pe )
1125
+ goto _test_eof56;
1126
+ case 56:
1127
+ if ( (*p) == 32 )
1128
+ goto tr2;
1129
+ goto st0;
1130
+ }
1131
+ _test_eof2: cs = 2; goto _test_eof;
1132
+ _test_eof3: cs = 3; goto _test_eof;
1133
+ _test_eof4: cs = 4; goto _test_eof;
1134
+ _test_eof5: cs = 5; goto _test_eof;
1135
+ _test_eof6: cs = 6; goto _test_eof;
1136
+ _test_eof7: cs = 7; goto _test_eof;
1137
+ _test_eof8: cs = 8; goto _test_eof;
1138
+ _test_eof9: cs = 9; goto _test_eof;
1139
+ _test_eof10: cs = 10; goto _test_eof;
1140
+ _test_eof11: cs = 11; goto _test_eof;
1141
+ _test_eof12: cs = 12; goto _test_eof;
1142
+ _test_eof13: cs = 13; goto _test_eof;
1143
+ _test_eof14: cs = 14; goto _test_eof;
1144
+ _test_eof15: cs = 15; goto _test_eof;
1145
+ _test_eof16: cs = 16; goto _test_eof;
1146
+ _test_eof57: cs = 57; goto _test_eof;
1147
+ _test_eof17: cs = 17; goto _test_eof;
1148
+ _test_eof18: cs = 18; goto _test_eof;
1149
+ _test_eof19: cs = 19; goto _test_eof;
1150
+ _test_eof20: cs = 20; goto _test_eof;
1151
+ _test_eof21: cs = 21; goto _test_eof;
1152
+ _test_eof22: cs = 22; goto _test_eof;
1153
+ _test_eof23: cs = 23; goto _test_eof;
1154
+ _test_eof24: cs = 24; goto _test_eof;
1155
+ _test_eof25: cs = 25; goto _test_eof;
1156
+ _test_eof26: cs = 26; goto _test_eof;
1157
+ _test_eof27: cs = 27; goto _test_eof;
1158
+ _test_eof28: cs = 28; goto _test_eof;
1159
+ _test_eof29: cs = 29; goto _test_eof;
1160
+ _test_eof30: cs = 30; goto _test_eof;
1161
+ _test_eof31: cs = 31; goto _test_eof;
1162
+ _test_eof32: cs = 32; goto _test_eof;
1163
+ _test_eof33: cs = 33; goto _test_eof;
1164
+ _test_eof34: cs = 34; goto _test_eof;
1165
+ _test_eof35: cs = 35; goto _test_eof;
1166
+ _test_eof36: cs = 36; goto _test_eof;
1167
+ _test_eof37: cs = 37; goto _test_eof;
1168
+ _test_eof38: cs = 38; goto _test_eof;
1169
+ _test_eof39: cs = 39; goto _test_eof;
1170
+ _test_eof40: cs = 40; goto _test_eof;
1171
+ _test_eof41: cs = 41; goto _test_eof;
1172
+ _test_eof42: cs = 42; goto _test_eof;
1173
+ _test_eof43: cs = 43; goto _test_eof;
1174
+ _test_eof44: cs = 44; goto _test_eof;
1175
+ _test_eof45: cs = 45; goto _test_eof;
1176
+ _test_eof46: cs = 46; goto _test_eof;
1177
+ _test_eof47: cs = 47; goto _test_eof;
1178
+ _test_eof48: cs = 48; goto _test_eof;
1179
+ _test_eof49: cs = 49; goto _test_eof;
1180
+ _test_eof50: cs = 50; goto _test_eof;
1181
+ _test_eof51: cs = 51; goto _test_eof;
1182
+ _test_eof52: cs = 52; goto _test_eof;
1183
+ _test_eof53: cs = 53; goto _test_eof;
1184
+ _test_eof54: cs = 54; goto _test_eof;
1185
+ _test_eof55: cs = 55; goto _test_eof;
1186
+ _test_eof56: cs = 56; goto _test_eof;
1187
+
1188
+ _test_eof: {}
1189
+ _out: {}
1190
+ }
1191
+
1192
+ #line 114 "ext/http11/http11_parser.rl"
1193
+
1194
+ if (!puma_parser_has_error(parser))
1195
+ parser->cs = cs;
1196
+ parser->nread += p - (buffer + off);
1197
+
1198
+ assert(p <= pe && "buffer overflow after parsing execute");
1199
+ assert(parser->nread <= len && "nread longer than length");
1200
+ assert(parser->body_start <= len && "body starts after buffer end");
1201
+ assert(parser->mark < len && "mark is after buffer end");
1202
+ assert(parser->field_len <= len && "field has length longer than whole buffer");
1203
+ assert(parser->field_start < len && "field starts after buffer end");
1204
+
1205
+ return(parser->nread);
1206
+ }
1207
+
1208
+ int puma_parser_finish(puma_parser *parser)
1209
+ {
1210
+ if (puma_parser_has_error(parser) ) {
1211
+ return -1;
1212
+ } else if (puma_parser_is_finished(parser) ) {
1213
+ return 1;
1214
+ } else {
1215
+ return 0;
1216
+ }
1217
+ }
1218
+
1219
+ int puma_parser_has_error(puma_parser *parser) {
1220
+ return parser->cs == puma_parser_error;
1221
+ }
1222
+
1223
+ int puma_parser_is_finished(puma_parser *parser) {
1224
+ return parser->cs >= puma_parser_first_final;
1225
+ }