steamcannon-thin 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. data/CHANGELOG +288 -0
  2. data/COPYING +18 -0
  3. data/README +69 -0
  4. data/Rakefile +44 -0
  5. data/benchmark/abc +51 -0
  6. data/benchmark/benchmarker.rb +80 -0
  7. data/benchmark/runner +82 -0
  8. data/bin/thin +6 -0
  9. data/example/adapter.rb +32 -0
  10. data/example/async_app.ru +126 -0
  11. data/example/async_chat.ru +247 -0
  12. data/example/async_tailer.ru +100 -0
  13. data/example/config.ru +22 -0
  14. data/example/monit_sockets +20 -0
  15. data/example/monit_unixsock +20 -0
  16. data/example/myapp.rb +1 -0
  17. data/example/ramaze.ru +12 -0
  18. data/example/thin.god +80 -0
  19. data/example/thin_solaris_smf.erb +36 -0
  20. data/example/thin_solaris_smf.readme.txt +150 -0
  21. data/example/vlad.rake +64 -0
  22. data/ext/thin_parser/common.rl +55 -0
  23. data/ext/thin_parser/ext_help.h +14 -0
  24. data/ext/thin_parser/extconf.rb +6 -0
  25. data/ext/thin_parser/parser.c +1249 -0
  26. data/ext/thin_parser/parser.h +49 -0
  27. data/ext/thin_parser/parser.rl +157 -0
  28. data/ext/thin_parser/thin.c +436 -0
  29. data/lib/rack/adapter/loader.rb +91 -0
  30. data/lib/rack/adapter/rails.rb +183 -0
  31. data/lib/thin.rb +56 -0
  32. data/lib/thin/backends/base.rb +149 -0
  33. data/lib/thin/backends/swiftiply_client.rb +56 -0
  34. data/lib/thin/backends/tcp_server.rb +29 -0
  35. data/lib/thin/backends/unix_server.rb +51 -0
  36. data/lib/thin/command.rb +53 -0
  37. data/lib/thin/connection.rb +224 -0
  38. data/lib/thin/controllers/cluster.rb +178 -0
  39. data/lib/thin/controllers/controller.rb +188 -0
  40. data/lib/thin/controllers/service.rb +75 -0
  41. data/lib/thin/controllers/service.sh.erb +39 -0
  42. data/lib/thin/daemonizing.rb +180 -0
  43. data/lib/thin/headers.rb +39 -0
  44. data/lib/thin/logging.rb +54 -0
  45. data/lib/thin/request.rb +156 -0
  46. data/lib/thin/response.rb +101 -0
  47. data/lib/thin/runner.rb +220 -0
  48. data/lib/thin/server.rb +253 -0
  49. data/lib/thin/stats.html.erb +216 -0
  50. data/lib/thin/stats.rb +52 -0
  51. data/lib/thin/statuses.rb +43 -0
  52. data/lib/thin/version.rb +32 -0
  53. data/lib/thin_parser.so +0 -0
  54. data/spec/backends/swiftiply_client_spec.rb +66 -0
  55. data/spec/backends/tcp_server_spec.rb +33 -0
  56. data/spec/backends/unix_server_spec.rb +37 -0
  57. data/spec/command_spec.rb +25 -0
  58. data/spec/configs/cluster.yml +9 -0
  59. data/spec/configs/single.yml +9 -0
  60. data/spec/connection_spec.rb +106 -0
  61. data/spec/controllers/cluster_spec.rb +267 -0
  62. data/spec/controllers/controller_spec.rb +129 -0
  63. data/spec/controllers/service_spec.rb +50 -0
  64. data/spec/daemonizing_spec.rb +196 -0
  65. data/spec/headers_spec.rb +40 -0
  66. data/spec/logging_spec.rb +46 -0
  67. data/spec/perf/request_perf_spec.rb +50 -0
  68. data/spec/perf/response_perf_spec.rb +19 -0
  69. data/spec/perf/server_perf_spec.rb +39 -0
  70. data/spec/rack/loader_spec.rb +42 -0
  71. data/spec/rack/rails_adapter_spec.rb +173 -0
  72. data/spec/rails_app/app/controllers/application.rb +10 -0
  73. data/spec/rails_app/app/controllers/simple_controller.rb +19 -0
  74. data/spec/rails_app/app/helpers/application_helper.rb +3 -0
  75. data/spec/rails_app/app/views/simple/index.html.erb +15 -0
  76. data/spec/rails_app/config/boot.rb +109 -0
  77. data/spec/rails_app/config/environment.rb +64 -0
  78. data/spec/rails_app/config/environments/development.rb +18 -0
  79. data/spec/rails_app/config/environments/production.rb +19 -0
  80. data/spec/rails_app/config/environments/test.rb +22 -0
  81. data/spec/rails_app/config/initializers/inflections.rb +10 -0
  82. data/spec/rails_app/config/initializers/mime_types.rb +5 -0
  83. data/spec/rails_app/config/routes.rb +35 -0
  84. data/spec/rails_app/public/404.html +30 -0
  85. data/spec/rails_app/public/422.html +30 -0
  86. data/spec/rails_app/public/500.html +30 -0
  87. data/spec/rails_app/public/dispatch.cgi +10 -0
  88. data/spec/rails_app/public/dispatch.fcgi +24 -0
  89. data/spec/rails_app/public/dispatch.rb +10 -0
  90. data/spec/rails_app/public/favicon.ico +0 -0
  91. data/spec/rails_app/public/images/rails.png +0 -0
  92. data/spec/rails_app/public/index.html +277 -0
  93. data/spec/rails_app/public/javascripts/application.js +2 -0
  94. data/spec/rails_app/public/javascripts/controls.js +963 -0
  95. data/spec/rails_app/public/javascripts/dragdrop.js +972 -0
  96. data/spec/rails_app/public/javascripts/effects.js +1120 -0
  97. data/spec/rails_app/public/javascripts/prototype.js +4225 -0
  98. data/spec/rails_app/public/robots.txt +5 -0
  99. data/spec/rails_app/script/about +3 -0
  100. data/spec/rails_app/script/console +3 -0
  101. data/spec/rails_app/script/destroy +3 -0
  102. data/spec/rails_app/script/generate +3 -0
  103. data/spec/rails_app/script/performance/benchmarker +3 -0
  104. data/spec/rails_app/script/performance/profiler +3 -0
  105. data/spec/rails_app/script/performance/request +3 -0
  106. data/spec/rails_app/script/plugin +3 -0
  107. data/spec/rails_app/script/process/inspector +3 -0
  108. data/spec/rails_app/script/process/reaper +3 -0
  109. data/spec/rails_app/script/process/spawner +3 -0
  110. data/spec/rails_app/script/runner +3 -0
  111. data/spec/rails_app/script/server +3 -0
  112. data/spec/request/mongrel_spec.rb +39 -0
  113. data/spec/request/parser_spec.rb +254 -0
  114. data/spec/request/persistent_spec.rb +35 -0
  115. data/spec/request/processing_spec.rb +50 -0
  116. data/spec/response_spec.rb +91 -0
  117. data/spec/runner_spec.rb +168 -0
  118. data/spec/server/builder_spec.rb +44 -0
  119. data/spec/server/pipelining_spec.rb +110 -0
  120. data/spec/server/robustness_spec.rb +34 -0
  121. data/spec/server/stopping_spec.rb +55 -0
  122. data/spec/server/swiftiply.yml +6 -0
  123. data/spec/server/swiftiply_spec.rb +32 -0
  124. data/spec/server/tcp_spec.rb +57 -0
  125. data/spec/server/threaded_spec.rb +27 -0
  126. data/spec/server/unix_socket_spec.rb +26 -0
  127. data/spec/server_spec.rb +100 -0
  128. data/spec/spec_helper.rb +220 -0
  129. data/tasks/announce.rake +22 -0
  130. data/tasks/deploy.rake +13 -0
  131. data/tasks/email.erb +30 -0
  132. data/tasks/gem.rake +66 -0
  133. data/tasks/rdoc.rake +25 -0
  134. data/tasks/site.rake +15 -0
  135. data/tasks/spec.rake +43 -0
  136. data/tasks/stats.rake +28 -0
  137. metadata +251 -0
