puma 0.8.0

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 (59) hide show
  1. data/.gemtest +0 -0
  2. data/COPYING +55 -0
  3. data/History.txt +69 -0
  4. data/LICENSE +26 -0
  5. data/Manifest.txt +57 -0
  6. data/README.md +60 -0
  7. data/Rakefile +10 -0
  8. data/TODO +5 -0
  9. data/bin/puma +15 -0
  10. data/examples/builder.rb +29 -0
  11. data/examples/camping/README +3 -0
  12. data/examples/camping/blog.rb +294 -0
  13. data/examples/camping/tepee.rb +149 -0
  14. data/examples/httpd.conf +474 -0
  15. data/examples/mime.yaml +3 -0
  16. data/examples/mongrel.conf +9 -0
  17. data/examples/monitrc +57 -0
  18. data/examples/random_thrash.rb +19 -0
  19. data/examples/simpletest.rb +52 -0
  20. data/examples/webrick_compare.rb +20 -0
  21. data/ext/puma_http11/Http11Service.java +13 -0
  22. data/ext/puma_http11/ext_help.h +15 -0
  23. data/ext/puma_http11/extconf.rb +5 -0
  24. data/ext/puma_http11/http11_parser.c +1225 -0
  25. data/ext/puma_http11/http11_parser.h +63 -0
  26. data/ext/puma_http11/http11_parser.java.rl +159 -0
  27. data/ext/puma_http11/http11_parser.rl +146 -0
  28. data/ext/puma_http11/http11_parser_common.rl +54 -0
  29. data/ext/puma_http11/org/jruby/mongrel/Http11.java +241 -0
  30. data/ext/puma_http11/org/jruby/mongrel/Http11Parser.java +486 -0
  31. data/ext/puma_http11/puma_http11.c +482 -0
  32. data/lib/puma.rb +18 -0
  33. data/lib/puma/cli.rb +131 -0
  34. data/lib/puma/const.rb +132 -0
  35. data/lib/puma/events.rb +36 -0
  36. data/lib/puma/gems.rb +20 -0
  37. data/lib/puma/mime_types.yml +616 -0
  38. data/lib/puma/server.rb +419 -0
  39. data/lib/puma/thread_pool.rb +95 -0
  40. data/lib/puma/utils.rb +44 -0
  41. data/lib/rack/handler/puma.rb +33 -0
  42. data/puma.gemspec +37 -0
  43. data/tasks/gem.rake +22 -0
  44. data/tasks/java.rake +12 -0
  45. data/tasks/native.rake +25 -0
  46. data/tasks/ragel.rake +20 -0
  47. data/test/lobster.ru +4 -0
  48. data/test/mime.yaml +3 -0
  49. data/test/test_http10.rb +27 -0
  50. data/test/test_http11.rb +151 -0
  51. data/test/test_persistent.rb +159 -0
  52. data/test/test_rack_handler.rb +10 -0
  53. data/test/test_rack_server.rb +107 -0
  54. data/test/test_thread_pool.rb +102 -0
  55. data/test/test_unix_socket.rb +34 -0
  56. data/test/test_ws.rb +97 -0
  57. data/test/testhelp.rb +41 -0
  58. data/tools/trickletest.rb +45 -0
  59. metadata +165 -0
@@ -0,0 +1,3 @@
1
+ ---
2
+ .jpeg: image/jpeg
3
+ .png: image/test
@@ -0,0 +1,9 @@
1
+ ---
2
+ :environment: production
3
+ :daemon: "true"
4
+ :host: 0.0.0.0
5
+ :log_file: log/mongrel.log
6
+ :docroot: public
7
+ :debug: "false"
8
+ :port: 3000
9
+ :pid_file: log/mongrel.pid
@@ -0,0 +1,57 @@
1
+ set daemon 60
2
+ set logfile syslog facility log_daemon
3
+ set mailserver localhost
4
+ set mail-format { from: monit@localhost }
5
+ set alert root@localhost
6
+
7
+ check process sshd with pidfile /var/run/sshd.pid
8
+ start program "/etc/init.d/ssh start"
9
+ stop program "/etc/init.d/ssh stop"
10
+ if failed port 22 protocol ssh then restart
11
+ if 5 restarts within 5 cycles then timeout
12
+
13
+ check process mysql with pidfile /var/run/mysqld/mysqld.pid
14
+ group database
15
+ start program = "/etc/init.d/mysql start"
16
+ stop program = "/etc/init.d/mysql stop"
17
+ if failed host 127.0.0.1 port 3306 then restart
18
+ if 5 restarts within 5 cycles then timeout
19
+
20
+ check process httpd with pidfile /usr/local/apache2/logs/httpd.pid
21
+ group www-data
22
+ start program "/usr/local/apache2/bin/apachectl start"
23
+ stop program "/usr/local/apache2/bin/apachectl stop"
24
+ if failed host localhost port 80 protocol http
25
+ and request "/" then alert
26
+ if cpu is greater than 60% for 2 cycles then alert
27
+ if cpu > 80% for 5 cycles then restart
28
+ if children > 250 then restart
29
+ if loadavg(5min) greater than 10 for 8 cycles then alert
30
+ if 3 restarts within 5 cycles then timeout
31
+
32
+ check process mongrel_8000 with pidfile /var/rails/MYAPP/log/mongrel.8000.pid
33
+ group root
34
+ if failed host 127.0.0.1 port 8000 protocol http
35
+ and request "/" then alert
36
+ if cpu is greater than 60% for 2 cycles then alert
37
+ if cpu > 80% for 5 cycles then restart
38
+ if loadavg(5min) greater than 10 for 8 cycles then restart
39
+ if 3 restarts within 5 cycles then timeout
40
+
41
+ check process mongrel_8001 with pidfile /var/rails/MYAPP/log/mongrel.8001.pid
42
+ group root
43
+ if failed host 127.0.0.1 port 8001 protocol http
44
+ and request "/" then alert
45
+ if cpu is greater than 60% for 2 cycles then alert
46
+ if cpu > 80% for 5 cycles then alert
47
+ if loadavg(5min) greater than 10 for 8 cycles then alert
48
+ if 3 restarts within 5 cycles then timeout
49
+
50
+ check process postfix with pidfile /var/spool/postfix/pid/master.pid
51
+ group mail
52
+ start program = "/etc/init.d/postfix start"
53
+ stop program = "/etc/init.d/postfix stop"
54
+ if failed port 25 protocol smtp then restart
55
+ if 5 restarts within 5 cycles then timeout
56
+
57
+
@@ -0,0 +1,19 @@
1
+ require 'socket'
2
+ devrand = open("/dev/random","r")
3
+
4
+ loop do
5
+ s = TCPSocket.new(ARGV[0],ARGV[1])
6
+ s.write("GET / HTTP/1.1\r\n")
7
+ total = 0
8
+ begin
9
+ loop do
10
+ r = devrand.read(10)
11
+ n = s.write(r)
12
+ total += n
13
+ end
14
+ rescue Object
15
+ STDERR.puts "#$!: #{total}"
16
+ end
17
+ s.close
18
+ sleep 1
19
+ end
@@ -0,0 +1,52 @@
1
+ $LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib")
2
+ require 'mongrel'
3
+ require 'yaml'
4
+
5
+ class SimpleHandler < Mongrel::HttpHandler
6
+ def process(request, response)
7
+ response.start do |head,out|
8
+ head["Content-Type"] = "text/html"
9
+ results = "<html><body>Your request:<br /><pre>#{request.params.to_yaml}</pre><a href=\"/files\">View the files.</a></body></html>"
10
+ out << results
11
+ end
12
+ end
13
+ end
14
+
15
+ class DumbHandler < Mongrel::HttpHandler
16
+ def process(request, response)
17
+ response.start do |head,out|
18
+ head["Content-Type"] = "text/html"
19
+ out.write("test")
20
+ end
21
+ end
22
+ end
23
+
24
+
25
+ if ARGV.length != 3
26
+ STDERR.puts "usage: simpletest.rb <host> <port> <docroot>"
27
+ exit(1)
28
+ end
29
+
30
+ stats = Mongrel::StatisticsFilter.new(:sample_rate => 1)
31
+
32
+ config = Mongrel::Configurator.new :host => ARGV[0], :port => ARGV[1] do
33
+ listener do
34
+ uri "/", :handler => SimpleHandler.new
35
+ uri "/", :handler => Mongrel::DeflateFilter.new
36
+ uri "/", :handler => stats
37
+ uri "/dumb", :handler => DumbHandler.new
38
+ uri "/dumb", :handler => Mongrel::DeflateFilter.new
39
+ uri "/dumb", :handler => stats
40
+ uri "/files", :handler => Mongrel::DirHandler.new(ARGV[2])
41
+ uri "/files", :handler => stats
42
+ uri "/status", :handler => Mongrel::StatusHandler.new(:stats_filter => stats)
43
+ redirect "/redir1", "/"
44
+ redirect "/to", /to/, 'w'
45
+ end
46
+
47
+ trap("INT") { stop }
48
+ run
49
+ end
50
+
51
+ puts "Mongrel running on #{ARGV[0]}:#{ARGV[1]} with docroot #{ARGV[2]}"
52
+ config.join
@@ -0,0 +1,20 @@
1
+ #!/usr/local/bin/ruby
2
+ require 'webrick'
3
+ include WEBrick
4
+
5
+ s = HTTPServer.new( :Port => 4000 )
6
+
7
+ # HTTPServer#mount(path, servletclass)
8
+ # When a request referring "/hello" is received,
9
+ # the HTTPServer get an instance of servletclass
10
+ # and then call a method named do_"a HTTP method".
11
+
12
+ class HelloServlet < HTTPServlet::AbstractServlet
13
+ def do_GET(req, res)
14
+ res.body = "hello!"
15
+ res['Content-Type'] = "text/html"
16
+ end
17
+ end
18
+ s.mount("/test", HelloServlet)
19
+
20
+ s.start
@@ -0,0 +1,13 @@
1
+ import java.io.IOException;
2
+
3
+ import org.jruby.Ruby;
4
+ import org.jruby.runtime.load.BasicLibraryService;
5
+
6
+ import org.jruby.mongrel.Http11;
7
+
8
+ public class Http11Service implements BasicLibraryService {
9
+ public boolean basicLoad(final Ruby runtime) throws IOException {
10
+ Http11.createHttp11(runtime);
11
+ return true;
12
+ }
13
+ }
@@ -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, "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, "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,5 @@
1
+ require 'mkmf'
2
+
3
+ dir_config("puma_http11")
4
+
5
+ create_makefile("puma_http11")
@@ -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 http_parser_start = 1;
40
+ static const int http_parser_first_final = 57;
41
+ static const int http_parser_error = 0;
42
+
43
+ static const int http_parser_en_main = 1;
44
+
45
+
46
+ #line 82 "ext/http11/http11_parser.rl"
47
+
48
+ int http_parser_init(http_parser *parser) {
49
+ int cs = 0;
50
+
51
+ #line 52 "ext/http11/http11_parser.c"
52
+ {
53
+ cs = http_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 http_parser_execute(http_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 (!http_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 http_parser_finish(http_parser *parser)
1209
+ {
1210
+ if (http_parser_has_error(parser) ) {
1211
+ return -1;
1212
+ } else if (http_parser_is_finished(parser) ) {
1213
+ return 1;
1214
+ } else {
1215
+ return 0;
1216
+ }
1217
+ }
1218
+
1219
+ int http_parser_has_error(http_parser *parser) {
1220
+ return parser->cs == http_parser_error;
1221
+ }
1222
+
1223
+ int http_parser_is_finished(http_parser *parser) {
1224
+ return parser->cs >= http_parser_first_final;
1225
+ }