data/example/vlad.rake ADDED
@@ -0,0 +1,64 @@
1
+ # $GEM_HOME/gems/vlad-1.2.0/lib/vlad/thin.rb
2
+ # Thin tasks for Vlad the Deployer
3
+ # By cnantais
4
+ require 'vlad'
5
+
6
+ namespace :vlad do
7
+ ##
8
+ # Thin app server
9
+
10
+ set :thin_address, "127.0.0.1"
11
+ set :thin_command, 'thin'
12
+ set(:thin_conf) { "#{shared_path}/thin_cluster.conf" }
13
+ set :thin_environment, "production"
14
+ set :thin_group, nil
15
+ set :thin_log_file, nil
16
+ set :thin_pid_file, nil
17
+ set :thin_port, nil
18
+ set :thin_socket, nil
19
+ set :thin_prefix, nil
20
+ set :thin_servers, 2
21
+ set :thin_user, nil
22
+
23
+ desc "Prepares application servers for deployment. thin
24
+ configuration is set via the thin_* variables.".cleanup
25
+
26
+ remote_task :setup_app, :roles => :app do
27
+
28
+ raise(ArgumentError, "Please provide either thin_socket or thin_port") if thin_port.nil? && thin_socket.nil?
29
+
30
+ cmd = [
31
+ "#{thin_command} config",
32
+ "-s #{thin_servers}",
33
+ ("-S #{thin_socket}" if thin_socket),
34
+ "-e #{thin_environment}",
35
+ "-a #{thin_address}",
36
+ "-c #{current_path}",
37
+ "-C #{thin_conf}",
38
+ ("-P #{thin_pid_file}" if thin_pid_file),
39
+ ("-l #{thin_log_file}" if thin_log_file),
40
+ ("--user #{thin_user}" if thin_user),
41
+ ("--group #{thin_group}" if thin_group),
42
+ ("--prefix #{thin_prefix}" if thin_prefix),
43
+ ("-p #{thin_port}" if thin_port),
44
+ ].compact.join ' '
45
+
46
+ run cmd
47
+ end
48
+
49
+ def thin(cmd) # :nodoc:
50
+ "#{thin_command} #{cmd} -C #{thin_conf}"
51
+ end
52
+
53
+ desc "Restart the app servers"
54
+
55
+ remote_task :start_app, :roles => :app do
56
+ run thin("restart -s #{thin_servers}")
57
+ end
58
+
59
+ desc "Stop the app servers"
60
+
61
+ remote_task :stop_app, :roles => :app do
62
+ run thin("stop -s #{thin_servers}")
63
+ end
64
+ end
@@ -0,0 +1,55 @@
1
+ %%{
2
+
3
+ machine http_parser_common;
4
+
5
+ #### HTTP PROTOCOL GRAMMAR
6
+ # line endings
7
+ CRLF = "\r\n";
8
+
9
+ # character types
10
+ CTL = (cntrl | 127);
11
+ safe = ("$" | "-" | "_" | ".");
12
+ extra = ("!" | "*" | "'" | "(" | ")" | ",");
13
+ reserved = (";" | "/" | "?" | ":" | "@" | "&" | "=" | "+");
14
+ sorta_safe = ("\"" | "<" | ">");
15
+ unsafe = (CTL | " " | "#" | "%" | sorta_safe);
16
+ national = any -- (alpha | digit | reserved | extra | safe | unsafe);
17
+ unreserved = (alpha | digit | safe | extra | national);
18
+ escape = ("%" "u"? xdigit xdigit);
19
+ uchar = (unreserved | escape | sorta_safe);
20
+ pchar = (uchar | ":" | "@" | "&" | "=" | "+");
21
+ tspecials = ("(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\\" | "\"" | "/" | "[" | "]" | "?" | "=" | "{" | "}" | " " | "\t");
22
+
23
+ # elements
24
+ token = (ascii -- (CTL | tspecials));
25
+
26
+ # URI schemes and absolute paths
27
+ scheme = ( alpha | digit | "+" | "-" | "." )* ;
28
+ absolute_uri = (scheme ":" (uchar | reserved )*);
29
+
30
+ path = ( pchar+ ( "/" pchar* )* ) ;
31
+ query = ( uchar | reserved )* %query_string ;
32
+ param = ( pchar | "/" )* ;
33
+ params = ( param ( ";" param )* ) ;
34
+ rel_path = ( path? (";" params)? %request_path) ("?" %start_query query)?;
35
+ absolute_path = ( "/"+ rel_path );
36
+
37
+ Request_URI = ( "*" | absolute_uri | absolute_path ) >mark %request_uri;
38
+ Fragment = ( uchar | reserved )* >mark %fragment;
39
+ Method = ( upper | digit | safe ){1,20} >mark %request_method;
40
+
41
+ http_number = ( digit+ "." digit+ ) ;
42
+ HTTP_Version = ( "HTTP/" http_number ) >mark %http_version ;
43
+ Request_Line = ( Method " " Request_URI ("#" Fragment){0,1} " " HTTP_Version CRLF ) ;
44
+
45
+ field_name = ( token -- ":" )+ >start_field %write_field;
46
+
47
+ field_value = any* >start_value %write_value;
48
+
49
+ message_header = field_name ":" " "* field_value :> CRLF;
50
+
51
+ Request = Request_Line ( message_header )* ( CRLF @done );
52
+
53
+ main := Request;
54
+
55
+ }%%
@@ -0,0 +1,14 @@
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
+
8
+ #ifdef DEBUG
9
+ #define TRACE() fprintf(stderr, "> %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__)
10
+ #else
11
+ #define TRACE()
12
+ #endif
13
+
14
+ #endif
@@ -0,0 +1,6 @@
1
+ require 'mkmf'
2
+
3
+ dir_config("thin_parser")
4
+ have_library("c", "main")
5
+
6
+ create_makefile("thin_parser")
@@ -0,0 +1,1249 @@
1
+
2
+ #line 1 "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 "parser.h"
8
+ #include <stdio.h>
9
+ #include <assert.h>
10
+ #include <stdlib.h>
11
+ #include <ctype.h>
12
+ #include <string.h>
13
+
14
+ #define LEN(AT, FPC) (FPC - buffer - parser->AT)
15
+ #define MARK(M,FPC) (parser->M = (FPC) - buffer)
16
+ #define PTR_TO(F) (buffer + parser->F)
17
+
18
+ /** Machine **/
19
+
20
+
21
+ #line 81 "parser.rl"
22
+
23
+
24
+ /** Data **/
25
+
26
+ #line 27 "parser.c"
27
+ static const int http_parser_start = 1;
28
+ static const int http_parser_first_final = 58;
29
+ static const int http_parser_error = 0;
30
+
31
+ static const int http_parser_en_main = 1;
32
+
33
+
34
+ #line 85 "parser.rl"
35
+
36
+ int thin_http_parser_init(http_parser *parser) {
37
+ int cs = 0;
38
+
39
+ #line 40 "parser.c"
40
+ {
41
+ cs = http_parser_start;
42
+ }
43
+
44
+ #line 89 "parser.rl"
45
+ parser->cs = cs;
46
+ parser->body_start = 0;
47
+ parser->content_len = 0;
48
+ parser->mark = 0;
49
+ parser->nread = 0;
50
+ parser->field_len = 0;
51
+ parser->field_start = 0;
52
+
53
+ return(1);
54
+ }
55
+
56
+
57
+ /** exec **/
58
+ size_t thin_http_parser_execute(http_parser *parser, const char *buffer, size_t len, size_t off) {
59
+ const char *p, *pe;
60
+ int cs = parser->cs;
61
+
62
+ assert(off <= len && "offset past end of buffer");
63
+
64
+ p = buffer+off;
65
+ pe = buffer+len;
66
+
67
+ assert(*pe == '\0' && "pointer does not end on NUL");
68
+ assert(pe - p == len - off && "pointers aren't same distance");
69
+
70
+
71
+
72
+ #line 73 "parser.c"
73
+ {
74
+ if ( p == pe )
75
+ goto _test_eof;
76
+ switch ( cs )
77
+ {
78
+ case 1:
79
+ switch( (*p) ) {
80
+ case 36: goto tr0;
81
+ case 95: goto tr0;
82
+ }
83
+ if ( (*p) < 48 ) {
84
+ if ( 45 <= (*p) && (*p) <= 46 )
85
+ goto tr0;
86
+ } else if ( (*p) > 57 ) {
87
+ if ( 65 <= (*p) && (*p) <= 90 )
88
+ goto tr0;
89
+ } else
90
+ goto tr0;
91
+ goto st0;
92
+ st0:
93
+ cs = 0;
94
+ goto _out;
95
+ tr0:
96
+ #line 22 "parser.rl"
97
+ {MARK(mark, p); }
98
+ goto st2;
99
+ st2:
100
+ if ( ++p == pe )
101
+ goto _test_eof2;
102
+ case 2:
103
+ #line 104 "parser.c"
104
+ switch( (*p) ) {
105
+ case 32: goto tr2;
106
+ case 36: goto st39;
107
+ case 95: goto st39;
108
+ }
109
+ if ( (*p) < 48 ) {
110
+ if ( 45 <= (*p) && (*p) <= 46 )
111
+ goto st39;
112
+ } else if ( (*p) > 57 ) {
113
+ if ( 65 <= (*p) && (*p) <= 90 )
114
+ goto st39;
115
+ } else
116
+ goto st39;
117
+ goto st0;
118
+ tr2:
119
+ #line 36 "parser.rl"
120
+ {
121
+ if (parser->request_method != NULL) {
122
+ parser->request_method(parser->data, PTR_TO(mark), LEN(mark, p));
123
+ }
124
+ }
125
+ goto st3;
126
+ st3:
127
+ if ( ++p == pe )
128
+ goto _test_eof3;
129
+ case 3:
130
+ #line 131 "parser.c"
131
+ switch( (*p) ) {
132
+ case 42: goto tr4;
133
+ case 43: goto tr5;
134
+ case 47: goto tr6;
135
+ case 58: goto tr7;
136
+ }
137
+ if ( (*p) < 65 ) {
138
+ if ( 45 <= (*p) && (*p) <= 57 )
139
+ goto tr5;
140
+ } else if ( (*p) > 90 ) {
141
+ if ( 97 <= (*p) && (*p) <= 122 )
142
+ goto tr5;
143
+ } else
144
+ goto tr5;
145
+ goto st0;
146
+ tr4:
147
+ #line 22 "parser.rl"
148
+ {MARK(mark, p); }
149
+ goto st4;
150
+ st4:
151
+ if ( ++p == pe )
152
+ goto _test_eof4;
153
+ case 4:
154
+ #line 155 "parser.c"
155
+ switch( (*p) ) {
156
+ case 32: goto tr8;
157
+ case 35: goto tr9;
158
+ }
159
+ goto st0;
160
+ tr8:
161
+ #line 41 "parser.rl"
162
+ {
163
+ if (parser->request_uri != NULL) {
164
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
165
+ }
166
+ }
167
+ goto st5;
168
+ tr31:
169
+ #line 22 "parser.rl"
170
+ {MARK(mark, p); }
171
+ #line 46 "parser.rl"
172
+ {
173
+ if (parser->fragment != NULL) {
174
+ parser->fragment(parser->data, PTR_TO(mark), LEN(mark, p));
175
+ }
176
+ }
177
+ goto st5;
178
+ tr34:
179
+ #line 46 "parser.rl"
180
+ {
181
+ if (parser->fragment != NULL) {
182
+ parser->fragment(parser->data, PTR_TO(mark), LEN(mark, p));
183
+ }
184
+ }
185
+ goto st5;
186
+ tr44:
187
+ #line 65 "parser.rl"
188
+ {
189
+ if (parser->request_path != NULL) {
190
+ parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
191
+ }
192
+ }
193
+ #line 41 "parser.rl"
194
+ {
195
+ if (parser->request_uri != NULL) {
196
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
197
+ }
198
+ }
199
+ goto st5;
200
+ tr51:
201
+ #line 52 "parser.rl"
202
+ {MARK(query_start, p); }
203
+ #line 53 "parser.rl"
204
+ {
205
+ if (parser->query_string != NULL) {
206
+ parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
207
+ }
208
+ }
209
+ #line 41 "parser.rl"
210
+ {
211
+ if (parser->request_uri != NULL) {
212
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
213
+ }
214
+ }
215
+ goto st5;
216
+ tr55:
217
+ #line 53 "parser.rl"
218
+ {
219
+ if (parser->query_string != NULL) {
220
+ parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
221
+ }
222
+ }
223
+ #line 41 "parser.rl"
224
+ {
225
+ if (parser->request_uri != NULL) {
226
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
227
+ }
228
+ }
229
+ goto st5;
230
+ st5:
231
+ if ( ++p == pe )
232
+ goto _test_eof5;
233
+ case 5:
234
+ #line 235 "parser.c"
235
+ if ( (*p) == 72 )
236
+ goto tr10;
237
+ goto st0;
238
+ tr10:
239
+ #line 22 "parser.rl"
240
+ {MARK(mark, p); }
241
+ goto st6;
242
+ st6:
243
+ if ( ++p == pe )
244
+ goto _test_eof6;
245
+ case 6:
246
+ #line 247 "parser.c"
247
+ if ( (*p) == 84 )
248
+ goto st7;
249
+ goto st0;
250
+ st7:
251
+ if ( ++p == pe )
252
+ goto _test_eof7;
253
+ case 7:
254
+ if ( (*p) == 84 )
255
+ goto st8;
256
+ goto st0;
257
+ st8:
258
+ if ( ++p == pe )
259
+ goto _test_eof8;
260
+ case 8:
261
+ if ( (*p) == 80 )
262
+ goto st9;
263
+ goto st0;
264
+ st9:
265
+ if ( ++p == pe )
266
+ goto _test_eof9;
267
+ case 9:
268
+ if ( (*p) == 47 )
269
+ goto st10;
270
+ goto st0;
271
+ st10:
272
+ if ( ++p == pe )
273
+ goto _test_eof10;
274
+ case 10:
275
+ if ( 48 <= (*p) && (*p) <= 57 )
276
+ goto st11;
277
+ goto st0;
278
+ st11:
279
+ if ( ++p == pe )
280
+ goto _test_eof11;
281
+ case 11:
282
+ if ( (*p) == 46 )
283
+ goto st12;
284
+ if ( 48 <= (*p) && (*p) <= 57 )
285
+ goto st11;
286
+ goto st0;
287
+ st12:
288
+ if ( ++p == pe )
289
+ goto _test_eof12;
290
+ case 12:
291
+ if ( 48 <= (*p) && (*p) <= 57 )
292
+ goto st13;
293
+ goto st0;
294
+ st13:
295
+ if ( ++p == pe )
296
+ goto _test_eof13;
297
+ case 13:
298
+ if ( (*p) == 13 )
299
+ goto tr18;
300
+ if ( 48 <= (*p) && (*p) <= 57 )
301
+ goto st13;
302
+ goto st0;
303
+ tr18:
304
+ #line 59 "parser.rl"
305
+ {
306
+ if (parser->http_version != NULL) {
307
+ parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p));
308
+ }
309
+ }
310
+ goto st14;
311
+ tr26:
312
+ #line 30 "parser.rl"
313
+ { MARK(mark, p); }
314
+ #line 31 "parser.rl"
315
+ {
316
+ if (parser->http_field != NULL) {
317
+ parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
318
+ }
319
+ }
320
+ goto st14;
321
+ tr29:
322
+ #line 31 "parser.rl"
323
+ {
324
+ if (parser->http_field != NULL) {
325
+ parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
326
+ }
327
+ }
328
+ goto st14;
329
+ st14:
330
+ if ( ++p == pe )
331
+ goto _test_eof14;
332
+ case 14:
333
+ #line 334 "parser.c"
334
+ if ( (*p) == 10 )
335
+ goto st15;
336
+ goto st0;
337
+ st15:
338
+ if ( ++p == pe )
339
+ goto _test_eof15;
340
+ case 15:
341
+ switch( (*p) ) {
342
+ case 13: goto st16;
343
+ case 33: goto tr21;
344
+ case 124: goto tr21;
345
+ case 126: goto tr21;
346
+ }
347
+ if ( (*p) < 45 ) {
348
+ if ( (*p) > 39 ) {
349
+ if ( 42 <= (*p) && (*p) <= 43 )
350
+ goto tr21;
351
+ } else if ( (*p) >= 35 )
352
+ goto tr21;
353
+ } else if ( (*p) > 46 ) {
354
+ if ( (*p) < 65 ) {
355
+ if ( 48 <= (*p) && (*p) <= 57 )
356
+ goto tr21;
357
+ } else if ( (*p) > 90 ) {
358
+ if ( 94 <= (*p) && (*p) <= 122 )
359
+ goto tr21;
360
+ } else
361
+ goto tr21;
362
+ } else
363
+ goto tr21;
364
+ goto st0;
365
+ st16:
366
+ if ( ++p == pe )
367
+ goto _test_eof16;
368
+ case 16:
369
+ if ( (*p) == 10 )
370
+ goto tr22;
371
+ goto st0;
372
+ tr22:
373
+ #line 71 "parser.rl"
374
+ {
375
+ parser->body_start = p - buffer + 1;
376
+ if (parser->header_done != NULL) {
377
+ parser->header_done(parser->data, p + 1, pe - p - 1);
378
+ }
379
+ {p++; cs = 58; goto _out;}
380
+ }
381
+ goto st58;
382
+ st58:
383
+ if ( ++p == pe )
384
+ goto _test_eof58;
385
+ case 58:
386
+ #line 387 "parser.c"
387
+ goto st0;
388
+ tr21:
389
+ #line 25 "parser.rl"
390
+ { MARK(field_start, p); }
391
+ goto st17;
392
+ st17:
393
+ if ( ++p == pe )
394
+ goto _test_eof17;
395
+ case 17:
396
+ #line 397 "parser.c"
397
+ switch( (*p) ) {
398
+ case 33: goto st17;
399
+ case 58: goto tr24;
400
+ case 124: goto st17;
401
+ case 126: goto st17;
402
+ }
403
+ if ( (*p) < 45 ) {
404
+ if ( (*p) > 39 ) {
405
+ if ( 42 <= (*p) && (*p) <= 43 )
406
+ goto st17;
407
+ } else if ( (*p) >= 35 )
408
+ goto st17;
409
+ } else if ( (*p) > 46 ) {
410
+ if ( (*p) < 65 ) {
411
+ if ( 48 <= (*p) && (*p) <= 57 )
412
+ goto st17;
413
+ } else if ( (*p) > 90 ) {
414
+ if ( 94 <= (*p) && (*p) <= 122 )
415
+ goto st17;
416
+ } else
417
+ goto st17;
418
+ } else
419
+ goto st17;
420
+ goto st0;
421
+ tr24:
422
+ #line 26 "parser.rl"
423
+ {
424
+ parser->field_len = LEN(field_start, p);
425
+ }
426
+ goto st18;
427
+ tr27:
428
+ #line 30 "parser.rl"
429
+ { MARK(mark, p); }
430
+ goto st18;
431
+ st18:
432
+ if ( ++p == pe )
433
+ goto _test_eof18;
434
+ case 18:
435
+ #line 436 "parser.c"
436
+ switch( (*p) ) {
437
+ case 13: goto tr26;
438
+ case 32: goto tr27;
439
+ }
440
+ goto tr25;
441
+ tr25:
442
+ #line 30 "parser.rl"
443
+ { MARK(mark, p); }
444
+ goto st19;
445
+ st19:
446
+ if ( ++p == pe )
447
+ goto _test_eof19;
448
+ case 19:
449
+ #line 450 "parser.c"
450
+ if ( (*p) == 13 )
451
+ goto tr29;
452
+ goto st19;
453
+ tr9:
454
+ #line 41 "parser.rl"
455
+ {
456
+ if (parser->request_uri != NULL) {
457
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
458
+ }
459
+ }
460
+ goto st20;
461
+ tr45:
462
+ #line 65 "parser.rl"
463
+ {
464
+ if (parser->request_path != NULL) {
465
+ parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
466
+ }
467
+ }
468
+ #line 41 "parser.rl"
469
+ {
470
+ if (parser->request_uri != NULL) {
471
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
472
+ }
473
+ }
474
+ goto st20;
475
+ tr52:
476
+ #line 52 "parser.rl"
477
+ {MARK(query_start, p); }
478
+ #line 53 "parser.rl"
479
+ {
480
+ if (parser->query_string != NULL) {
481
+ parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
482
+ }
483
+ }
484
+ #line 41 "parser.rl"
485
+ {
486
+ if (parser->request_uri != NULL) {
487
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
488
+ }
489
+ }
490
+ goto st20;
491
+ tr56:
492
+ #line 53 "parser.rl"
493
+ {
494
+ if (parser->query_string != NULL) {
495
+ parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
496
+ }
497
+ }
498
+ #line 41 "parser.rl"
499
+ {
500
+ if (parser->request_uri != NULL) {
501
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
502
+ }
503
+ }
504
+ goto st20;
505
+ st20:
506
+ if ( ++p == pe )
507
+ goto _test_eof20;
508
+ case 20:
509
+ #line 510 "parser.c"
510
+ switch( (*p) ) {
511
+ case 32: goto tr31;
512
+ case 35: goto st0;
513
+ case 37: goto tr32;
514
+ case 127: goto st0;
515
+ }
516
+ if ( 0 <= (*p) && (*p) <= 31 )
517
+ goto st0;
518
+ goto tr30;
519
+ tr30:
520
+ #line 22 "parser.rl"
521
+ {MARK(mark, p); }
522
+ goto st21;
523
+ st21:
524
+ if ( ++p == pe )
525
+ goto _test_eof21;
526
+ case 21:
527
+ #line 528 "parser.c"
528
+ switch( (*p) ) {
529
+ case 32: goto tr34;
530
+ case 35: goto st0;
531
+ case 37: goto st22;
532
+ case 127: goto st0;
533
+ }
534
+ if ( 0 <= (*p) && (*p) <= 31 )
535
+ goto st0;
536
+ goto st21;
537
+ tr32:
538
+ #line 22 "parser.rl"
539
+ {MARK(mark, p); }
540
+ goto st22;
541
+ st22:
542
+ if ( ++p == pe )
543
+ goto _test_eof22;
544
+ case 22:
545
+ #line 546 "parser.c"
546
+ if ( (*p) == 117 )
547
+ goto st24;
548
+ if ( (*p) < 65 ) {
549
+ if ( 48 <= (*p) && (*p) <= 57 )
550
+ goto st23;
551
+ } else if ( (*p) > 70 ) {
552
+ if ( 97 <= (*p) && (*p) <= 102 )
553
+ goto st23;
554
+ } else
555
+ goto st23;
556
+ goto st0;
557
+ st23:
558
+ if ( ++p == pe )
559
+ goto _test_eof23;
560
+ case 23:
561
+ if ( (*p) < 65 ) {
562
+ if ( 48 <= (*p) && (*p) <= 57 )
563
+ goto st21;
564
+ } else if ( (*p) > 70 ) {
565
+ if ( 97 <= (*p) && (*p) <= 102 )
566
+ goto st21;
567
+ } else
568
+ goto st21;
569
+ goto st0;
570
+ st24:
571
+ if ( ++p == pe )
572
+ goto _test_eof24;
573
+ case 24:
574
+ if ( (*p) < 65 ) {
575
+ if ( 48 <= (*p) && (*p) <= 57 )
576
+ goto st23;
577
+ } else if ( (*p) > 70 ) {
578
+ if ( 97 <= (*p) && (*p) <= 102 )
579
+ goto st23;
580
+ } else
581
+ goto st23;
582
+ goto st0;
583
+ tr5:
584
+ #line 22 "parser.rl"
585
+ {MARK(mark, p); }
586
+ goto st25;
587
+ st25:
588
+ if ( ++p == pe )
589
+ goto _test_eof25;
590
+ case 25:
591
+ #line 592 "parser.c"
592
+ switch( (*p) ) {
593
+ case 43: goto st25;
594
+ case 58: goto st26;
595
+ }
596
+ if ( (*p) < 48 ) {
597
+ if ( 45 <= (*p) && (*p) <= 46 )
598
+ goto st25;
599
+ } else if ( (*p) > 57 ) {
600
+ if ( (*p) > 90 ) {
601
+ if ( 97 <= (*p) && (*p) <= 122 )
602
+ goto st25;
603
+ } else if ( (*p) >= 65 )
604
+ goto st25;
605
+ } else
606
+ goto st25;
607
+ goto st0;
608
+ tr7:
609
+ #line 22 "parser.rl"
610
+ {MARK(mark, p); }
611
+ goto st26;
612
+ st26:
613
+ if ( ++p == pe )
614
+ goto _test_eof26;
615
+ case 26:
616
+ #line 617 "parser.c"
617
+ switch( (*p) ) {
618
+ case 32: goto tr8;
619
+ case 35: goto tr9;
620
+ case 37: goto st27;
621
+ case 127: goto st0;
622
+ }
623
+ if ( 0 <= (*p) && (*p) <= 31 )
624
+ goto st0;
625
+ goto st26;
626
+ st27:
627
+ if ( ++p == pe )
628
+ goto _test_eof27;
629
+ case 27:
630
+ if ( (*p) == 117 )
631
+ goto st29;
632
+ if ( (*p) < 65 ) {
633
+ if ( 48 <= (*p) && (*p) <= 57 )
634
+ goto st28;
635
+ } else if ( (*p) > 70 ) {
636
+ if ( 97 <= (*p) && (*p) <= 102 )
637
+ goto st28;
638
+ } else
639
+ goto st28;
640
+ goto st0;
641
+ st28:
642
+ if ( ++p == pe )
643
+ goto _test_eof28;
644
+ case 28:
645
+ if ( (*p) < 65 ) {
646
+ if ( 48 <= (*p) && (*p) <= 57 )
647
+ goto st26;
648
+ } else if ( (*p) > 70 ) {
649
+ if ( 97 <= (*p) && (*p) <= 102 )
650
+ goto st26;
651
+ } else
652
+ goto st26;
653
+ goto st0;
654
+ st29:
655
+ if ( ++p == pe )
656
+ goto _test_eof29;
657
+ case 29:
658
+ if ( (*p) < 65 ) {
659
+ if ( 48 <= (*p) && (*p) <= 57 )
660
+ goto st28;
661
+ } else if ( (*p) > 70 ) {
662
+ if ( 97 <= (*p) && (*p) <= 102 )
663
+ goto st28;
664
+ } else
665
+ goto st28;
666
+ goto st0;
667
+ tr6:
668
+ #line 22 "parser.rl"
669
+ {MARK(mark, p); }
670
+ goto st30;
671
+ st30:
672
+ if ( ++p == pe )
673
+ goto _test_eof30;
674
+ case 30:
675
+ #line 676 "parser.c"
676
+ switch( (*p) ) {
677
+ case 32: goto tr44;
678
+ case 35: goto tr45;
679
+ case 37: goto st31;
680
+ case 63: goto tr47;
681
+ case 127: goto st0;
682
+ }
683
+ if ( 0 <= (*p) && (*p) <= 31 )
684
+ goto st0;
685
+ goto st30;
686
+ st31:
687
+ if ( ++p == pe )
688
+ goto _test_eof31;
689
+ case 31:
690
+ if ( (*p) == 117 )
691
+ goto st33;
692
+ if ( (*p) < 65 ) {
693
+ if ( 48 <= (*p) && (*p) <= 57 )
694
+ goto st32;
695
+ } else if ( (*p) > 70 ) {
696
+ if ( 97 <= (*p) && (*p) <= 102 )
697
+ goto st32;
698
+ } else
699
+ goto st32;
700
+ goto st0;
701
+ st32:
702
+ if ( ++p == pe )
703
+ goto _test_eof32;
704
+ case 32:
705
+ if ( (*p) < 65 ) {
706
+ if ( 48 <= (*p) && (*p) <= 57 )
707
+ goto st30;
708
+ } else if ( (*p) > 70 ) {
709
+ if ( 97 <= (*p) && (*p) <= 102 )
710
+ goto st30;
711
+ } else
712
+ goto st30;
713
+ goto st0;
714
+ st33:
715
+ if ( ++p == pe )
716
+ goto _test_eof33;
717
+ case 33:
718
+ if ( (*p) < 65 ) {
719
+ if ( 48 <= (*p) && (*p) <= 57 )
720
+ goto st32;
721
+ } else if ( (*p) > 70 ) {
722
+ if ( 97 <= (*p) && (*p) <= 102 )
723
+ goto st32;
724
+ } else
725
+ goto st32;
726
+ goto st0;
727
+ tr47:
728
+ #line 65 "parser.rl"
729
+ {
730
+ if (parser->request_path != NULL) {
731
+ parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
732
+ }
733
+ }
734
+ goto st34;
735
+ st34:
736
+ if ( ++p == pe )
737
+ goto _test_eof34;
738
+ case 34:
739
+ #line 740 "parser.c"
740
+ switch( (*p) ) {
741
+ case 32: goto tr51;
742
+ case 35: goto tr52;
743
+ case 37: goto tr53;
744
+ case 127: goto st0;
745
+ }
746
+ if ( 0 <= (*p) && (*p) <= 31 )
747
+ goto st0;
748
+ goto tr50;
749
+ tr50:
750
+ #line 52 "parser.rl"
751
+ {MARK(query_start, p); }
752
+ goto st35;
753
+ st35:
754
+ if ( ++p == pe )
755
+ goto _test_eof35;
756
+ case 35:
757
+ #line 758 "parser.c"
758
+ switch( (*p) ) {
759
+ case 32: goto tr55;
760
+ case 35: goto tr56;
761
+ case 37: goto st36;
762
+ case 127: goto st0;
763
+ }
764
+ if ( 0 <= (*p) && (*p) <= 31 )
765
+ goto st0;
766
+ goto st35;
767
+ tr53:
768
+ #line 52 "parser.rl"
769
+ {MARK(query_start, p); }
770
+ goto st36;
771
+ st36:
772
+ if ( ++p == pe )
773
+ goto _test_eof36;
774
+ case 36:
775
+ #line 776 "parser.c"
776
+ if ( (*p) == 117 )
777
+ goto st38;
778
+ if ( (*p) < 65 ) {
779
+ if ( 48 <= (*p) && (*p) <= 57 )
780
+ goto st37;
781
+ } else if ( (*p) > 70 ) {
782
+ if ( 97 <= (*p) && (*p) <= 102 )
783
+ goto st37;
784
+ } else
785
+ goto st37;
786
+ goto st0;
787
+ st37:
788
+ if ( ++p == pe )
789
+ goto _test_eof37;
790
+ case 37:
791
+ if ( (*p) < 65 ) {
792
+ if ( 48 <= (*p) && (*p) <= 57 )
793
+ goto st35;
794
+ } else if ( (*p) > 70 ) {
795
+ if ( 97 <= (*p) && (*p) <= 102 )
796
+ goto st35;
797
+ } else
798
+ goto st35;
799
+ goto st0;
800
+ st38:
801
+ if ( ++p == pe )
802
+ goto _test_eof38;
803
+ case 38:
804
+ if ( (*p) < 65 ) {
805
+ if ( 48 <= (*p) && (*p) <= 57 )
806
+ goto st37;
807
+ } else if ( (*p) > 70 ) {
808
+ if ( 97 <= (*p) && (*p) <= 102 )
809
+ goto st37;
810
+ } else
811
+ goto st37;
812
+ goto st0;
813
+ st39:
814
+ if ( ++p == pe )
815
+ goto _test_eof39;
816
+ case 39:
817
+ switch( (*p) ) {
818
+ case 32: goto tr2;
819
+ case 36: goto st40;
820
+ case 95: goto st40;
821
+ }
822
+ if ( (*p) < 48 ) {
823
+ if ( 45 <= (*p) && (*p) <= 46 )
824
+ goto st40;
825
+ } else if ( (*p) > 57 ) {
826
+ if ( 65 <= (*p) && (*p) <= 90 )
827
+ goto st40;
828
+ } else
829
+ goto st40;
830
+ goto st0;
831
+ st40:
832
+ if ( ++p == pe )
833
+ goto _test_eof40;
834
+ case 40:
835
+ switch( (*p) ) {
836
+ case 32: goto tr2;
837
+ case 36: goto st41;
838
+ case 95: goto st41;
839
+ }
840
+ if ( (*p) < 48 ) {
841
+ if ( 45 <= (*p) && (*p) <= 46 )
842
+ goto st41;
843
+ } else if ( (*p) > 57 ) {
844
+ if ( 65 <= (*p) && (*p) <= 90 )
845
+ goto st41;
846
+ } else
847
+ goto st41;
848
+ goto st0;
849
+ st41:
850
+ if ( ++p == pe )
851
+ goto _test_eof41;
852
+ case 41:
853
+ switch( (*p) ) {
854
+ case 32: goto tr2;
855
+ case 36: goto st42;
856
+ case 95: goto st42;
857
+ }
858
+ if ( (*p) < 48 ) {
859
+ if ( 45 <= (*p) && (*p) <= 46 )
860
+ goto st42;
861
+ } else if ( (*p) > 57 ) {
862
+ if ( 65 <= (*p) && (*p) <= 90 )
863
+ goto st42;
864
+ } else
865
+ goto st42;
866
+ goto st0;
867
+ st42:
868
+ if ( ++p == pe )
869
+ goto _test_eof42;
870
+ case 42:
871
+ switch( (*p) ) {
872
+ case 32: goto tr2;
873
+ case 36: goto st43;
874
+ case 95: goto st43;
875
+ }
876
+ if ( (*p) < 48 ) {
877
+ if ( 45 <= (*p) && (*p) <= 46 )
878
+ goto st43;
879
+ } else if ( (*p) > 57 ) {
880
+ if ( 65 <= (*p) && (*p) <= 90 )
881
+ goto st43;
882
+ } else
883
+ goto st43;
884
+ goto st0;
885
+ st43:
886
+ if ( ++p == pe )
887
+ goto _test_eof43;
888
+ case 43:
889
+ switch( (*p) ) {
890
+ case 32: goto tr2;
891
+ case 36: goto st44;
892
+ case 95: goto st44;
893
+ }
894
+ if ( (*p) < 48 ) {
895
+ if ( 45 <= (*p) && (*p) <= 46 )
896
+ goto st44;
897
+ } else if ( (*p) > 57 ) {
898
+ if ( 65 <= (*p) && (*p) <= 90 )
899
+ goto st44;
900
+ } else
901
+ goto st44;
902
+ goto st0;
903
+ st44:
904
+ if ( ++p == pe )
905
+ goto _test_eof44;
906
+ case 44:
907
+ switch( (*p) ) {
908
+ case 32: goto tr2;
909
+ case 36: goto st45;
910
+ case 95: goto st45;
911
+ }
912
+ if ( (*p) < 48 ) {
913
+ if ( 45 <= (*p) && (*p) <= 46 )
914
+ goto st45;
915
+ } else if ( (*p) > 57 ) {
916
+ if ( 65 <= (*p) && (*p) <= 90 )
917
+ goto st45;
918
+ } else
919
+ goto st45;
920
+ goto st0;
921
+ st45:
922
+ if ( ++p == pe )
923
+ goto _test_eof45;
924
+ case 45:
925
+ switch( (*p) ) {
926
+ case 32: goto tr2;
927
+ case 36: goto st46;
928
+ case 95: goto st46;
929
+ }
930
+ if ( (*p) < 48 ) {
931
+ if ( 45 <= (*p) && (*p) <= 46 )
932
+ goto st46;
933
+ } else if ( (*p) > 57 ) {
934
+ if ( 65 <= (*p) && (*p) <= 90 )
935
+ goto st46;
936
+ } else
937
+ goto st46;
938
+ goto st0;
939
+ st46:
940
+ if ( ++p == pe )
941
+ goto _test_eof46;
942
+ case 46:
943
+ switch( (*p) ) {
944
+ case 32: goto tr2;
945
+ case 36: goto st47;
946
+ case 95: goto st47;
947
+ }
948
+ if ( (*p) < 48 ) {
949
+ if ( 45 <= (*p) && (*p) <= 46 )
950
+ goto st47;
951
+ } else if ( (*p) > 57 ) {
952
+ if ( 65 <= (*p) && (*p) <= 90 )
953
+ goto st47;
954
+ } else
955
+ goto st47;
956
+ goto st0;
957
+ st47:
958
+ if ( ++p == pe )
959
+ goto _test_eof47;
960
+ case 47:
961
+ switch( (*p) ) {
962
+ case 32: goto tr2;
963
+ case 36: goto st48;
964
+ case 95: goto st48;
965
+ }
966
+ if ( (*p) < 48 ) {
967
+ if ( 45 <= (*p) && (*p) <= 46 )
968
+ goto st48;
969
+ } else if ( (*p) > 57 ) {
970
+ if ( 65 <= (*p) && (*p) <= 90 )
971
+ goto st48;
972
+ } else
973
+ goto st48;
974
+ goto st0;
975
+ st48:
976
+ if ( ++p == pe )
977
+ goto _test_eof48;
978
+ case 48:
979
+ switch( (*p) ) {
980
+ case 32: goto tr2;
981
+ case 36: goto st49;
982
+ case 95: goto st49;
983
+ }
984
+ if ( (*p) < 48 ) {
985
+ if ( 45 <= (*p) && (*p) <= 46 )
986
+ goto st49;
987
+ } else if ( (*p) > 57 ) {
988
+ if ( 65 <= (*p) && (*p) <= 90 )
989
+ goto st49;
990
+ } else
991
+ goto st49;
992
+ goto st0;
993
+ st49:
994
+ if ( ++p == pe )
995
+ goto _test_eof49;
996
+ case 49:
997
+ switch( (*p) ) {
998
+ case 32: goto tr2;
999
+ case 36: goto st50;
1000
+ case 95: goto st50;
1001
+ }
1002
+ if ( (*p) < 48 ) {
1003
+ if ( 45 <= (*p) && (*p) <= 46 )
1004
+ goto st50;
1005
+ } else if ( (*p) > 57 ) {
1006
+ if ( 65 <= (*p) && (*p) <= 90 )
1007
+ goto st50;
1008
+ } else
1009
+ goto st50;
1010
+ goto st0;
1011
+ st50:
1012
+ if ( ++p == pe )
1013
+ goto _test_eof50;
1014
+ case 50:
1015
+ switch( (*p) ) {
1016
+ case 32: goto tr2;
1017
+ case 36: goto st51;
1018
+ case 95: goto st51;
1019
+ }
1020
+ if ( (*p) < 48 ) {
1021
+ if ( 45 <= (*p) && (*p) <= 46 )
1022
+ goto st51;
1023
+ } else if ( (*p) > 57 ) {
1024
+ if ( 65 <= (*p) && (*p) <= 90 )
1025
+ goto st51;
1026
+ } else
1027
+ goto st51;
1028
+ goto st0;
1029
+ st51:
1030
+ if ( ++p == pe )
1031
+ goto _test_eof51;
1032
+ case 51:
1033
+ switch( (*p) ) {
1034
+ case 32: goto tr2;
1035
+ case 36: goto st52;
1036
+ case 95: goto st52;
1037
+ }
1038
+ if ( (*p) < 48 ) {
1039
+ if ( 45 <= (*p) && (*p) <= 46 )
1040
+ goto st52;
1041
+ } else if ( (*p) > 57 ) {
1042
+ if ( 65 <= (*p) && (*p) <= 90 )
1043
+ goto st52;
1044
+ } else
1045
+ goto st52;
1046
+ goto st0;
1047
+ st52:
1048
+ if ( ++p == pe )
1049
+ goto _test_eof52;
1050
+ case 52:
1051
+ switch( (*p) ) {
1052
+ case 32: goto tr2;
1053
+ case 36: goto st53;
1054
+ case 95: goto st53;
1055
+ }
1056
+ if ( (*p) < 48 ) {
1057
+ if ( 45 <= (*p) && (*p) <= 46 )
1058
+ goto st53;
1059
+ } else if ( (*p) > 57 ) {
1060
+ if ( 65 <= (*p) && (*p) <= 90 )
1061
+ goto st53;
1062
+ } else
1063
+ goto st53;
1064
+ goto st0;
1065
+ st53:
1066
+ if ( ++p == pe )
1067
+ goto _test_eof53;
1068
+ case 53:
1069
+ switch( (*p) ) {
1070
+ case 32: goto tr2;
1071
+ case 36: goto st54;
1072
+ case 95: goto st54;
1073
+ }
1074
+ if ( (*p) < 48 ) {
1075
+ if ( 45 <= (*p) && (*p) <= 46 )
1076
+ goto st54;
1077
+ } else if ( (*p) > 57 ) {
1078
+ if ( 65 <= (*p) && (*p) <= 90 )
1079
+ goto st54;
1080
+ } else
1081
+ goto st54;
1082
+ goto st0;
1083
+ st54:
1084
+ if ( ++p == pe )
1085
+ goto _test_eof54;
1086
+ case 54:
1087
+ switch( (*p) ) {
1088
+ case 32: goto tr2;
1089
+ case 36: goto st55;
1090
+ case 95: goto st55;
1091
+ }
1092
+ if ( (*p) < 48 ) {
1093
+ if ( 45 <= (*p) && (*p) <= 46 )
1094
+ goto st55;
1095
+ } else if ( (*p) > 57 ) {
1096
+ if ( 65 <= (*p) && (*p) <= 90 )
1097
+ goto st55;
1098
+ } else
1099
+ goto st55;
1100
+ goto st0;
1101
+ st55:
1102
+ if ( ++p == pe )
1103
+ goto _test_eof55;
1104
+ case 55:
1105
+ switch( (*p) ) {
1106
+ case 32: goto tr2;
1107
+ case 36: goto st56;
1108
+ case 95: goto st56;
1109
+ }
1110
+ if ( (*p) < 48 ) {
1111
+ if ( 45 <= (*p) && (*p) <= 46 )
1112
+ goto st56;
1113
+ } else if ( (*p) > 57 ) {
1114
+ if ( 65 <= (*p) && (*p) <= 90 )
1115
+ goto st56;
1116
+ } else
1117
+ goto st56;
1118
+ goto st0;
1119
+ st56:
1120
+ if ( ++p == pe )
1121
+ goto _test_eof56;
1122
+ case 56:
1123
+ switch( (*p) ) {
1124
+ case 32: goto tr2;
1125
+ case 36: goto st57;
1126
+ case 95: goto st57;
1127
+ }
1128
+ if ( (*p) < 48 ) {
1129
+ if ( 45 <= (*p) && (*p) <= 46 )
1130
+ goto st57;
1131
+ } else if ( (*p) > 57 ) {
1132
+ if ( 65 <= (*p) && (*p) <= 90 )
1133
+ goto st57;
1134
+ } else
1135
+ goto st57;
1136
+ goto st0;
1137
+ st57:
1138
+ if ( ++p == pe )
1139
+ goto _test_eof57;
1140
+ case 57:
1141
+ if ( (*p) == 32 )
1142
+ goto tr2;
1143
+ goto st0;
1144
+ }
1145
+ _test_eof2: cs = 2; goto _test_eof;
1146
+ _test_eof3: cs = 3; goto _test_eof;
1147
+ _test_eof4: cs = 4; goto _test_eof;
1148
+ _test_eof5: cs = 5; goto _test_eof;
1149
+ _test_eof6: cs = 6; goto _test_eof;
1150
+ _test_eof7: cs = 7; goto _test_eof;
1151
+ _test_eof8: cs = 8; goto _test_eof;
1152
+ _test_eof9: cs = 9; goto _test_eof;
1153
+ _test_eof10: cs = 10; goto _test_eof;
1154
+ _test_eof11: cs = 11; goto _test_eof;
1155
+ _test_eof12: cs = 12; goto _test_eof;
1156
+ _test_eof13: cs = 13; goto _test_eof;
1157
+ _test_eof14: cs = 14; goto _test_eof;
1158
+ _test_eof15: cs = 15; goto _test_eof;
1159
+ _test_eof16: cs = 16; goto _test_eof;
1160
+ _test_eof58: cs = 58; goto _test_eof;
1161
+ _test_eof17: cs = 17; goto _test_eof;
1162
+ _test_eof18: cs = 18; goto _test_eof;
1163
+ _test_eof19: cs = 19; goto _test_eof;
1164
+ _test_eof20: cs = 20; goto _test_eof;
1165
+ _test_eof21: cs = 21; goto _test_eof;
1166
+ _test_eof22: cs = 22; goto _test_eof;
1167
+ _test_eof23: cs = 23; goto _test_eof;
1168
+ _test_eof24: cs = 24; goto _test_eof;
1169
+ _test_eof25: cs = 25; goto _test_eof;
1170
+ _test_eof26: cs = 26; goto _test_eof;
1171
+ _test_eof27: cs = 27; goto _test_eof;
1172
+ _test_eof28: cs = 28; goto _test_eof;
1173
+ _test_eof29: cs = 29; goto _test_eof;
1174
+ _test_eof30: cs = 30; goto _test_eof;
1175
+ _test_eof31: cs = 31; goto _test_eof;
1176
+ _test_eof32: cs = 32; goto _test_eof;
1177
+ _test_eof33: cs = 33; goto _test_eof;
1178
+ _test_eof34: cs = 34; goto _test_eof;
1179
+ _test_eof35: cs = 35; goto _test_eof;
1180
+ _test_eof36: cs = 36; goto _test_eof;
1181
+ _test_eof37: cs = 37; goto _test_eof;
1182
+ _test_eof38: cs = 38; goto _test_eof;
1183
+ _test_eof39: cs = 39; goto _test_eof;
1184
+ _test_eof40: cs = 40; goto _test_eof;
1185
+ _test_eof41: cs = 41; goto _test_eof;
1186
+ _test_eof42: cs = 42; goto _test_eof;
1187
+ _test_eof43: cs = 43; goto _test_eof;
1188
+ _test_eof44: cs = 44; goto _test_eof;
1189
+ _test_eof45: cs = 45; goto _test_eof;
1190
+ _test_eof46: cs = 46; goto _test_eof;
1191
+ _test_eof47: cs = 47; goto _test_eof;
1192
+ _test_eof48: cs = 48; goto _test_eof;
1193
+ _test_eof49: cs = 49; goto _test_eof;
1194
+ _test_eof50: cs = 50; goto _test_eof;
1195
+ _test_eof51: cs = 51; goto _test_eof;
1196
+ _test_eof52: cs = 52; goto _test_eof;
1197
+ _test_eof53: cs = 53; goto _test_eof;
1198
+ _test_eof54: cs = 54; goto _test_eof;
1199
+ _test_eof55: cs = 55; goto _test_eof;
1200
+ _test_eof56: cs = 56; goto _test_eof;
1201
+ _test_eof57: cs = 57; goto _test_eof;
1202
+
1203
+ _test_eof: {}
1204
+ _out: {}
1205
+ }
1206
+
1207
+ #line 116 "parser.rl"
1208
+
1209
+ parser->cs = cs;
1210
+ parser->nread += p - (buffer + off);
1211
+
1212
+ assert(p <= pe && "buffer overflow after parsing execute");
1213
+ assert(parser->nread <= len && "nread longer than length");
1214
+ assert(parser->body_start <= len && "body starts after buffer end");
1215
+ assert(parser->mark < len && "mark is after buffer end");
1216
+ assert(parser->field_len <= len && "field has length longer than whole buffer");
1217
+ assert(parser->field_start < len && "field starts after buffer end");
1218
+
1219
+ if(parser->body_start) {
1220
+ /* final \r\n combo encountered so stop right here */
1221
+ parser->nread++;
1222
+ }
1223
+
1224
+ return(parser->nread);
1225
+ }
1226
+
1227
+ int thin_http_parser_finish(http_parser *parser)
1228
+ {
1229
+ int cs = parser->cs;
1230
+
1231
+
1232
+ parser->cs = cs;
1233
+
1234
+ if (thin_http_parser_has_error(parser) ) {
1235
+ return -1;
1236
+ } else if (thin_http_parser_is_finished(parser) ) {
1237
+ return 1;
1238
+ } else {
1239
+ return 0;
1240
+ }
1241
+ }
1242
+
1243
+ int thin_http_parser_has_error(http_parser *parser) {
1244
+ return parser->cs == http_parser_error;
1245
+ }
1246
+
1247
+ int thin_http_parser_is_finished(http_parser *parser) {
1248
+ return parser->cs == http_parser_first_final;
1249
+ }