ebb 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/src/ebb.h CHANGED
@@ -13,9 +13,9 @@
13
13
 
14
14
  typedef struct ebb_server ebb_server;
15
15
  typedef struct ebb_client ebb_client;
16
- #define EBB_VERSION "0.1.0"
16
+ #define EBB_VERSION "0.2.0"
17
17
  #define EBB_BUFFERSIZE (1024 * (80 + 33))
18
- #define EBB_MAX_CLIENTS 200
18
+ #define EBB_MAX_CLIENTS 1024
19
19
  #define EBB_TIMEOUT 30.0
20
20
  #define EBB_MAX_ENV 500
21
21
  #define EBB_TCP_COMMON \
@@ -28,31 +28,22 @@ void ebb_client_close(ebb_client*);
28
28
  /* user MUST call this function on each client passed by the request_cb */
29
29
  void ebb_client_release(ebb_client*);
30
30
  int ebb_client_read(ebb_client *client, char *buffer, int length);
31
- void ebb_client_write_status(ebb_client*, int status, const char *human_status);
31
+ void ebb_client_write_status(ebb_client*, int status, const char *reason_phrase);
32
32
  void ebb_client_write_header(ebb_client*, const char *field, const char *value);
33
- void ebb_client_write(ebb_client*, const char *data, int length);
34
- void ebb_client_begin_transmission( ebb_client *client);
33
+ void ebb_client_write_body(ebb_client*, const char *data, int length);
34
+ /* int ebb_client_should_keep_alive(ebb_client*); */
35
35
 
36
36
  struct ebb_env_item {
37
- enum { EBB_FIELD_VALUE_PAIR
38
- , EBB_REQUEST_METHOD
39
- , EBB_REQUEST_URI
40
- , EBB_FRAGMENT
41
- , EBB_REQUEST_PATH
42
- , EBB_QUERY_STRING
43
- , EBB_HTTP_VERSION
44
- , EBB_SERVER_PORT
45
- , EBB_CONTENT_LENGTH
46
- } type;
47
- const char *field;
48
- int field_length;
49
- const char *value;
50
- int value_length;
37
+ int type;
38
+ const char *field;
39
+ int field_length;
40
+ const char *value;
41
+ int value_length;
51
42
  };
52
43
 
53
44
  struct ebb_client {
54
45
  EBB_TCP_COMMON
55
-
46
+ char *ip;
56
47
  unsigned int in_use : 1;
57
48
 
58
49
  ebb_server *server;
@@ -60,23 +51,20 @@ struct ebb_client {
60
51
 
61
52
  char *request_buffer;
62
53
  ev_io read_watcher;
63
- size_t read, nread_from_body;
64
-
65
- char upload_file_filename[200];
66
- FILE *upload_file;
54
+ size_t read;
67
55
 
68
- int content_length;
56
+ char *body_head;
57
+ size_t body_head_len;
69
58
 
70
59
  ev_io write_watcher;
71
60
  GString *response_buffer;
72
61
  size_t written;
73
62
 
74
63
  ev_timer timeout_watcher;
75
-
64
+ unsigned int keep_alive : 1;
76
65
  unsigned int status_written : 1;
77
66
  unsigned int headers_written : 1;
78
67
  unsigned int body_written : 1;
79
- unsigned int began_transmission : 1;
80
68
 
81
69
  /* the ENV structure */
82
70
  int env_size;
@@ -94,9 +82,11 @@ void ebb_server_init( ebb_server *server
94
82
  , ebb_request_cb request_cb
95
83
  , void *request_cb_data
96
84
  );
85
+ int ebb_server_listen_on_fd(ebb_server*, const int sfd);
97
86
  int ebb_server_listen_on_port(ebb_server*, const int port);
98
- int ebb_server_listen_on_socket(ebb_server*, const char *socketpath);
87
+ int ebb_server_listen_on_unix_socket(ebb_server*, const char *socketpath);
99
88
  void ebb_server_unlisten(ebb_server*);
89
+ int ebb_server_clients_in_use_p(ebb_server*);
100
90
 
101
91
  struct ebb_server {
102
92
  EBB_TCP_COMMON
@@ -109,4 +99,4 @@ struct ebb_server {
109
99
  ebb_request_cb request_cb;
110
100
  };
111
101
 
112
- #endif
102
+ #endif
data/src/ebb_ruby.c CHANGED
@@ -11,18 +11,22 @@
11
11
  #include <ev.h>
12
12
 
13
13
  static VALUE cClient;
14
- static VALUE global_http_prefix;
15
- static VALUE global_request_method;
16
- static VALUE global_request_uri;
14
+ static VALUE waiting_clients;
15
+
17
16
  static VALUE global_fragment;
18
- static VALUE global_request_path;
17
+ static VALUE global_path_info;
19
18
  static VALUE global_query_string;
20
- static VALUE global_http_version;
21
19
  static VALUE global_request_body;
20
+ static VALUE global_request_method;
21
+ static VALUE global_request_path;
22
+ static VALUE global_request_uri;
22
23
  static VALUE global_server_port;
23
- static VALUE global_path_info;
24
24
  static VALUE global_content_length;
25
- static VALUE global_http_host;
25
+ static VALUE global_content_type;
26
+ static VALUE global_http_client_ip;
27
+ static VALUE global_http_prefix;
28
+ static VALUE global_http_version;
29
+
26
30
 
27
31
  /* You don't want to run more than one server per Ruby VM. Really
28
32
  * I'm making this explicit by not defining a Ebb::Server class but instead
@@ -53,22 +57,27 @@ static void detach_idle_watcher()
53
57
  ev_idle_stop(loop, &idle_watcher);
54
58
  }
55
59
 
56
- static int clients_in_use_p()
57
- {
58
- int i;
59
- for(i = 0; i < EBB_MAX_CLIENTS; i++)
60
- if(server->clients[i].in_use) return TRUE;
61
- return FALSE;
62
- }
63
60
 
64
61
  void request_cb(ebb_client *client, void *data)
65
62
  {
66
- VALUE waiting_clients = (VALUE)data;
67
63
  VALUE rb_client = Data_Wrap_Struct(cClient, 0, 0, client);
64
+
65
+ rb_iv_set(rb_client, "@fd", INT2FIX(client->fd));
66
+ rb_iv_set(rb_client, "@content_length", INT2FIX(client->parser.content_length));
67
+ if(client->body_head_len > 0)
68
+ rb_iv_set(rb_client, "@body_head", rb_str_new(client->body_head, client->body_head_len));
69
+
68
70
  rb_ary_push(waiting_clients, rb_client);
69
71
  attach_idle_watcher();
70
72
  }
71
73
 
74
+ VALUE server_listen_on_fd(VALUE _, VALUE sfd)
75
+ {
76
+ if(ebb_server_listen_on_fd(server, FIX2INT(sfd)) < 0)
77
+ rb_sys_fail("Problem listening on FD");
78
+ return Qnil;
79
+ }
80
+
72
81
  VALUE server_listen_on_port(VALUE _, VALUE port)
73
82
  {
74
83
  if(ebb_server_listen_on_port(server, FIX2INT(port)) < 0)
@@ -76,22 +85,49 @@ VALUE server_listen_on_port(VALUE _, VALUE port)
76
85
  return Qnil;
77
86
  }
78
87
 
88
+ VALUE server_listen_on_unix_socket(VALUE _, VALUE socketfile)
89
+ {
90
+ if(ebb_server_listen_on_unix_socket(server, StringValuePtr(socketfile)) < 0)
91
+ rb_sys_fail("Problem listening on unix socket");
92
+ return Qnil;
93
+ }
94
+
95
+
96
+ static struct timeval idle_timeout = { tv_sec: 0, tv_usec: 50000 };
97
+
79
98
  static void
80
99
  idle_cb (struct ev_loop *loop, struct ev_idle *w, int revents) {
81
- if(clients_in_use_p()) {
100
+ /* How to let other Ruby threads run while we're in this blocking C call */
101
+
102
+ /* TODO: For Ruby 1.9 I should use rb_thread_blocking_region() instead of
103
+ * this hacky idle_cb
104
+ */
105
+
106
+ if(ebb_server_clients_in_use_p(server)) {
107
+ /* If ruby has control of any clients - that means there are some requests
108
+ * still being processed inside of threads. We need to allow Ruby some
109
+ * time to work on these threads so we call rb_thread_schedule()
110
+ * I don't use rb_thread_select() here because it is very slow.
111
+ */
82
112
  rb_thread_schedule();
113
+
83
114
  } else if(!rb_thread_alone()) {
84
- /* if you have another long running thread running besides the ones used
85
- * for the webapp's requests you will run into performance problems in
86
- * ruby 1.8.x because rb_thread_select is slow.
87
- * (Don't worry - you're probably not doing this.)
115
+ /* If no clients are in use, but there are still other Ruby threads then
116
+ * some other thread is running in the Ruby VM which is not a request.
117
+ * This is a sub-optimal situation and we solve it by calling
118
+ * rb_thread_select() to wait for the server fd to wake up.
119
+ * One should try to avoid entering this state.
88
120
  */
89
- struct timeval select_timeout = { tv_sec: 0, tv_usec: 50000 };
90
121
  fd_set server_fd_set;
91
122
  FD_ZERO(&server_fd_set);
92
123
  FD_SET(server->fd, &server_fd_set);
93
- rb_thread_select(server->fd+1, &server_fd_set, 0, 0, &select_timeout);
124
+ rb_thread_select(server->fd+1, &server_fd_set, 0, 0, &idle_timeout);
94
125
  } else {
126
+ /* Otherwise there are no other threads. We can detach the idle_watcher
127
+ * and allow the server_process_connections() to block until the
128
+ * server fd wakes up. Because we don't use rb_thread_select() this
129
+ * is quite fast.
130
+ */
95
131
  detach_idle_watcher();
96
132
  }
97
133
  }
@@ -116,31 +152,37 @@ VALUE server_open(VALUE _)
116
152
  return server->open ? Qtrue : Qfalse;
117
153
  }
118
154
 
155
+ VALUE server_waiting_clients(VALUE _)
156
+ {
157
+ return waiting_clients;
158
+ }
159
+
119
160
  VALUE env_field(struct ebb_env_item *item)
120
161
  {
121
- VALUE f;
162
+ if(item->field) {
163
+ VALUE f = rb_str_new(NULL, RSTRING_LEN(global_http_prefix) + item->field_length);
164
+ memcpy( RSTRING_PTR(f)
165
+ , RSTRING_PTR(global_http_prefix)
166
+ , RSTRING_LEN(global_http_prefix)
167
+ );
168
+ int i;
169
+ for(i = 0; i < item->field_length; i++) {
170
+ char *ch = RSTRING_PTR(f) + RSTRING_LEN(global_http_prefix) + i;
171
+ *ch = item->field[i] == '-' ? '_' : ASCII_UPPER(item->field[i]);
172
+ }
173
+ return f;
174
+ }
122
175
  switch(item->type) {
123
- case EBB_FIELD_VALUE_PAIR:
124
- f = rb_str_new(NULL, RSTRING_LEN(global_http_prefix) + item->field_length);
125
- memcpy( RSTRING_PTR(f)
126
- , RSTRING_PTR(global_http_prefix)
127
- , RSTRING_LEN(global_http_prefix)
128
- );
129
- int i;
130
- for(i = 0; i < item->field_length; i++) {
131
- char *ch = RSTRING_PTR(f) + RSTRING_LEN(global_http_prefix) + i;
132
- *ch = item->field[i] == '-' ? '_' : ASCII_UPPER(item->field[i]);
133
- }
134
- return f;
135
- case EBB_REQUEST_METHOD: return global_request_method;
136
- case EBB_REQUEST_URI: return global_request_uri;
137
- case EBB_FRAGMENT: return global_fragment;
138
- case EBB_REQUEST_PATH: return global_request_path;
139
- case EBB_QUERY_STRING: return global_query_string;
140
- case EBB_HTTP_VERSION: return global_http_version;
141
- case EBB_SERVER_PORT: return global_server_port;
142
- case EBB_CONTENT_LENGTH: return global_content_length;
176
+ case MONGREL_CONTENT_LENGTH: return global_content_length;
177
+ case MONGREL_CONTENT_TYPE: return global_content_type;
178
+ case MONGREL_FRAGMENT: return global_fragment;
179
+ case MONGREL_HTTP_VERSION: return global_http_version;
180
+ case MONGREL_QUERY_STRING: return global_query_string;
181
+ case MONGREL_REQUEST_METHOD: return global_request_method;
182
+ case MONGREL_REQUEST_PATH: return global_request_path;
183
+ case MONGREL_REQUEST_URI: return global_request_uri;
143
184
  }
185
+ fprintf(stderr, "Unknown environ type: %d", item->type);
144
186
  assert(FALSE);
145
187
  return Qnil;
146
188
  }
@@ -158,50 +200,31 @@ VALUE env_value(struct ebb_env_item *item)
158
200
  VALUE client_env(VALUE _, VALUE rb_client)
159
201
  {
160
202
  ebb_client *client;
161
- VALUE field, value, hash = rb_hash_new();
203
+ VALUE field, value, env = rb_hash_new();
162
204
  int i;
163
205
 
164
206
  Data_Get_Struct(rb_client, ebb_client, client);
165
207
  for(i=0; i < client->env_size; i++) {
166
208
  field = env_field(&client->env[i]);
167
209
  value = env_value(&client->env[i]);
168
- rb_hash_aset(hash, field, value);
169
- //printf("(%s, %s)\n", StringValuePtr(field), StringValuePtr(value));
210
+ rb_hash_aset(env, field, value);
170
211
  }
171
- //printf("\n\n");
172
- rb_hash_aset(hash, global_path_info, rb_hash_aref(hash, global_request_path));
173
- return hash;
174
- }
175
-
176
-
177
- VALUE client_read_input(VALUE _, VALUE client, VALUE size)
178
- {
179
- ebb_client *_client;
180
- GString *_string;
181
- VALUE string;
182
- int _size = FIX2INT(size);
183
- Data_Get_Struct(client, ebb_client, _client);
184
212
 
185
- string = rb_str_buf_new( _size );
186
- int nread = ebb_client_read(_client, RSTRING_PTR(string), _size);
187
- #if RUBY_VERSION_CODE < 190
188
- RSTRING(string)->len = nread;
189
- #else
190
- rb_str_set_len(string, nread);
191
- #endif
213
+ if(client->server->port)
214
+ rb_hash_aset(env, global_server_port, rb_str_new2(client->server->port));
192
215
 
193
- if(nread < 0)
194
- rb_raise(rb_eRuntimeError,"There was a problem reading from input (bad tmp file?)");
195
- if(nread == 0)
196
- return Qnil;
197
- return string;
216
+ if(client->ip)
217
+ rb_hash_aset(env, global_http_client_ip, rb_str_new2(client->ip));
218
+
219
+ rb_hash_aset(env, global_path_info, rb_hash_aref(env, global_request_path));
220
+ return env;
198
221
  }
199
222
 
200
- VALUE client_write_status(VALUE _, VALUE client, VALUE status, VALUE human_status)
223
+ VALUE client_write_status(VALUE _, VALUE client, VALUE status, VALUE reason_phrase)
201
224
  {
202
225
  ebb_client *_client;
203
226
  Data_Get_Struct(client, ebb_client, _client);
204
- ebb_client_write_status(_client, FIX2INT(status), StringValuePtr(human_status));
227
+ ebb_client_write_status(_client, FIX2INT(status), StringValuePtr(reason_phrase));
205
228
  return Qnil;
206
229
  }
207
230
 
@@ -213,25 +236,15 @@ VALUE client_write_header(VALUE _, VALUE client, VALUE field, VALUE value)
213
236
  return Qnil;
214
237
  }
215
238
 
216
- VALUE client_write(VALUE _, VALUE client, VALUE string)
239
+ VALUE client_write_body(VALUE _, VALUE client, VALUE string)
217
240
  {
218
241
  ebb_client *_client;
219
242
  Data_Get_Struct(client, ebb_client, _client);
220
- ebb_client_write(_client, RSTRING_PTR(string), RSTRING_LEN(string));
243
+ ebb_client_write_body(_client, RSTRING_PTR(string), RSTRING_LEN(string));
221
244
  return Qnil;
222
245
  }
223
246
 
224
247
 
225
- VALUE client_begin_transmission(VALUE _, VALUE rb_client)
226
- {
227
- ebb_client *client;
228
- Data_Get_Struct(rb_client, ebb_client, client);
229
- client->status_written = TRUE;
230
- client->headers_written = TRUE;
231
- ebb_client_begin_transmission(client);
232
- return Qnil;
233
- }
234
-
235
248
  VALUE client_release(VALUE _, VALUE rb_client)
236
249
  {
237
250
  ebb_client *client;
@@ -240,49 +253,41 @@ VALUE client_release(VALUE _, VALUE rb_client)
240
253
  return Qnil;
241
254
  }
242
255
 
243
-
244
- VALUE client_set_body_written(VALUE _, VALUE rb_client, VALUE v)
245
- {
246
- ebb_client *client;
247
- Data_Get_Struct(rb_client, ebb_client, client);
248
- client->body_written = RTEST(v);
249
- return client->body_written ? Qtrue : Qfalse;
250
- }
251
-
252
256
  void Init_ebb_ext()
253
257
  {
254
258
  VALUE mEbb = rb_define_module("Ebb");
255
259
  VALUE mFFI = rb_define_module_under(mEbb, "FFI");
256
260
 
257
- rb_define_const(mEbb, "VERSION", rb_str_new2(EBB_VERSION));
261
+ rb_define_const(mFFI, "VERSION", rb_str_new2(EBB_VERSION));
258
262
 
259
263
  /** Defines global strings in the init method. */
260
264
  #define DEF_GLOBAL(N, val) global_##N = rb_obj_freeze(rb_str_new2(val)); rb_global_variable(&global_##N)
261
- DEF_GLOBAL(http_prefix, "HTTP_");
262
- DEF_GLOBAL(request_method, "REQUEST_METHOD");
263
- DEF_GLOBAL(request_uri, "REQUEST_URI");
265
+ DEF_GLOBAL(content_length, "CONTENT_LENGTH");
266
+ DEF_GLOBAL(content_type, "CONTENT_TYPE");
264
267
  DEF_GLOBAL(fragment, "FRAGMENT");
265
- DEF_GLOBAL(request_path, "REQUEST_PATH");
268
+ DEF_GLOBAL(path_info, "PATH_INFO");
266
269
  DEF_GLOBAL(query_string, "QUERY_STRING");
267
- DEF_GLOBAL(http_version, "HTTP_VERSION");
268
270
  DEF_GLOBAL(request_body, "REQUEST_BODY");
271
+ DEF_GLOBAL(request_method, "REQUEST_METHOD");
272
+ DEF_GLOBAL(request_path, "REQUEST_PATH");
273
+ DEF_GLOBAL(request_uri, "REQUEST_URI");
269
274
  DEF_GLOBAL(server_port, "SERVER_PORT");
270
- DEF_GLOBAL(path_info, "PATH_INFO");
271
- DEF_GLOBAL(content_length, "CONTENT_LENGTH");
272
- DEF_GLOBAL(http_host, "HTTP_HOST");
275
+ DEF_GLOBAL(http_client_ip, "HTTP_CLIENT_IP");
276
+ DEF_GLOBAL(http_prefix, "HTTP_");
277
+ DEF_GLOBAL(http_version, "HTTP_VERSION");
273
278
 
274
279
  rb_define_singleton_method(mFFI, "server_process_connections", server_process_connections, 0);
280
+ rb_define_singleton_method(mFFI, "server_listen_on_fd", server_listen_on_fd, 1);
275
281
  rb_define_singleton_method(mFFI, "server_listen_on_port", server_listen_on_port, 1);
282
+ rb_define_singleton_method(mFFI, "server_listen_on_unix_socket", server_listen_on_unix_socket, 1);
276
283
  rb_define_singleton_method(mFFI, "server_unlisten", server_unlisten, 0);
277
284
  rb_define_singleton_method(mFFI, "server_open?", server_open, 0);
285
+ rb_define_singleton_method(mFFI, "server_waiting_clients", server_waiting_clients, 0);
278
286
 
279
287
  cClient = rb_define_class_under(mEbb, "Client", rb_cObject);
280
- rb_define_singleton_method(mFFI, "client_read_input", client_read_input, 2);
281
288
  rb_define_singleton_method(mFFI, "client_write_status", client_write_status, 3);
282
289
  rb_define_singleton_method(mFFI, "client_write_header", client_write_header, 3);
283
- rb_define_singleton_method(mFFI, "client_write", client_write, 2);
284
- rb_define_singleton_method(mFFI, "client_begin_transmission", client_begin_transmission, 1);
285
- rb_define_singleton_method(mFFI, "client_set_body_written", client_set_body_written, 2);
290
+ rb_define_singleton_method(mFFI, "client_write_body", client_write_body, 2);
286
291
  rb_define_singleton_method(mFFI, "client_env", client_env, 1);
287
292
  rb_define_singleton_method(mFFI, "client_release", client_release, 1);
288
293
 
@@ -293,7 +298,7 @@ void Init_ebb_ext()
293
298
  attach_idle_watcher();
294
299
 
295
300
  server = ebb_server_alloc();
296
- VALUE waiting_clients = rb_ary_new();
301
+ waiting_clients = rb_ary_new();
297
302
  rb_iv_set(mFFI, "@waiting_clients", waiting_clients);
298
303
  ebb_server_init(server, loop, request_cb, (void*)waiting_clients);
299
304
  }
data/src/extconf.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'mkmf'
2
2
 
3
-
4
3
  unless pkg_config('glib-2.0')
5
4
  abort "Ebb requires glib-2.0 and pkg_config"
6
5
  end
data/src/parser.c CHANGED
@@ -15,47 +15,61 @@
15
15
  #define LEN(AT, FPC) (FPC - buffer - parser->AT)
16
16
  #define MARK(M,FPC) (parser->M = (FPC) - buffer)
17
17
  #define PTR_TO(F) (buffer + parser->F)
18
-
19
18
  /** machine **/
20
- #line 159 "src/parser.rl"
19
+ #line 139 "src/parser.rl"
21
20
 
22
21
 
23
22
  /** Data **/
24
23
 
25
- #line 26 "src/parser.c"
24
+ #line 25 "src/parser.c"
26
25
  static const int http_parser_start = 1;
27
- static const int http_parser_first_final = 73;
26
+ static const int http_parser_first_final = 118;
28
27
  static const int http_parser_error = 0;
29
28
 
30
29
  static const int http_parser_en_main = 1;
31
30
 
32
- #line 163 "src/parser.rl"
31
+ #line 143 "src/parser.rl"
32
+
33
+ /* returns TRUE if applied, FALSE if there was an error */
34
+ static int apply_element(http_parser *parser, int type, const char *begin, const char *end, int max_length)
35
+ {
36
+ int len = (int)(end-begin);
37
+ if(len > max_length) {
38
+ parser->overflow_error = TRUE;
39
+ return FALSE;
40
+ }
41
+ if(parser->on_element)
42
+ parser->on_element(parser->data, type, begin, len);
43
+ return TRUE;
44
+ }
45
+
46
+ static void set_content_length(http_parser *parser, const char *at, int length)
47
+ {
48
+ /* atoi_length - why isn't this in the statndard library? i hate c */
49
+ assert(parser->content_length == 0);
50
+ int i, mult;
51
+ for(mult=1, i=length-1; i>=0; i--, mult*=10)
52
+ parser->content_length += (at[i] - '0') * mult;
53
+ }
33
54
 
34
55
  void http_parser_init(http_parser *parser) {
35
56
  int cs = 0;
36
57
 
37
- #line 38 "src/parser.c"
58
+ #line 59 "src/parser.c"
38
59
  {
39
60
  cs = http_parser_start;
40
61
  }
41
- #line 167 "src/parser.rl"
62
+ #line 169 "src/parser.rl"
42
63
  parser->cs = cs;
43
64
  parser->overflow_error = FALSE;
44
65
  parser->body_start = 0;
45
- parser->content_len = 0;
66
+ parser->content_length = 0;
46
67
  parser->mark = 0;
47
68
  parser->nread = 0;
48
69
  parser->field_len = 0;
49
70
  parser->field_start = 0;
50
71
  parser->data = NULL;
51
72
  parser->http_field = NULL;
52
- parser->request_method = NULL;
53
- parser->request_uri = NULL;
54
- parser->fragment = NULL;
55
- parser->request_path = NULL;
56
- parser->query_string = NULL;
57
- parser->http_version = NULL;
58
- parser->content_length = NULL;
59
73
  }
60
74
 
61
75
 
@@ -74,7 +88,7 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len,
74
88
  assert(pe - p == len - off && "pointers aren't same distance");
75
89
 
76
90
 
77
- #line 78 "src/parser.c"
91
+ #line 92 "src/parser.c"
78
92
  {
79
93
  if ( p == pe )
80
94
  goto _test_eof;
@@ -98,40 +112,40 @@ st0:
98
112
  cs = 0;
99
113
  goto _out;
100
114
  tr0:
101
- #line 22 "src/parser.rl"
115
+ #line 21 "src/parser.rl"
102
116
  {MARK(mark, p); }
103
117
  goto st2;
104
118
  st2:
105
119
  if ( ++p == pe )
106
120
  goto _test_eof2;
107
121
  case 2:
108
- #line 109 "src/parser.c"
122
+ #line 123 "src/parser.c"
109
123
  switch( (*p) ) {
110
124
  case 32: goto tr2;
111
- case 36: goto st54;
112
- case 95: goto st54;
125
+ case 36: goto st99;
126
+ case 95: goto st99;
113
127
  }
114
128
  if ( (*p) < 48 ) {
115
129
  if ( 45 <= (*p) && (*p) <= 46 )
116
- goto st54;
130
+ goto st99;
117
131
  } else if ( (*p) > 57 ) {
118
132
  if ( 65 <= (*p) && (*p) <= 90 )
119
- goto st54;
133
+ goto st99;
120
134
  } else
121
- goto st54;
135
+ goto st99;
122
136
  goto st0;
123
137
  tr2:
124
- #line 50 "src/parser.rl"
125
- {
126
- if(parser->request_method != NULL)
127
- parser->request_method(parser->data, PTR_TO(mark), LEN(mark, p));
138
+ #line 66 "src/parser.rl"
139
+ {
140
+ if(!apply_element(parser, MONGREL_REQUEST_METHOD, PTR_TO(mark), p, 1024))
141
+ {p++; cs = 3; goto _out;}
128
142
  }
129
143
  goto st3;
130
144
  st3:
131
145
  if ( ++p == pe )
132
146
  goto _test_eof3;
133
147
  case 3:
134
- #line 135 "src/parser.c"
148
+ #line 149 "src/parser.c"
135
149
  switch( (*p) ) {
136
150
  case 42: goto tr4;
137
151
  case 43: goto tr5;
@@ -148,135 +162,97 @@ case 3:
148
162
  goto tr5;
149
163
  goto st0;
150
164
  tr4:
151
- #line 22 "src/parser.rl"
165
+ #line 21 "src/parser.rl"
152
166
  {MARK(mark, p); }
153
167
  goto st4;
154
168
  st4:
155
169
  if ( ++p == pe )
156
170
  goto _test_eof4;
157
171
  case 4:
158
- #line 159 "src/parser.c"
172
+ #line 173 "src/parser.c"
159
173
  switch( (*p) ) {
160
174
  case 32: goto tr8;
161
175
  case 35: goto tr9;
162
176
  }
163
177
  goto st0;
164
178
  tr8:
165
- #line 55 "src/parser.rl"
179
+ #line 71 "src/parser.rl"
166
180
  {
167
- if(LEN(mark, p) > 12 * 1024) {
168
- parser->overflow_error = TRUE;
181
+ if(!apply_element(parser, MONGREL_REQUEST_URI, PTR_TO(mark), p, 12*1024))
169
182
  {p++; cs = 5; goto _out;}
170
- }
171
- if(parser->request_uri != NULL)
172
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
173
183
  }
174
184
  goto st5;
175
- tr50:
176
- #line 22 "src/parser.rl"
185
+ tr103:
186
+ #line 21 "src/parser.rl"
177
187
  {MARK(mark, p); }
178
- #line 88 "src/parser.rl"
188
+ #line 51 "src/parser.rl"
179
189
  {
180
- /* Don't know if this length is specified somewhere or not */
181
- if(LEN(mark, p) > 1024) {
182
- parser->overflow_error = TRUE;
190
+ if(!apply_element(parser, MONGREL_FRAGMENT, PTR_TO(mark), p, 10*1024))
183
191
  {p++; cs = 5; goto _out;}
184
- }
185
- if(parser->fragment != NULL)
186
- parser->fragment(parser->data, PTR_TO(mark), LEN(mark, p));
187
192
  }
188
193
  goto st5;
189
- tr53:
190
- #line 88 "src/parser.rl"
194
+ tr106:
195
+ #line 51 "src/parser.rl"
191
196
  {
192
- /* Don't know if this length is specified somewhere or not */
193
- if(LEN(mark, p) > 1024) {
194
- parser->overflow_error = TRUE;
197
+ if(!apply_element(parser, MONGREL_FRAGMENT, PTR_TO(mark), p, 10*1024))
195
198
  {p++; cs = 5; goto _out;}
196
- }
197
- if(parser->fragment != NULL)
198
- parser->fragment(parser->data, PTR_TO(mark), LEN(mark, p));
199
199
  }
200
200
  goto st5;
201
- tr61:
202
- #line 79 "src/parser.rl"
201
+ tr114:
202
+ #line 61 "src/parser.rl"
203
203
  {
204
- if(LEN(mark, p) > 1024) {
205
- parser->overflow_error = TRUE;
204
+ if(!apply_element(parser, MONGREL_REQUEST_PATH, PTR_TO(mark), p, 1024))
206
205
  {p++; cs = 5; goto _out;}
207
- }
208
- if(parser->request_path != NULL)
209
- parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
210
206
  }
211
- #line 55 "src/parser.rl"
207
+ #line 71 "src/parser.rl"
212
208
  {
213
- if(LEN(mark, p) > 12 * 1024) {
214
- parser->overflow_error = TRUE;
209
+ if(!apply_element(parser, MONGREL_REQUEST_URI, PTR_TO(mark), p, 12*1024))
215
210
  {p++; cs = 5; goto _out;}
216
- }
217
- if(parser->request_uri != NULL)
218
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
219
211
  }
220
212
  goto st5;
221
- tr72:
222
- #line 64 "src/parser.rl"
213
+ tr125:
214
+ #line 76 "src/parser.rl"
223
215
  {MARK(query_start, p); }
224
- #line 65 "src/parser.rl"
225
- {
226
- if(LEN(query_start, p) > 10 * 1024) {
227
- parser->overflow_error = TRUE;
216
+ #line 77 "src/parser.rl"
217
+ {
218
+ if(!apply_element(parser, MONGREL_QUERY_STRING, PTR_TO(query_start), p, 10*1024))
228
219
  {p++; cs = 5; goto _out;}
229
- }
230
- if(parser->query_string != NULL)
231
- parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
232
220
  }
233
- #line 55 "src/parser.rl"
221
+ #line 71 "src/parser.rl"
234
222
  {
235
- if(LEN(mark, p) > 12 * 1024) {
236
- parser->overflow_error = TRUE;
223
+ if(!apply_element(parser, MONGREL_REQUEST_URI, PTR_TO(mark), p, 12*1024))
237
224
  {p++; cs = 5; goto _out;}
238
- }
239
- if(parser->request_uri != NULL)
240
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
241
225
  }
242
226
  goto st5;
243
- tr76:
244
- #line 65 "src/parser.rl"
245
- {
246
- if(LEN(query_start, p) > 10 * 1024) {
247
- parser->overflow_error = TRUE;
227
+ tr129:
228
+ #line 77 "src/parser.rl"
229
+ {
230
+ if(!apply_element(parser, MONGREL_QUERY_STRING, PTR_TO(query_start), p, 10*1024))
248
231
  {p++; cs = 5; goto _out;}
249
- }
250
- if(parser->query_string != NULL)
251
- parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
252
232
  }
253
- #line 55 "src/parser.rl"
233
+ #line 71 "src/parser.rl"
254
234
  {
255
- if(LEN(mark, p) > 12 * 1024) {
256
- parser->overflow_error = TRUE;
235
+ if(!apply_element(parser, MONGREL_REQUEST_URI, PTR_TO(mark), p, 12*1024))
257
236
  {p++; cs = 5; goto _out;}
258
- }
259
- if(parser->request_uri != NULL)
260
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
261
237
  }
262
238
  goto st5;
263
239
  st5:
264
240
  if ( ++p == pe )
265
241
  goto _test_eof5;
266
242
  case 5:
267
- #line 268 "src/parser.c"
243
+ #line 244 "src/parser.c"
268
244
  if ( (*p) == 72 )
269
245
  goto tr10;
270
246
  goto st0;
271
247
  tr10:
272
- #line 22 "src/parser.rl"
248
+ #line 21 "src/parser.rl"
273
249
  {MARK(mark, p); }
274
250
  goto st6;
275
251
  st6:
276
252
  if ( ++p == pe )
277
253
  goto _test_eof6;
278
254
  case 6:
279
- #line 280 "src/parser.c"
255
+ #line 256 "src/parser.c"
280
256
  if ( (*p) == 84 )
281
257
  goto st7;
282
258
  goto st0;
@@ -334,61 +310,61 @@ case 13:
334
310
  goto st13;
335
311
  goto st0;
336
312
  tr18:
337
- #line 74 "src/parser.rl"
338
- {
339
- if(parser->http_version != NULL)
340
- parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p));
313
+ #line 56 "src/parser.rl"
314
+ {
315
+ if(!apply_element(parser, MONGREL_HTTP_VERSION, PTR_TO(mark), p, 10))
316
+ {p++; cs = 14; goto _out;}
341
317
  }
342
318
  goto st14;
343
- tr27:
344
- #line 33 "src/parser.rl"
319
+ tr28:
320
+ #line 32 "src/parser.rl"
345
321
  { MARK(mark, p); }
346
- #line 34 "src/parser.rl"
322
+ #line 33 "src/parser.rl"
347
323
  {
348
- if(LEN(mark, p) > 80 * 1024) {
349
- parser->overflow_error = TRUE;
350
- {p++; cs = 14; goto _out;}
351
- }
324
+ if(LEN(mark, p) > 80 * 1024) { parser->overflow_error = TRUE; {p++; cs = 14; goto _out;} }
352
325
  if(parser->http_field != NULL) {
353
326
  parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
354
327
  }
355
328
  }
356
329
  goto st14;
357
- tr30:
358
- #line 34 "src/parser.rl"
330
+ tr32:
331
+ #line 33 "src/parser.rl"
359
332
  {
360
- if(LEN(mark, p) > 80 * 1024) {
361
- parser->overflow_error = TRUE;
362
- {p++; cs = 14; goto _out;}
363
- }
333
+ if(LEN(mark, p) > 80 * 1024) { parser->overflow_error = TRUE; {p++; cs = 14; goto _out;} }
364
334
  if(parser->http_field != NULL) {
365
335
  parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
366
336
  }
367
337
  }
368
338
  goto st14;
369
- tr47:
370
- #line 44 "src/parser.rl"
339
+ tr91:
340
+ #line 40 "src/parser.rl"
371
341
  {
372
- if(parser->content_length != NULL) {
373
- parser->content_length(parser->data, PTR_TO(mark), LEN(mark, p));
374
- }
342
+ if(!apply_element(parser, MONGREL_CONTENT_LENGTH, PTR_TO(mark), p, 20))
343
+ {p++; cs = 14; goto _out;}
344
+ set_content_length(parser, PTR_TO(mark), LEN(mark, p));
375
345
  }
376
- #line 34 "src/parser.rl"
346
+ goto st14;
347
+ tr98:
348
+ #line 21 "src/parser.rl"
349
+ {MARK(mark, p); }
350
+ #line 46 "src/parser.rl"
377
351
  {
378
- if(LEN(mark, p) > 80 * 1024) {
379
- parser->overflow_error = TRUE;
352
+ if(!apply_element(parser, MONGREL_CONTENT_TYPE, PTR_TO(mark), p, 10*1024))
353
+ {p++; cs = 14; goto _out;}
354
+ }
355
+ goto st14;
356
+ tr101:
357
+ #line 46 "src/parser.rl"
358
+ {
359
+ if(!apply_element(parser, MONGREL_CONTENT_TYPE, PTR_TO(mark), p, 10*1024))
380
360
  {p++; cs = 14; goto _out;}
381
- }
382
- if(parser->http_field != NULL) {
383
- parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
384
- }
385
361
  }
386
362
  goto st14;
387
363
  st14:
388
364
  if ( ++p == pe )
389
365
  goto _test_eof14;
390
366
  case 14:
391
- #line 392 "src/parser.c"
367
+ #line 368 "src/parser.c"
392
368
  if ( (*p) == 10 )
393
369
  goto st15;
394
370
  goto st0;
@@ -430,36 +406,32 @@ case 16:
430
406
  goto tr23;
431
407
  goto st0;
432
408
  tr23:
433
- #line 98 "src/parser.rl"
409
+ #line 82 "src/parser.rl"
434
410
  {
435
- if(parser->nread > 1024 * (80 + 32)) {
436
- parser->overflow_error = TRUE;
437
- {p++; cs = 73; goto _out;}
438
- }
439
- parser->body_start = p - buffer + 1;
440
- if(parser->header_done != NULL)
441
- parser->header_done(parser->data, p + 1, pe - p - 1);
442
- {p++; cs = 73; goto _out;}
411
+ parser->body_start = p - buffer + 1;
412
+ {p++; cs = 118; goto _out;}
443
413
  }
444
- goto st73;
445
- st73:
414
+ goto st118;
415
+ st118:
446
416
  if ( ++p == pe )
447
- goto _test_eof73;
448
- case 73:
449
- #line 450 "src/parser.c"
417
+ goto _test_eof118;
418
+ case 118:
419
+ #line 420 "src/parser.c"
450
420
  goto st0;
451
421
  tr21:
452
- #line 24 "src/parser.rl"
422
+ #line 23 "src/parser.rl"
453
423
  { MARK(field_start, p); }
454
424
  goto st17;
455
425
  st17:
456
426
  if ( ++p == pe )
457
427
  goto _test_eof17;
458
428
  case 17:
459
- #line 460 "src/parser.c"
429
+ #line 430 "src/parser.c"
460
430
  switch( (*p) ) {
461
431
  case 33: goto st17;
462
432
  case 58: goto tr25;
433
+ case 67: goto st40;
434
+ case 99: goto st40;
463
435
  case 124: goto st17;
464
436
  case 126: goto st17;
465
437
  }
@@ -482,7 +454,7 @@ case 17:
482
454
  goto st17;
483
455
  goto st0;
484
456
  tr25:
485
- #line 25 "src/parser.rl"
457
+ #line 24 "src/parser.rl"
486
458
  {
487
459
  parser->field_len = LEN(field_start, p);
488
460
  if(parser->field_len > 256) {
@@ -491,196 +463,1194 @@ tr25:
491
463
  }
492
464
  }
493
465
  goto st18;
494
- tr28:
495
- #line 33 "src/parser.rl"
466
+ tr29:
467
+ #line 32 "src/parser.rl"
496
468
  { MARK(mark, p); }
497
469
  goto st18;
498
470
  st18:
499
471
  if ( ++p == pe )
500
472
  goto _test_eof18;
501
473
  case 18:
502
- #line 503 "src/parser.c"
474
+ #line 475 "src/parser.c"
503
475
  switch( (*p) ) {
504
- case 13: goto tr27;
505
- case 32: goto tr28;
476
+ case 13: goto tr28;
477
+ case 32: goto tr29;
478
+ case 67: goto tr30;
479
+ case 99: goto tr30;
506
480
  }
507
- goto tr26;
508
- tr26:
509
- #line 33 "src/parser.rl"
481
+ goto tr27;
482
+ tr27:
483
+ #line 32 "src/parser.rl"
510
484
  { MARK(mark, p); }
511
485
  goto st19;
512
486
  st19:
513
487
  if ( ++p == pe )
514
488
  goto _test_eof19;
515
489
  case 19:
516
- #line 517 "src/parser.c"
517
- if ( (*p) == 13 )
518
- goto tr30;
490
+ #line 491 "src/parser.c"
491
+ switch( (*p) ) {
492
+ case 13: goto tr32;
493
+ case 67: goto st20;
494
+ case 99: goto st20;
495
+ }
519
496
  goto st19;
520
- tr22:
521
- #line 24 "src/parser.rl"
522
- { MARK(field_start, p); }
497
+ tr30:
498
+ #line 32 "src/parser.rl"
499
+ { MARK(mark, p); }
523
500
  goto st20;
524
501
  st20:
525
502
  if ( ++p == pe )
526
503
  goto _test_eof20;
527
504
  case 20:
528
- #line 529 "src/parser.c"
505
+ #line 506 "src/parser.c"
529
506
  switch( (*p) ) {
530
- case 33: goto st17;
531
- case 58: goto tr25;
507
+ case 13: goto tr32;
508
+ case 67: goto st20;
532
509
  case 79: goto st21;
510
+ case 99: goto st20;
533
511
  case 111: goto st21;
534
- case 124: goto st17;
535
- case 126: goto st17;
536
512
  }
537
- if ( (*p) < 45 ) {
538
- if ( (*p) > 39 ) {
539
- if ( 42 <= (*p) && (*p) <= 43 )
540
- goto st17;
541
- } else if ( (*p) >= 35 )
542
- goto st17;
543
- } else if ( (*p) > 46 ) {
544
- if ( (*p) < 65 ) {
545
- if ( 48 <= (*p) && (*p) <= 57 )
546
- goto st17;
547
- } else if ( (*p) > 90 ) {
548
- if ( 94 <= (*p) && (*p) <= 122 )
549
- goto st17;
550
- } else
551
- goto st17;
552
- } else
553
- goto st17;
554
- goto st0;
513
+ goto st19;
555
514
  st21:
556
515
  if ( ++p == pe )
557
516
  goto _test_eof21;
558
517
  case 21:
559
518
  switch( (*p) ) {
560
- case 33: goto st17;
561
- case 58: goto tr25;
519
+ case 13: goto tr32;
520
+ case 67: goto st20;
562
521
  case 78: goto st22;
522
+ case 99: goto st20;
563
523
  case 110: goto st22;
564
- case 124: goto st17;
565
- case 126: goto st17;
566
524
  }
567
- if ( (*p) < 45 ) {
568
- if ( (*p) > 39 ) {
569
- if ( 42 <= (*p) && (*p) <= 43 )
570
- goto st17;
571
- } else if ( (*p) >= 35 )
572
- goto st17;
573
- } else if ( (*p) > 46 ) {
574
- if ( (*p) < 65 ) {
575
- if ( 48 <= (*p) && (*p) <= 57 )
576
- goto st17;
577
- } else if ( (*p) > 90 ) {
578
- if ( 94 <= (*p) && (*p) <= 122 )
579
- goto st17;
580
- } else
581
- goto st17;
582
- } else
583
- goto st17;
584
- goto st0;
525
+ goto st19;
585
526
  st22:
586
527
  if ( ++p == pe )
587
528
  goto _test_eof22;
588
529
  case 22:
589
530
  switch( (*p) ) {
590
- case 33: goto st17;
591
- case 58: goto tr25;
531
+ case 13: goto tr32;
532
+ case 67: goto st20;
592
533
  case 84: goto st23;
534
+ case 99: goto st20;
593
535
  case 116: goto st23;
594
- case 124: goto st17;
595
- case 126: goto st17;
596
536
  }
597
- if ( (*p) < 45 ) {
598
- if ( (*p) > 39 ) {
599
- if ( 42 <= (*p) && (*p) <= 43 )
600
- goto st17;
601
- } else if ( (*p) >= 35 )
602
- goto st17;
603
- } else if ( (*p) > 46 ) {
604
- if ( (*p) < 65 ) {
605
- if ( 48 <= (*p) && (*p) <= 57 )
606
- goto st17;
607
- } else if ( (*p) > 90 ) {
608
- if ( 94 <= (*p) && (*p) <= 122 )
609
- goto st17;
610
- } else
611
- goto st17;
612
- } else
613
- goto st17;
614
- goto st0;
537
+ goto st19;
615
538
  st23:
616
539
  if ( ++p == pe )
617
540
  goto _test_eof23;
618
541
  case 23:
619
542
  switch( (*p) ) {
620
- case 33: goto st17;
621
- case 58: goto tr25;
543
+ case 13: goto tr32;
544
+ case 67: goto st20;
622
545
  case 69: goto st24;
546
+ case 99: goto st20;
623
547
  case 101: goto st24;
624
- case 124: goto st17;
625
- case 126: goto st17;
626
548
  }
627
- if ( (*p) < 45 ) {
628
- if ( (*p) > 39 ) {
629
- if ( 42 <= (*p) && (*p) <= 43 )
630
- goto st17;
631
- } else if ( (*p) >= 35 )
632
- goto st17;
633
- } else if ( (*p) > 46 ) {
634
- if ( (*p) < 65 ) {
635
- if ( 48 <= (*p) && (*p) <= 57 )
636
- goto st17;
637
- } else if ( (*p) > 90 ) {
638
- if ( 94 <= (*p) && (*p) <= 122 )
639
- goto st17;
640
- } else
641
- goto st17;
642
- } else
643
- goto st17;
644
- goto st0;
549
+ goto st19;
645
550
  st24:
646
551
  if ( ++p == pe )
647
552
  goto _test_eof24;
648
553
  case 24:
649
554
  switch( (*p) ) {
650
- case 33: goto st17;
651
- case 58: goto tr25;
555
+ case 13: goto tr32;
556
+ case 67: goto st20;
652
557
  case 78: goto st25;
558
+ case 99: goto st20;
653
559
  case 110: goto st25;
654
- case 124: goto st17;
655
- case 126: goto st17;
656
560
  }
657
- if ( (*p) < 45 ) {
658
- if ( (*p) > 39 ) {
659
- if ( 42 <= (*p) && (*p) <= 43 )
660
- goto st17;
661
- } else if ( (*p) >= 35 )
662
- goto st17;
663
- } else if ( (*p) > 46 ) {
664
- if ( (*p) < 65 ) {
665
- if ( 48 <= (*p) && (*p) <= 57 )
666
- goto st17;
667
- } else if ( (*p) > 90 ) {
668
- if ( 94 <= (*p) && (*p) <= 122 )
669
- goto st17;
670
- } else
671
- goto st17;
672
- } else
673
- goto st17;
674
- goto st0;
561
+ goto st19;
675
562
  st25:
676
563
  if ( ++p == pe )
677
- goto _test_eof25;
678
- case 25:
564
+ goto _test_eof25;
565
+ case 25:
566
+ switch( (*p) ) {
567
+ case 13: goto tr32;
568
+ case 67: goto st20;
569
+ case 84: goto st26;
570
+ case 99: goto st20;
571
+ case 116: goto st26;
572
+ }
573
+ goto st19;
574
+ st26:
575
+ if ( ++p == pe )
576
+ goto _test_eof26;
577
+ case 26:
578
+ switch( (*p) ) {
579
+ case 13: goto tr32;
580
+ case 45: goto st27;
581
+ case 67: goto st20;
582
+ case 99: goto st20;
583
+ }
584
+ goto st19;
585
+ st27:
586
+ if ( ++p == pe )
587
+ goto _test_eof27;
588
+ case 27:
589
+ switch( (*p) ) {
590
+ case 13: goto tr32;
591
+ case 67: goto st20;
592
+ case 76: goto st28;
593
+ case 84: goto st36;
594
+ case 99: goto st20;
595
+ case 108: goto st28;
596
+ case 116: goto st36;
597
+ }
598
+ goto st19;
599
+ st28:
600
+ if ( ++p == pe )
601
+ goto _test_eof28;
602
+ case 28:
603
+ switch( (*p) ) {
604
+ case 13: goto tr32;
605
+ case 67: goto st20;
606
+ case 69: goto st29;
607
+ case 99: goto st20;
608
+ case 101: goto st29;
609
+ }
610
+ goto st19;
611
+ st29:
612
+ if ( ++p == pe )
613
+ goto _test_eof29;
614
+ case 29:
615
+ switch( (*p) ) {
616
+ case 13: goto tr32;
617
+ case 67: goto st20;
618
+ case 78: goto st30;
619
+ case 99: goto st20;
620
+ case 110: goto st30;
621
+ }
622
+ goto st19;
623
+ st30:
624
+ if ( ++p == pe )
625
+ goto _test_eof30;
626
+ case 30:
627
+ switch( (*p) ) {
628
+ case 13: goto tr32;
629
+ case 67: goto st20;
630
+ case 71: goto st31;
631
+ case 99: goto st20;
632
+ case 103: goto st31;
633
+ }
634
+ goto st19;
635
+ st31:
636
+ if ( ++p == pe )
637
+ goto _test_eof31;
638
+ case 31:
639
+ switch( (*p) ) {
640
+ case 13: goto tr32;
641
+ case 67: goto st20;
642
+ case 84: goto st32;
643
+ case 99: goto st20;
644
+ case 116: goto st32;
645
+ }
646
+ goto st19;
647
+ st32:
648
+ if ( ++p == pe )
649
+ goto _test_eof32;
650
+ case 32:
651
+ switch( (*p) ) {
652
+ case 13: goto tr32;
653
+ case 67: goto st20;
654
+ case 72: goto st33;
655
+ case 99: goto st20;
656
+ case 104: goto st33;
657
+ }
658
+ goto st19;
659
+ st33:
660
+ if ( ++p == pe )
661
+ goto _test_eof33;
662
+ case 33:
663
+ switch( (*p) ) {
664
+ case 13: goto tr32;
665
+ case 58: goto st34;
666
+ case 67: goto st20;
667
+ case 99: goto st20;
668
+ }
669
+ goto st19;
670
+ st34:
671
+ if ( ++p == pe )
672
+ goto _test_eof34;
673
+ case 34:
674
+ switch( (*p) ) {
675
+ case 13: goto tr32;
676
+ case 32: goto st34;
677
+ case 67: goto st20;
678
+ case 99: goto st20;
679
+ }
680
+ if ( 48 <= (*p) && (*p) <= 57 )
681
+ goto tr49;
682
+ goto st19;
683
+ tr49:
684
+ #line 21 "src/parser.rl"
685
+ {MARK(mark, p); }
686
+ goto st35;
687
+ tr70:
688
+ #line 32 "src/parser.rl"
689
+ { MARK(mark, p); }
690
+ #line 21 "src/parser.rl"
691
+ {MARK(mark, p); }
692
+ goto st35;
693
+ st35:
694
+ if ( ++p == pe )
695
+ goto _test_eof35;
696
+ case 35:
697
+ #line 698 "src/parser.c"
698
+ switch( (*p) ) {
699
+ case 13: goto st0;
700
+ case 67: goto st20;
701
+ case 99: goto st20;
702
+ }
703
+ if ( 48 <= (*p) && (*p) <= 57 )
704
+ goto st35;
705
+ goto st19;
706
+ st36:
707
+ if ( ++p == pe )
708
+ goto _test_eof36;
709
+ case 36:
710
+ switch( (*p) ) {
711
+ case 13: goto tr32;
712
+ case 67: goto st20;
713
+ case 89: goto st37;
714
+ case 99: goto st20;
715
+ case 121: goto st37;
716
+ }
717
+ goto st19;
718
+ st37:
719
+ if ( ++p == pe )
720
+ goto _test_eof37;
721
+ case 37:
722
+ switch( (*p) ) {
723
+ case 13: goto tr32;
724
+ case 67: goto st20;
725
+ case 80: goto st38;
726
+ case 99: goto st20;
727
+ case 112: goto st38;
728
+ }
729
+ goto st19;
730
+ st38:
731
+ if ( ++p == pe )
732
+ goto _test_eof38;
733
+ case 38:
734
+ switch( (*p) ) {
735
+ case 13: goto tr32;
736
+ case 67: goto st20;
737
+ case 69: goto st39;
738
+ case 99: goto st20;
739
+ case 101: goto st39;
740
+ }
741
+ goto st19;
742
+ st39:
743
+ if ( ++p == pe )
744
+ goto _test_eof39;
745
+ case 39:
746
+ switch( (*p) ) {
747
+ case 13: goto tr32;
748
+ case 58: goto st0;
749
+ case 67: goto st20;
750
+ case 99: goto st20;
751
+ }
752
+ goto st19;
753
+ st40:
754
+ if ( ++p == pe )
755
+ goto _test_eof40;
756
+ case 40:
757
+ switch( (*p) ) {
758
+ case 33: goto st17;
759
+ case 58: goto tr25;
760
+ case 67: goto st40;
761
+ case 79: goto st41;
762
+ case 99: goto st40;
763
+ case 111: goto st41;
764
+ case 124: goto st17;
765
+ case 126: goto st17;
766
+ }
767
+ if ( (*p) < 45 ) {
768
+ if ( (*p) > 39 ) {
769
+ if ( 42 <= (*p) && (*p) <= 43 )
770
+ goto st17;
771
+ } else if ( (*p) >= 35 )
772
+ goto st17;
773
+ } else if ( (*p) > 46 ) {
774
+ if ( (*p) < 65 ) {
775
+ if ( 48 <= (*p) && (*p) <= 57 )
776
+ goto st17;
777
+ } else if ( (*p) > 90 ) {
778
+ if ( 94 <= (*p) && (*p) <= 122 )
779
+ goto st17;
780
+ } else
781
+ goto st17;
782
+ } else
783
+ goto st17;
784
+ goto st0;
785
+ st41:
786
+ if ( ++p == pe )
787
+ goto _test_eof41;
788
+ case 41:
789
+ switch( (*p) ) {
790
+ case 33: goto st17;
791
+ case 58: goto tr25;
792
+ case 67: goto st40;
793
+ case 78: goto st42;
794
+ case 99: goto st40;
795
+ case 110: goto st42;
796
+ case 124: goto st17;
797
+ case 126: goto st17;
798
+ }
799
+ if ( (*p) < 45 ) {
800
+ if ( (*p) > 39 ) {
801
+ if ( 42 <= (*p) && (*p) <= 43 )
802
+ goto st17;
803
+ } else if ( (*p) >= 35 )
804
+ goto st17;
805
+ } else if ( (*p) > 46 ) {
806
+ if ( (*p) < 65 ) {
807
+ if ( 48 <= (*p) && (*p) <= 57 )
808
+ goto st17;
809
+ } else if ( (*p) > 90 ) {
810
+ if ( 94 <= (*p) && (*p) <= 122 )
811
+ goto st17;
812
+ } else
813
+ goto st17;
814
+ } else
815
+ goto st17;
816
+ goto st0;
817
+ st42:
818
+ if ( ++p == pe )
819
+ goto _test_eof42;
820
+ case 42:
821
+ switch( (*p) ) {
822
+ case 33: goto st17;
823
+ case 58: goto tr25;
824
+ case 67: goto st40;
825
+ case 84: goto st43;
826
+ case 99: goto st40;
827
+ case 116: goto st43;
828
+ case 124: goto st17;
829
+ case 126: goto st17;
830
+ }
831
+ if ( (*p) < 45 ) {
832
+ if ( (*p) > 39 ) {
833
+ if ( 42 <= (*p) && (*p) <= 43 )
834
+ goto st17;
835
+ } else if ( (*p) >= 35 )
836
+ goto st17;
837
+ } else if ( (*p) > 46 ) {
838
+ if ( (*p) < 65 ) {
839
+ if ( 48 <= (*p) && (*p) <= 57 )
840
+ goto st17;
841
+ } else if ( (*p) > 90 ) {
842
+ if ( 94 <= (*p) && (*p) <= 122 )
843
+ goto st17;
844
+ } else
845
+ goto st17;
846
+ } else
847
+ goto st17;
848
+ goto st0;
849
+ st43:
850
+ if ( ++p == pe )
851
+ goto _test_eof43;
852
+ case 43:
853
+ switch( (*p) ) {
854
+ case 33: goto st17;
855
+ case 58: goto tr25;
856
+ case 67: goto st40;
857
+ case 69: goto st44;
858
+ case 99: goto st40;
859
+ case 101: goto st44;
860
+ case 124: goto st17;
861
+ case 126: goto st17;
862
+ }
863
+ if ( (*p) < 45 ) {
864
+ if ( (*p) > 39 ) {
865
+ if ( 42 <= (*p) && (*p) <= 43 )
866
+ goto st17;
867
+ } else if ( (*p) >= 35 )
868
+ goto st17;
869
+ } else if ( (*p) > 46 ) {
870
+ if ( (*p) < 65 ) {
871
+ if ( 48 <= (*p) && (*p) <= 57 )
872
+ goto st17;
873
+ } else if ( (*p) > 90 ) {
874
+ if ( 94 <= (*p) && (*p) <= 122 )
875
+ goto st17;
876
+ } else
877
+ goto st17;
878
+ } else
879
+ goto st17;
880
+ goto st0;
881
+ st44:
882
+ if ( ++p == pe )
883
+ goto _test_eof44;
884
+ case 44:
885
+ switch( (*p) ) {
886
+ case 33: goto st17;
887
+ case 58: goto tr25;
888
+ case 67: goto st40;
889
+ case 78: goto st45;
890
+ case 99: goto st40;
891
+ case 110: goto st45;
892
+ case 124: goto st17;
893
+ case 126: goto st17;
894
+ }
895
+ if ( (*p) < 45 ) {
896
+ if ( (*p) > 39 ) {
897
+ if ( 42 <= (*p) && (*p) <= 43 )
898
+ goto st17;
899
+ } else if ( (*p) >= 35 )
900
+ goto st17;
901
+ } else if ( (*p) > 46 ) {
902
+ if ( (*p) < 65 ) {
903
+ if ( 48 <= (*p) && (*p) <= 57 )
904
+ goto st17;
905
+ } else if ( (*p) > 90 ) {
906
+ if ( 94 <= (*p) && (*p) <= 122 )
907
+ goto st17;
908
+ } else
909
+ goto st17;
910
+ } else
911
+ goto st17;
912
+ goto st0;
913
+ st45:
914
+ if ( ++p == pe )
915
+ goto _test_eof45;
916
+ case 45:
917
+ switch( (*p) ) {
918
+ case 33: goto st17;
919
+ case 58: goto tr25;
920
+ case 67: goto st40;
921
+ case 84: goto st46;
922
+ case 99: goto st40;
923
+ case 116: goto st46;
924
+ case 124: goto st17;
925
+ case 126: goto st17;
926
+ }
927
+ if ( (*p) < 45 ) {
928
+ if ( (*p) > 39 ) {
929
+ if ( 42 <= (*p) && (*p) <= 43 )
930
+ goto st17;
931
+ } else if ( (*p) >= 35 )
932
+ goto st17;
933
+ } else if ( (*p) > 46 ) {
934
+ if ( (*p) < 65 ) {
935
+ if ( 48 <= (*p) && (*p) <= 57 )
936
+ goto st17;
937
+ } else if ( (*p) > 90 ) {
938
+ if ( 94 <= (*p) && (*p) <= 122 )
939
+ goto st17;
940
+ } else
941
+ goto st17;
942
+ } else
943
+ goto st17;
944
+ goto st0;
945
+ st46:
946
+ if ( ++p == pe )
947
+ goto _test_eof46;
948
+ case 46:
949
+ switch( (*p) ) {
950
+ case 33: goto st17;
951
+ case 45: goto st47;
952
+ case 46: goto st17;
953
+ case 58: goto tr25;
954
+ case 67: goto st40;
955
+ case 99: goto st40;
956
+ case 124: goto st17;
957
+ case 126: goto st17;
958
+ }
959
+ if ( (*p) < 48 ) {
960
+ if ( (*p) > 39 ) {
961
+ if ( 42 <= (*p) && (*p) <= 43 )
962
+ goto st17;
963
+ } else if ( (*p) >= 35 )
964
+ goto st17;
965
+ } else if ( (*p) > 57 ) {
966
+ if ( (*p) > 90 ) {
967
+ if ( 94 <= (*p) && (*p) <= 122 )
968
+ goto st17;
969
+ } else if ( (*p) >= 65 )
970
+ goto st17;
971
+ } else
972
+ goto st17;
973
+ goto st0;
974
+ st47:
975
+ if ( ++p == pe )
976
+ goto _test_eof47;
977
+ case 47:
978
+ switch( (*p) ) {
979
+ case 33: goto st17;
980
+ case 58: goto tr25;
981
+ case 67: goto st40;
982
+ case 76: goto st48;
983
+ case 84: goto st55;
984
+ case 99: goto st40;
985
+ case 108: goto st48;
986
+ case 116: goto st55;
987
+ case 124: goto st17;
988
+ case 126: goto st17;
989
+ }
990
+ if ( (*p) < 45 ) {
991
+ if ( (*p) > 39 ) {
992
+ if ( 42 <= (*p) && (*p) <= 43 )
993
+ goto st17;
994
+ } else if ( (*p) >= 35 )
995
+ goto st17;
996
+ } else if ( (*p) > 46 ) {
997
+ if ( (*p) < 65 ) {
998
+ if ( 48 <= (*p) && (*p) <= 57 )
999
+ goto st17;
1000
+ } else if ( (*p) > 90 ) {
1001
+ if ( 94 <= (*p) && (*p) <= 122 )
1002
+ goto st17;
1003
+ } else
1004
+ goto st17;
1005
+ } else
1006
+ goto st17;
1007
+ goto st0;
1008
+ st48:
1009
+ if ( ++p == pe )
1010
+ goto _test_eof48;
1011
+ case 48:
1012
+ switch( (*p) ) {
1013
+ case 33: goto st17;
1014
+ case 58: goto tr25;
1015
+ case 67: goto st40;
1016
+ case 69: goto st49;
1017
+ case 99: goto st40;
1018
+ case 101: goto st49;
1019
+ case 124: goto st17;
1020
+ case 126: goto st17;
1021
+ }
1022
+ if ( (*p) < 45 ) {
1023
+ if ( (*p) > 39 ) {
1024
+ if ( 42 <= (*p) && (*p) <= 43 )
1025
+ goto st17;
1026
+ } else if ( (*p) >= 35 )
1027
+ goto st17;
1028
+ } else if ( (*p) > 46 ) {
1029
+ if ( (*p) < 65 ) {
1030
+ if ( 48 <= (*p) && (*p) <= 57 )
1031
+ goto st17;
1032
+ } else if ( (*p) > 90 ) {
1033
+ if ( 94 <= (*p) && (*p) <= 122 )
1034
+ goto st17;
1035
+ } else
1036
+ goto st17;
1037
+ } else
1038
+ goto st17;
1039
+ goto st0;
1040
+ st49:
1041
+ if ( ++p == pe )
1042
+ goto _test_eof49;
1043
+ case 49:
1044
+ switch( (*p) ) {
1045
+ case 33: goto st17;
1046
+ case 58: goto tr25;
1047
+ case 67: goto st40;
1048
+ case 78: goto st50;
1049
+ case 99: goto st40;
1050
+ case 110: goto st50;
1051
+ case 124: goto st17;
1052
+ case 126: goto st17;
1053
+ }
1054
+ if ( (*p) < 45 ) {
1055
+ if ( (*p) > 39 ) {
1056
+ if ( 42 <= (*p) && (*p) <= 43 )
1057
+ goto st17;
1058
+ } else if ( (*p) >= 35 )
1059
+ goto st17;
1060
+ } else if ( (*p) > 46 ) {
1061
+ if ( (*p) < 65 ) {
1062
+ if ( 48 <= (*p) && (*p) <= 57 )
1063
+ goto st17;
1064
+ } else if ( (*p) > 90 ) {
1065
+ if ( 94 <= (*p) && (*p) <= 122 )
1066
+ goto st17;
1067
+ } else
1068
+ goto st17;
1069
+ } else
1070
+ goto st17;
1071
+ goto st0;
1072
+ st50:
1073
+ if ( ++p == pe )
1074
+ goto _test_eof50;
1075
+ case 50:
1076
+ switch( (*p) ) {
1077
+ case 33: goto st17;
1078
+ case 58: goto tr25;
1079
+ case 67: goto st40;
1080
+ case 71: goto st51;
1081
+ case 99: goto st40;
1082
+ case 103: goto st51;
1083
+ case 124: goto st17;
1084
+ case 126: goto st17;
1085
+ }
1086
+ if ( (*p) < 45 ) {
1087
+ if ( (*p) > 39 ) {
1088
+ if ( 42 <= (*p) && (*p) <= 43 )
1089
+ goto st17;
1090
+ } else if ( (*p) >= 35 )
1091
+ goto st17;
1092
+ } else if ( (*p) > 46 ) {
1093
+ if ( (*p) < 65 ) {
1094
+ if ( 48 <= (*p) && (*p) <= 57 )
1095
+ goto st17;
1096
+ } else if ( (*p) > 90 ) {
1097
+ if ( 94 <= (*p) && (*p) <= 122 )
1098
+ goto st17;
1099
+ } else
1100
+ goto st17;
1101
+ } else
1102
+ goto st17;
1103
+ goto st0;
1104
+ st51:
1105
+ if ( ++p == pe )
1106
+ goto _test_eof51;
1107
+ case 51:
1108
+ switch( (*p) ) {
1109
+ case 33: goto st17;
1110
+ case 58: goto tr25;
1111
+ case 67: goto st40;
1112
+ case 84: goto st52;
1113
+ case 99: goto st40;
1114
+ case 116: goto st52;
1115
+ case 124: goto st17;
1116
+ case 126: goto st17;
1117
+ }
1118
+ if ( (*p) < 45 ) {
1119
+ if ( (*p) > 39 ) {
1120
+ if ( 42 <= (*p) && (*p) <= 43 )
1121
+ goto st17;
1122
+ } else if ( (*p) >= 35 )
1123
+ goto st17;
1124
+ } else if ( (*p) > 46 ) {
1125
+ if ( (*p) < 65 ) {
1126
+ if ( 48 <= (*p) && (*p) <= 57 )
1127
+ goto st17;
1128
+ } else if ( (*p) > 90 ) {
1129
+ if ( 94 <= (*p) && (*p) <= 122 )
1130
+ goto st17;
1131
+ } else
1132
+ goto st17;
1133
+ } else
1134
+ goto st17;
1135
+ goto st0;
1136
+ st52:
1137
+ if ( ++p == pe )
1138
+ goto _test_eof52;
1139
+ case 52:
1140
+ switch( (*p) ) {
1141
+ case 33: goto st17;
1142
+ case 58: goto tr25;
1143
+ case 67: goto st40;
1144
+ case 72: goto st53;
1145
+ case 99: goto st40;
1146
+ case 104: goto st53;
1147
+ case 124: goto st17;
1148
+ case 126: goto st17;
1149
+ }
1150
+ if ( (*p) < 45 ) {
1151
+ if ( (*p) > 39 ) {
1152
+ if ( 42 <= (*p) && (*p) <= 43 )
1153
+ goto st17;
1154
+ } else if ( (*p) >= 35 )
1155
+ goto st17;
1156
+ } else if ( (*p) > 46 ) {
1157
+ if ( (*p) < 65 ) {
1158
+ if ( 48 <= (*p) && (*p) <= 57 )
1159
+ goto st17;
1160
+ } else if ( (*p) > 90 ) {
1161
+ if ( 94 <= (*p) && (*p) <= 122 )
1162
+ goto st17;
1163
+ } else
1164
+ goto st17;
1165
+ } else
1166
+ goto st17;
1167
+ goto st0;
1168
+ st53:
1169
+ if ( ++p == pe )
1170
+ goto _test_eof53;
1171
+ case 53:
1172
+ switch( (*p) ) {
1173
+ case 33: goto st17;
1174
+ case 58: goto tr68;
1175
+ case 67: goto st40;
1176
+ case 99: goto st40;
1177
+ case 124: goto st17;
1178
+ case 126: goto st17;
1179
+ }
1180
+ if ( (*p) < 45 ) {
1181
+ if ( (*p) > 39 ) {
1182
+ if ( 42 <= (*p) && (*p) <= 43 )
1183
+ goto st17;
1184
+ } else if ( (*p) >= 35 )
1185
+ goto st17;
1186
+ } else if ( (*p) > 46 ) {
1187
+ if ( (*p) < 65 ) {
1188
+ if ( 48 <= (*p) && (*p) <= 57 )
1189
+ goto st17;
1190
+ } else if ( (*p) > 90 ) {
1191
+ if ( 94 <= (*p) && (*p) <= 122 )
1192
+ goto st17;
1193
+ } else
1194
+ goto st17;
1195
+ } else
1196
+ goto st17;
1197
+ goto st0;
1198
+ tr68:
1199
+ #line 24 "src/parser.rl"
1200
+ {
1201
+ parser->field_len = LEN(field_start, p);
1202
+ if(parser->field_len > 256) {
1203
+ parser->overflow_error = TRUE;
1204
+ {p++; cs = 54; goto _out;}
1205
+ }
1206
+ }
1207
+ goto st54;
1208
+ tr69:
1209
+ #line 32 "src/parser.rl"
1210
+ { MARK(mark, p); }
1211
+ goto st54;
1212
+ st54:
1213
+ if ( ++p == pe )
1214
+ goto _test_eof54;
1215
+ case 54:
1216
+ #line 1217 "src/parser.c"
1217
+ switch( (*p) ) {
1218
+ case 13: goto tr28;
1219
+ case 32: goto tr69;
1220
+ case 67: goto tr30;
1221
+ case 99: goto tr30;
1222
+ }
1223
+ if ( 48 <= (*p) && (*p) <= 57 )
1224
+ goto tr70;
1225
+ goto tr27;
1226
+ st55:
1227
+ if ( ++p == pe )
1228
+ goto _test_eof55;
1229
+ case 55:
1230
+ switch( (*p) ) {
1231
+ case 33: goto st17;
1232
+ case 58: goto tr25;
1233
+ case 67: goto st40;
1234
+ case 89: goto st56;
1235
+ case 99: goto st40;
1236
+ case 121: goto st56;
1237
+ case 124: goto st17;
1238
+ case 126: goto st17;
1239
+ }
1240
+ if ( (*p) < 45 ) {
1241
+ if ( (*p) > 39 ) {
1242
+ if ( 42 <= (*p) && (*p) <= 43 )
1243
+ goto st17;
1244
+ } else if ( (*p) >= 35 )
1245
+ goto st17;
1246
+ } else if ( (*p) > 46 ) {
1247
+ if ( (*p) < 65 ) {
1248
+ if ( 48 <= (*p) && (*p) <= 57 )
1249
+ goto st17;
1250
+ } else if ( (*p) > 90 ) {
1251
+ if ( 94 <= (*p) && (*p) <= 122 )
1252
+ goto st17;
1253
+ } else
1254
+ goto st17;
1255
+ } else
1256
+ goto st17;
1257
+ goto st0;
1258
+ st56:
1259
+ if ( ++p == pe )
1260
+ goto _test_eof56;
1261
+ case 56:
1262
+ switch( (*p) ) {
1263
+ case 33: goto st17;
1264
+ case 58: goto tr25;
1265
+ case 67: goto st40;
1266
+ case 80: goto st57;
1267
+ case 99: goto st40;
1268
+ case 112: goto st57;
1269
+ case 124: goto st17;
1270
+ case 126: goto st17;
1271
+ }
1272
+ if ( (*p) < 45 ) {
1273
+ if ( (*p) > 39 ) {
1274
+ if ( 42 <= (*p) && (*p) <= 43 )
1275
+ goto st17;
1276
+ } else if ( (*p) >= 35 )
1277
+ goto st17;
1278
+ } else if ( (*p) > 46 ) {
1279
+ if ( (*p) < 65 ) {
1280
+ if ( 48 <= (*p) && (*p) <= 57 )
1281
+ goto st17;
1282
+ } else if ( (*p) > 90 ) {
1283
+ if ( 94 <= (*p) && (*p) <= 122 )
1284
+ goto st17;
1285
+ } else
1286
+ goto st17;
1287
+ } else
1288
+ goto st17;
1289
+ goto st0;
1290
+ st57:
1291
+ if ( ++p == pe )
1292
+ goto _test_eof57;
1293
+ case 57:
1294
+ switch( (*p) ) {
1295
+ case 33: goto st17;
1296
+ case 58: goto tr25;
1297
+ case 67: goto st40;
1298
+ case 69: goto st58;
1299
+ case 99: goto st40;
1300
+ case 101: goto st58;
1301
+ case 124: goto st17;
1302
+ case 126: goto st17;
1303
+ }
1304
+ if ( (*p) < 45 ) {
1305
+ if ( (*p) > 39 ) {
1306
+ if ( 42 <= (*p) && (*p) <= 43 )
1307
+ goto st17;
1308
+ } else if ( (*p) >= 35 )
1309
+ goto st17;
1310
+ } else if ( (*p) > 46 ) {
1311
+ if ( (*p) < 65 ) {
1312
+ if ( 48 <= (*p) && (*p) <= 57 )
1313
+ goto st17;
1314
+ } else if ( (*p) > 90 ) {
1315
+ if ( 94 <= (*p) && (*p) <= 122 )
1316
+ goto st17;
1317
+ } else
1318
+ goto st17;
1319
+ } else
1320
+ goto st17;
1321
+ goto st0;
1322
+ st58:
1323
+ if ( ++p == pe )
1324
+ goto _test_eof58;
1325
+ case 58:
1326
+ switch( (*p) ) {
1327
+ case 33: goto st17;
1328
+ case 67: goto st40;
1329
+ case 99: goto st40;
1330
+ case 124: goto st17;
1331
+ case 126: goto st17;
1332
+ }
1333
+ if ( (*p) < 45 ) {
1334
+ if ( (*p) > 39 ) {
1335
+ if ( 42 <= (*p) && (*p) <= 43 )
1336
+ goto st17;
1337
+ } else if ( (*p) >= 35 )
1338
+ goto st17;
1339
+ } else if ( (*p) > 46 ) {
1340
+ if ( (*p) < 65 ) {
1341
+ if ( 48 <= (*p) && (*p) <= 57 )
1342
+ goto st17;
1343
+ } else if ( (*p) > 90 ) {
1344
+ if ( 94 <= (*p) && (*p) <= 122 )
1345
+ goto st17;
1346
+ } else
1347
+ goto st17;
1348
+ } else
1349
+ goto st17;
1350
+ goto st0;
1351
+ tr22:
1352
+ #line 23 "src/parser.rl"
1353
+ { MARK(field_start, p); }
1354
+ goto st59;
1355
+ st59:
1356
+ if ( ++p == pe )
1357
+ goto _test_eof59;
1358
+ case 59:
1359
+ #line 1360 "src/parser.c"
1360
+ switch( (*p) ) {
1361
+ case 33: goto st17;
1362
+ case 58: goto tr25;
1363
+ case 67: goto st40;
1364
+ case 79: goto st60;
1365
+ case 99: goto st40;
1366
+ case 111: goto st60;
1367
+ case 124: goto st17;
1368
+ case 126: goto st17;
1369
+ }
1370
+ if ( (*p) < 45 ) {
1371
+ if ( (*p) > 39 ) {
1372
+ if ( 42 <= (*p) && (*p) <= 43 )
1373
+ goto st17;
1374
+ } else if ( (*p) >= 35 )
1375
+ goto st17;
1376
+ } else if ( (*p) > 46 ) {
1377
+ if ( (*p) < 65 ) {
1378
+ if ( 48 <= (*p) && (*p) <= 57 )
1379
+ goto st17;
1380
+ } else if ( (*p) > 90 ) {
1381
+ if ( 94 <= (*p) && (*p) <= 122 )
1382
+ goto st17;
1383
+ } else
1384
+ goto st17;
1385
+ } else
1386
+ goto st17;
1387
+ goto st0;
1388
+ st60:
1389
+ if ( ++p == pe )
1390
+ goto _test_eof60;
1391
+ case 60:
1392
+ switch( (*p) ) {
1393
+ case 33: goto st17;
1394
+ case 58: goto tr25;
1395
+ case 67: goto st40;
1396
+ case 78: goto st61;
1397
+ case 99: goto st40;
1398
+ case 110: goto st61;
1399
+ case 124: goto st17;
1400
+ case 126: goto st17;
1401
+ }
1402
+ if ( (*p) < 45 ) {
1403
+ if ( (*p) > 39 ) {
1404
+ if ( 42 <= (*p) && (*p) <= 43 )
1405
+ goto st17;
1406
+ } else if ( (*p) >= 35 )
1407
+ goto st17;
1408
+ } else if ( (*p) > 46 ) {
1409
+ if ( (*p) < 65 ) {
1410
+ if ( 48 <= (*p) && (*p) <= 57 )
1411
+ goto st17;
1412
+ } else if ( (*p) > 90 ) {
1413
+ if ( 94 <= (*p) && (*p) <= 122 )
1414
+ goto st17;
1415
+ } else
1416
+ goto st17;
1417
+ } else
1418
+ goto st17;
1419
+ goto st0;
1420
+ st61:
1421
+ if ( ++p == pe )
1422
+ goto _test_eof61;
1423
+ case 61:
1424
+ switch( (*p) ) {
1425
+ case 33: goto st17;
1426
+ case 58: goto tr25;
1427
+ case 67: goto st40;
1428
+ case 84: goto st62;
1429
+ case 99: goto st40;
1430
+ case 116: goto st62;
1431
+ case 124: goto st17;
1432
+ case 126: goto st17;
1433
+ }
1434
+ if ( (*p) < 45 ) {
1435
+ if ( (*p) > 39 ) {
1436
+ if ( 42 <= (*p) && (*p) <= 43 )
1437
+ goto st17;
1438
+ } else if ( (*p) >= 35 )
1439
+ goto st17;
1440
+ } else if ( (*p) > 46 ) {
1441
+ if ( (*p) < 65 ) {
1442
+ if ( 48 <= (*p) && (*p) <= 57 )
1443
+ goto st17;
1444
+ } else if ( (*p) > 90 ) {
1445
+ if ( 94 <= (*p) && (*p) <= 122 )
1446
+ goto st17;
1447
+ } else
1448
+ goto st17;
1449
+ } else
1450
+ goto st17;
1451
+ goto st0;
1452
+ st62:
1453
+ if ( ++p == pe )
1454
+ goto _test_eof62;
1455
+ case 62:
1456
+ switch( (*p) ) {
1457
+ case 33: goto st17;
1458
+ case 58: goto tr25;
1459
+ case 67: goto st40;
1460
+ case 69: goto st63;
1461
+ case 99: goto st40;
1462
+ case 101: goto st63;
1463
+ case 124: goto st17;
1464
+ case 126: goto st17;
1465
+ }
1466
+ if ( (*p) < 45 ) {
1467
+ if ( (*p) > 39 ) {
1468
+ if ( 42 <= (*p) && (*p) <= 43 )
1469
+ goto st17;
1470
+ } else if ( (*p) >= 35 )
1471
+ goto st17;
1472
+ } else if ( (*p) > 46 ) {
1473
+ if ( (*p) < 65 ) {
1474
+ if ( 48 <= (*p) && (*p) <= 57 )
1475
+ goto st17;
1476
+ } else if ( (*p) > 90 ) {
1477
+ if ( 94 <= (*p) && (*p) <= 122 )
1478
+ goto st17;
1479
+ } else
1480
+ goto st17;
1481
+ } else
1482
+ goto st17;
1483
+ goto st0;
1484
+ st63:
1485
+ if ( ++p == pe )
1486
+ goto _test_eof63;
1487
+ case 63:
1488
+ switch( (*p) ) {
1489
+ case 33: goto st17;
1490
+ case 58: goto tr25;
1491
+ case 67: goto st40;
1492
+ case 78: goto st64;
1493
+ case 99: goto st40;
1494
+ case 110: goto st64;
1495
+ case 124: goto st17;
1496
+ case 126: goto st17;
1497
+ }
1498
+ if ( (*p) < 45 ) {
1499
+ if ( (*p) > 39 ) {
1500
+ if ( 42 <= (*p) && (*p) <= 43 )
1501
+ goto st17;
1502
+ } else if ( (*p) >= 35 )
1503
+ goto st17;
1504
+ } else if ( (*p) > 46 ) {
1505
+ if ( (*p) < 65 ) {
1506
+ if ( 48 <= (*p) && (*p) <= 57 )
1507
+ goto st17;
1508
+ } else if ( (*p) > 90 ) {
1509
+ if ( 94 <= (*p) && (*p) <= 122 )
1510
+ goto st17;
1511
+ } else
1512
+ goto st17;
1513
+ } else
1514
+ goto st17;
1515
+ goto st0;
1516
+ st64:
1517
+ if ( ++p == pe )
1518
+ goto _test_eof64;
1519
+ case 64:
1520
+ switch( (*p) ) {
1521
+ case 33: goto st17;
1522
+ case 58: goto tr25;
1523
+ case 67: goto st40;
1524
+ case 84: goto st65;
1525
+ case 99: goto st40;
1526
+ case 116: goto st65;
1527
+ case 124: goto st17;
1528
+ case 126: goto st17;
1529
+ }
1530
+ if ( (*p) < 45 ) {
1531
+ if ( (*p) > 39 ) {
1532
+ if ( 42 <= (*p) && (*p) <= 43 )
1533
+ goto st17;
1534
+ } else if ( (*p) >= 35 )
1535
+ goto st17;
1536
+ } else if ( (*p) > 46 ) {
1537
+ if ( (*p) < 65 ) {
1538
+ if ( 48 <= (*p) && (*p) <= 57 )
1539
+ goto st17;
1540
+ } else if ( (*p) > 90 ) {
1541
+ if ( 94 <= (*p) && (*p) <= 122 )
1542
+ goto st17;
1543
+ } else
1544
+ goto st17;
1545
+ } else
1546
+ goto st17;
1547
+ goto st0;
1548
+ st65:
1549
+ if ( ++p == pe )
1550
+ goto _test_eof65;
1551
+ case 65:
1552
+ switch( (*p) ) {
1553
+ case 33: goto st17;
1554
+ case 45: goto st66;
1555
+ case 46: goto st17;
1556
+ case 58: goto tr25;
1557
+ case 67: goto st40;
1558
+ case 99: goto st40;
1559
+ case 124: goto st17;
1560
+ case 126: goto st17;
1561
+ }
1562
+ if ( (*p) < 48 ) {
1563
+ if ( (*p) > 39 ) {
1564
+ if ( 42 <= (*p) && (*p) <= 43 )
1565
+ goto st17;
1566
+ } else if ( (*p) >= 35 )
1567
+ goto st17;
1568
+ } else if ( (*p) > 57 ) {
1569
+ if ( (*p) > 90 ) {
1570
+ if ( 94 <= (*p) && (*p) <= 122 )
1571
+ goto st17;
1572
+ } else if ( (*p) >= 65 )
1573
+ goto st17;
1574
+ } else
1575
+ goto st17;
1576
+ goto st0;
1577
+ st66:
1578
+ if ( ++p == pe )
1579
+ goto _test_eof66;
1580
+ case 66:
1581
+ switch( (*p) ) {
1582
+ case 33: goto st17;
1583
+ case 58: goto tr25;
1584
+ case 67: goto st40;
1585
+ case 76: goto st67;
1586
+ case 84: goto st75;
1587
+ case 99: goto st40;
1588
+ case 108: goto st67;
1589
+ case 116: goto st75;
1590
+ case 124: goto st17;
1591
+ case 126: goto st17;
1592
+ }
1593
+ if ( (*p) < 45 ) {
1594
+ if ( (*p) > 39 ) {
1595
+ if ( 42 <= (*p) && (*p) <= 43 )
1596
+ goto st17;
1597
+ } else if ( (*p) >= 35 )
1598
+ goto st17;
1599
+ } else if ( (*p) > 46 ) {
1600
+ if ( (*p) < 65 ) {
1601
+ if ( 48 <= (*p) && (*p) <= 57 )
1602
+ goto st17;
1603
+ } else if ( (*p) > 90 ) {
1604
+ if ( 94 <= (*p) && (*p) <= 122 )
1605
+ goto st17;
1606
+ } else
1607
+ goto st17;
1608
+ } else
1609
+ goto st17;
1610
+ goto st0;
1611
+ st67:
1612
+ if ( ++p == pe )
1613
+ goto _test_eof67;
1614
+ case 67:
1615
+ switch( (*p) ) {
1616
+ case 33: goto st17;
1617
+ case 58: goto tr25;
1618
+ case 67: goto st40;
1619
+ case 69: goto st68;
1620
+ case 99: goto st40;
1621
+ case 101: goto st68;
1622
+ case 124: goto st17;
1623
+ case 126: goto st17;
1624
+ }
1625
+ if ( (*p) < 45 ) {
1626
+ if ( (*p) > 39 ) {
1627
+ if ( 42 <= (*p) && (*p) <= 43 )
1628
+ goto st17;
1629
+ } else if ( (*p) >= 35 )
1630
+ goto st17;
1631
+ } else if ( (*p) > 46 ) {
1632
+ if ( (*p) < 65 ) {
1633
+ if ( 48 <= (*p) && (*p) <= 57 )
1634
+ goto st17;
1635
+ } else if ( (*p) > 90 ) {
1636
+ if ( 94 <= (*p) && (*p) <= 122 )
1637
+ goto st17;
1638
+ } else
1639
+ goto st17;
1640
+ } else
1641
+ goto st17;
1642
+ goto st0;
1643
+ st68:
1644
+ if ( ++p == pe )
1645
+ goto _test_eof68;
1646
+ case 68:
679
1647
  switch( (*p) ) {
680
1648
  case 33: goto st17;
681
1649
  case 58: goto tr25;
682
- case 84: goto st26;
683
- case 116: goto st26;
1650
+ case 67: goto st40;
1651
+ case 78: goto st69;
1652
+ case 99: goto st40;
1653
+ case 110: goto st69;
684
1654
  case 124: goto st17;
685
1655
  case 126: goto st17;
686
1656
  }
@@ -702,42 +1672,49 @@ case 25:
702
1672
  } else
703
1673
  goto st17;
704
1674
  goto st0;
705
- st26:
1675
+ st69:
706
1676
  if ( ++p == pe )
707
- goto _test_eof26;
708
- case 26:
1677
+ goto _test_eof69;
1678
+ case 69:
709
1679
  switch( (*p) ) {
710
1680
  case 33: goto st17;
711
- case 45: goto st27;
712
- case 46: goto st17;
713
1681
  case 58: goto tr25;
1682
+ case 67: goto st40;
1683
+ case 71: goto st70;
1684
+ case 99: goto st40;
1685
+ case 103: goto st70;
714
1686
  case 124: goto st17;
715
1687
  case 126: goto st17;
716
1688
  }
717
- if ( (*p) < 48 ) {
1689
+ if ( (*p) < 45 ) {
718
1690
  if ( (*p) > 39 ) {
719
1691
  if ( 42 <= (*p) && (*p) <= 43 )
720
1692
  goto st17;
721
1693
  } else if ( (*p) >= 35 )
722
1694
  goto st17;
723
- } else if ( (*p) > 57 ) {
724
- if ( (*p) > 90 ) {
1695
+ } else if ( (*p) > 46 ) {
1696
+ if ( (*p) < 65 ) {
1697
+ if ( 48 <= (*p) && (*p) <= 57 )
1698
+ goto st17;
1699
+ } else if ( (*p) > 90 ) {
725
1700
  if ( 94 <= (*p) && (*p) <= 122 )
726
1701
  goto st17;
727
- } else if ( (*p) >= 65 )
1702
+ } else
728
1703
  goto st17;
729
1704
  } else
730
1705
  goto st17;
731
1706
  goto st0;
732
- st27:
1707
+ st70:
733
1708
  if ( ++p == pe )
734
- goto _test_eof27;
735
- case 27:
1709
+ goto _test_eof70;
1710
+ case 70:
736
1711
  switch( (*p) ) {
737
1712
  case 33: goto st17;
738
1713
  case 58: goto tr25;
739
- case 76: goto st28;
740
- case 108: goto st28;
1714
+ case 67: goto st40;
1715
+ case 84: goto st71;
1716
+ case 99: goto st40;
1717
+ case 116: goto st71;
741
1718
  case 124: goto st17;
742
1719
  case 126: goto st17;
743
1720
  }
@@ -759,15 +1736,17 @@ case 27:
759
1736
  } else
760
1737
  goto st17;
761
1738
  goto st0;
762
- st28:
1739
+ st71:
763
1740
  if ( ++p == pe )
764
- goto _test_eof28;
765
- case 28:
1741
+ goto _test_eof71;
1742
+ case 71:
766
1743
  switch( (*p) ) {
767
1744
  case 33: goto st17;
768
1745
  case 58: goto tr25;
769
- case 69: goto st29;
770
- case 101: goto st29;
1746
+ case 67: goto st40;
1747
+ case 72: goto st72;
1748
+ case 99: goto st40;
1749
+ case 104: goto st72;
771
1750
  case 124: goto st17;
772
1751
  case 126: goto st17;
773
1752
  }
@@ -789,15 +1768,15 @@ case 28:
789
1768
  } else
790
1769
  goto st17;
791
1770
  goto st0;
792
- st29:
1771
+ st72:
793
1772
  if ( ++p == pe )
794
- goto _test_eof29;
795
- case 29:
1773
+ goto _test_eof72;
1774
+ case 72:
796
1775
  switch( (*p) ) {
797
1776
  case 33: goto st17;
798
- case 58: goto tr25;
799
- case 78: goto st30;
800
- case 110: goto st30;
1777
+ case 58: goto tr88;
1778
+ case 67: goto st40;
1779
+ case 99: goto st40;
801
1780
  case 124: goto st17;
802
1781
  case 126: goto st17;
803
1782
  }
@@ -819,15 +1798,64 @@ case 29:
819
1798
  } else
820
1799
  goto st17;
821
1800
  goto st0;
822
- st30:
1801
+ tr88:
1802
+ #line 24 "src/parser.rl"
1803
+ {
1804
+ parser->field_len = LEN(field_start, p);
1805
+ if(parser->field_len > 256) {
1806
+ parser->overflow_error = TRUE;
1807
+ {p++; cs = 73; goto _out;}
1808
+ }
1809
+ }
1810
+ goto st73;
1811
+ tr89:
1812
+ #line 32 "src/parser.rl"
1813
+ { MARK(mark, p); }
1814
+ goto st73;
1815
+ st73:
823
1816
  if ( ++p == pe )
824
- goto _test_eof30;
825
- case 30:
1817
+ goto _test_eof73;
1818
+ case 73:
1819
+ #line 1820 "src/parser.c"
1820
+ switch( (*p) ) {
1821
+ case 13: goto tr28;
1822
+ case 32: goto tr89;
1823
+ case 67: goto tr30;
1824
+ case 99: goto tr30;
1825
+ }
1826
+ if ( 48 <= (*p) && (*p) <= 57 )
1827
+ goto tr90;
1828
+ goto tr27;
1829
+ tr90:
1830
+ #line 21 "src/parser.rl"
1831
+ {MARK(mark, p); }
1832
+ #line 32 "src/parser.rl"
1833
+ { MARK(mark, p); }
1834
+ goto st74;
1835
+ st74:
1836
+ if ( ++p == pe )
1837
+ goto _test_eof74;
1838
+ case 74:
1839
+ #line 1840 "src/parser.c"
1840
+ switch( (*p) ) {
1841
+ case 13: goto tr91;
1842
+ case 67: goto st20;
1843
+ case 99: goto st20;
1844
+ }
1845
+ if ( 48 <= (*p) && (*p) <= 57 )
1846
+ goto st74;
1847
+ goto st19;
1848
+ st75:
1849
+ if ( ++p == pe )
1850
+ goto _test_eof75;
1851
+ case 75:
826
1852
  switch( (*p) ) {
827
1853
  case 33: goto st17;
828
1854
  case 58: goto tr25;
829
- case 71: goto st31;
830
- case 103: goto st31;
1855
+ case 67: goto st40;
1856
+ case 89: goto st76;
1857
+ case 99: goto st40;
1858
+ case 121: goto st76;
831
1859
  case 124: goto st17;
832
1860
  case 126: goto st17;
833
1861
  }
@@ -849,15 +1877,17 @@ case 30:
849
1877
  } else
850
1878
  goto st17;
851
1879
  goto st0;
852
- st31:
1880
+ st76:
853
1881
  if ( ++p == pe )
854
- goto _test_eof31;
855
- case 31:
1882
+ goto _test_eof76;
1883
+ case 76:
856
1884
  switch( (*p) ) {
857
1885
  case 33: goto st17;
858
1886
  case 58: goto tr25;
859
- case 84: goto st32;
860
- case 116: goto st32;
1887
+ case 67: goto st40;
1888
+ case 80: goto st77;
1889
+ case 99: goto st40;
1890
+ case 112: goto st77;
861
1891
  case 124: goto st17;
862
1892
  case 126: goto st17;
863
1893
  }
@@ -879,15 +1909,17 @@ case 31:
879
1909
  } else
880
1910
  goto st17;
881
1911
  goto st0;
882
- st32:
1912
+ st77:
883
1913
  if ( ++p == pe )
884
- goto _test_eof32;
885
- case 32:
1914
+ goto _test_eof77;
1915
+ case 77:
886
1916
  switch( (*p) ) {
887
1917
  case 33: goto st17;
888
1918
  case 58: goto tr25;
889
- case 72: goto st33;
890
- case 104: goto st33;
1919
+ case 67: goto st40;
1920
+ case 69: goto st78;
1921
+ case 99: goto st40;
1922
+ case 101: goto st78;
891
1923
  case 124: goto st17;
892
1924
  case 126: goto st17;
893
1925
  }
@@ -909,13 +1941,15 @@ case 32:
909
1941
  } else
910
1942
  goto st17;
911
1943
  goto st0;
912
- st33:
1944
+ st78:
913
1945
  if ( ++p == pe )
914
- goto _test_eof33;
915
- case 33:
1946
+ goto _test_eof78;
1947
+ case 78:
916
1948
  switch( (*p) ) {
917
1949
  case 33: goto st17;
918
- case 58: goto tr44;
1950
+ case 58: goto st79;
1951
+ case 67: goto st40;
1952
+ case 99: goto st40;
919
1953
  case 124: goto st17;
920
1954
  case 126: goto st17;
921
1955
  }
@@ -937,129 +1971,85 @@ case 33:
937
1971
  } else
938
1972
  goto st17;
939
1973
  goto st0;
940
- tr44:
941
- #line 25 "src/parser.rl"
942
- {
943
- parser->field_len = LEN(field_start, p);
944
- if(parser->field_len > 256) {
945
- parser->overflow_error = TRUE;
946
- {p++; cs = 34; goto _out;}
947
- }
948
- }
949
- goto st34;
950
- tr45:
951
- #line 33 "src/parser.rl"
952
- { MARK(mark, p); }
953
- goto st34;
954
- st34:
1974
+ tr99:
1975
+ #line 21 "src/parser.rl"
1976
+ {MARK(mark, p); }
1977
+ goto st79;
1978
+ st79:
955
1979
  if ( ++p == pe )
956
- goto _test_eof34;
957
- case 34:
958
- #line 959 "src/parser.c"
1980
+ goto _test_eof79;
1981
+ case 79:
1982
+ #line 1983 "src/parser.c"
959
1983
  switch( (*p) ) {
960
- case 13: goto tr27;
961
- case 32: goto tr45;
1984
+ case 13: goto tr98;
1985
+ case 32: goto tr99;
962
1986
  }
963
- if ( 48 <= (*p) && (*p) <= 57 )
964
- goto tr46;
965
- goto tr26;
966
- tr46:
967
- #line 22 "src/parser.rl"
1987
+ goto tr97;
1988
+ tr97:
1989
+ #line 21 "src/parser.rl"
968
1990
  {MARK(mark, p); }
969
- #line 33 "src/parser.rl"
970
- { MARK(mark, p); }
971
- goto st35;
972
- st35:
1991
+ goto st80;
1992
+ st80:
973
1993
  if ( ++p == pe )
974
- goto _test_eof35;
975
- case 35:
976
- #line 977 "src/parser.c"
1994
+ goto _test_eof80;
1995
+ case 80:
1996
+ #line 1997 "src/parser.c"
977
1997
  if ( (*p) == 13 )
978
- goto tr47;
979
- if ( 48 <= (*p) && (*p) <= 57 )
980
- goto st35;
981
- goto st19;
1998
+ goto tr101;
1999
+ goto st80;
982
2000
  tr9:
983
- #line 55 "src/parser.rl"
2001
+ #line 71 "src/parser.rl"
984
2002
  {
985
- if(LEN(mark, p) > 12 * 1024) {
986
- parser->overflow_error = TRUE;
987
- {p++; cs = 36; goto _out;}
988
- }
989
- if(parser->request_uri != NULL)
990
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
2003
+ if(!apply_element(parser, MONGREL_REQUEST_URI, PTR_TO(mark), p, 12*1024))
2004
+ {p++; cs = 81; goto _out;}
991
2005
  }
992
- goto st36;
993
- tr62:
994
- #line 79 "src/parser.rl"
2006
+ goto st81;
2007
+ tr115:
2008
+ #line 61 "src/parser.rl"
995
2009
  {
996
- if(LEN(mark, p) > 1024) {
997
- parser->overflow_error = TRUE;
998
- {p++; cs = 36; goto _out;}
999
- }
1000
- if(parser->request_path != NULL)
1001
- parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
2010
+ if(!apply_element(parser, MONGREL_REQUEST_PATH, PTR_TO(mark), p, 1024))
2011
+ {p++; cs = 81; goto _out;}
1002
2012
  }
1003
- #line 55 "src/parser.rl"
2013
+ #line 71 "src/parser.rl"
1004
2014
  {
1005
- if(LEN(mark, p) > 12 * 1024) {
1006
- parser->overflow_error = TRUE;
1007
- {p++; cs = 36; goto _out;}
1008
- }
1009
- if(parser->request_uri != NULL)
1010
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
2015
+ if(!apply_element(parser, MONGREL_REQUEST_URI, PTR_TO(mark), p, 12*1024))
2016
+ {p++; cs = 81; goto _out;}
1011
2017
  }
1012
- goto st36;
1013
- tr73:
1014
- #line 64 "src/parser.rl"
2018
+ goto st81;
2019
+ tr126:
2020
+ #line 76 "src/parser.rl"
1015
2021
  {MARK(query_start, p); }
1016
- #line 65 "src/parser.rl"
1017
- {
1018
- if(LEN(query_start, p) > 10 * 1024) {
1019
- parser->overflow_error = TRUE;
1020
- {p++; cs = 36; goto _out;}
1021
- }
1022
- if(parser->query_string != NULL)
1023
- parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
2022
+ #line 77 "src/parser.rl"
2023
+ {
2024
+ if(!apply_element(parser, MONGREL_QUERY_STRING, PTR_TO(query_start), p, 10*1024))
2025
+ {p++; cs = 81; goto _out;}
1024
2026
  }
1025
- #line 55 "src/parser.rl"
2027
+ #line 71 "src/parser.rl"
1026
2028
  {
1027
- if(LEN(mark, p) > 12 * 1024) {
1028
- parser->overflow_error = TRUE;
1029
- {p++; cs = 36; goto _out;}
1030
- }
1031
- if(parser->request_uri != NULL)
1032
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
2029
+ if(!apply_element(parser, MONGREL_REQUEST_URI, PTR_TO(mark), p, 12*1024))
2030
+ {p++; cs = 81; goto _out;}
1033
2031
  }
1034
- goto st36;
1035
- tr77:
1036
- #line 65 "src/parser.rl"
1037
- {
1038
- if(LEN(query_start, p) > 10 * 1024) {
1039
- parser->overflow_error = TRUE;
1040
- {p++; cs = 36; goto _out;}
1041
- }
1042
- if(parser->query_string != NULL)
1043
- parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
2032
+ goto st81;
2033
+ tr130:
2034
+ #line 77 "src/parser.rl"
2035
+ {
2036
+ if(!apply_element(parser, MONGREL_QUERY_STRING, PTR_TO(query_start), p, 10*1024))
2037
+ {p++; cs = 81; goto _out;}
1044
2038
  }
1045
- #line 55 "src/parser.rl"
2039
+ #line 71 "src/parser.rl"
1046
2040
  {
1047
- if(LEN(mark, p) > 12 * 1024) {
1048
- parser->overflow_error = TRUE;
1049
- {p++; cs = 36; goto _out;}
1050
- }
1051
- if(parser->request_uri != NULL)
1052
- parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
2041
+ if(!apply_element(parser, MONGREL_REQUEST_URI, PTR_TO(mark), p, 12*1024))
2042
+ {p++; cs = 81; goto _out;}
1053
2043
  }
1054
- goto st36;
1055
- st36:
2044
+ goto st81;
2045
+ st81:
1056
2046
  if ( ++p == pe )
1057
- goto _test_eof36;
1058
- case 36:
1059
- #line 1060 "src/parser.c"
2047
+ goto _test_eof81;
2048
+ case 81:
2049
+ #line 2050 "src/parser.c"
1060
2050
  switch( (*p) ) {
1061
- case 32: goto tr50;
1062
- case 37: goto tr51;
2051
+ case 32: goto tr103;
2052
+ case 37: goto tr104;
1063
2053
  case 60: goto st0;
1064
2054
  case 62: goto st0;
1065
2055
  case 127: goto st0;
@@ -1069,19 +2059,19 @@ case 36:
1069
2059
  goto st0;
1070
2060
  } else if ( (*p) >= 0 )
1071
2061
  goto st0;
1072
- goto tr49;
1073
- tr49:
1074
- #line 22 "src/parser.rl"
2062
+ goto tr102;
2063
+ tr102:
2064
+ #line 21 "src/parser.rl"
1075
2065
  {MARK(mark, p); }
1076
- goto st37;
1077
- st37:
2066
+ goto st82;
2067
+ st82:
1078
2068
  if ( ++p == pe )
1079
- goto _test_eof37;
1080
- case 37:
1081
- #line 1082 "src/parser.c"
2069
+ goto _test_eof82;
2070
+ case 82:
2071
+ #line 2072 "src/parser.c"
1082
2072
  switch( (*p) ) {
1083
- case 32: goto tr53;
1084
- case 37: goto st38;
2073
+ case 32: goto tr106;
2074
+ case 37: goto st83;
1085
2075
  case 60: goto st0;
1086
2076
  case 62: goto st0;
1087
2077
  case 127: goto st0;
@@ -1091,622 +2081,614 @@ case 37:
1091
2081
  goto st0;
1092
2082
  } else if ( (*p) >= 0 )
1093
2083
  goto st0;
1094
- goto st37;
1095
- tr51:
1096
- #line 22 "src/parser.rl"
2084
+ goto st82;
2085
+ tr104:
2086
+ #line 21 "src/parser.rl"
1097
2087
  {MARK(mark, p); }
1098
- goto st38;
1099
- st38:
2088
+ goto st83;
2089
+ st83:
1100
2090
  if ( ++p == pe )
1101
- goto _test_eof38;
1102
- case 38:
1103
- #line 1104 "src/parser.c"
2091
+ goto _test_eof83;
2092
+ case 83:
2093
+ #line 2094 "src/parser.c"
1104
2094
  if ( (*p) < 65 ) {
1105
2095
  if ( 48 <= (*p) && (*p) <= 57 )
1106
- goto st39;
2096
+ goto st84;
1107
2097
  } else if ( (*p) > 70 ) {
1108
2098
  if ( 97 <= (*p) && (*p) <= 102 )
1109
- goto st39;
2099
+ goto st84;
1110
2100
  } else
1111
- goto st39;
2101
+ goto st84;
1112
2102
  goto st0;
1113
- st39:
2103
+ st84:
1114
2104
  if ( ++p == pe )
1115
- goto _test_eof39;
1116
- case 39:
2105
+ goto _test_eof84;
2106
+ case 84:
1117
2107
  if ( (*p) < 65 ) {
1118
2108
  if ( 48 <= (*p) && (*p) <= 57 )
1119
- goto st37;
2109
+ goto st82;
1120
2110
  } else if ( (*p) > 70 ) {
1121
2111
  if ( 97 <= (*p) && (*p) <= 102 )
1122
- goto st37;
2112
+ goto st82;
1123
2113
  } else
1124
- goto st37;
2114
+ goto st82;
1125
2115
  goto st0;
1126
2116
  tr5:
1127
- #line 22 "src/parser.rl"
2117
+ #line 21 "src/parser.rl"
1128
2118
  {MARK(mark, p); }
1129
- goto st40;
1130
- st40:
2119
+ goto st85;
2120
+ st85:
1131
2121
  if ( ++p == pe )
1132
- goto _test_eof40;
1133
- case 40:
1134
- #line 1135 "src/parser.c"
2122
+ goto _test_eof85;
2123
+ case 85:
2124
+ #line 2125 "src/parser.c"
1135
2125
  switch( (*p) ) {
1136
- case 43: goto st40;
1137
- case 58: goto st41;
2126
+ case 43: goto st85;
2127
+ case 58: goto st86;
1138
2128
  }
1139
2129
  if ( (*p) < 48 ) {
1140
2130
  if ( 45 <= (*p) && (*p) <= 46 )
1141
- goto st40;
2131
+ goto st85;
1142
2132
  } else if ( (*p) > 57 ) {
1143
2133
  if ( (*p) > 90 ) {
1144
2134
  if ( 97 <= (*p) && (*p) <= 122 )
1145
- goto st40;
2135
+ goto st85;
1146
2136
  } else if ( (*p) >= 65 )
1147
- goto st40;
2137
+ goto st85;
1148
2138
  } else
1149
- goto st40;
2139
+ goto st85;
1150
2140
  goto st0;
1151
2141
  tr7:
1152
- #line 22 "src/parser.rl"
2142
+ #line 21 "src/parser.rl"
1153
2143
  {MARK(mark, p); }
1154
- goto st41;
1155
- st41:
2144
+ goto st86;
2145
+ st86:
1156
2146
  if ( ++p == pe )
1157
- goto _test_eof41;
1158
- case 41:
1159
- #line 1160 "src/parser.c"
2147
+ goto _test_eof86;
2148
+ case 86:
2149
+ #line 2150 "src/parser.c"
1160
2150
  switch( (*p) ) {
1161
2151
  case 32: goto tr8;
1162
2152
  case 34: goto st0;
1163
2153
  case 35: goto tr9;
1164
- case 37: goto st42;
2154
+ case 37: goto st87;
1165
2155
  case 60: goto st0;
1166
2156
  case 62: goto st0;
1167
2157
  case 127: goto st0;
1168
2158
  }
1169
2159
  if ( 0 <= (*p) && (*p) <= 31 )
1170
2160
  goto st0;
1171
- goto st41;
1172
- st42:
2161
+ goto st86;
2162
+ st87:
1173
2163
  if ( ++p == pe )
1174
- goto _test_eof42;
1175
- case 42:
2164
+ goto _test_eof87;
2165
+ case 87:
1176
2166
  if ( (*p) < 65 ) {
1177
2167
  if ( 48 <= (*p) && (*p) <= 57 )
1178
- goto st43;
2168
+ goto st88;
1179
2169
  } else if ( (*p) > 70 ) {
1180
2170
  if ( 97 <= (*p) && (*p) <= 102 )
1181
- goto st43;
2171
+ goto st88;
1182
2172
  } else
1183
- goto st43;
2173
+ goto st88;
1184
2174
  goto st0;
1185
- st43:
2175
+ st88:
1186
2176
  if ( ++p == pe )
1187
- goto _test_eof43;
1188
- case 43:
2177
+ goto _test_eof88;
2178
+ case 88:
1189
2179
  if ( (*p) < 65 ) {
1190
2180
  if ( 48 <= (*p) && (*p) <= 57 )
1191
- goto st41;
2181
+ goto st86;
1192
2182
  } else if ( (*p) > 70 ) {
1193
2183
  if ( 97 <= (*p) && (*p) <= 102 )
1194
- goto st41;
2184
+ goto st86;
1195
2185
  } else
1196
- goto st41;
2186
+ goto st86;
1197
2187
  goto st0;
1198
2188
  tr6:
1199
- #line 22 "src/parser.rl"
2189
+ #line 21 "src/parser.rl"
1200
2190
  {MARK(mark, p); }
1201
- goto st44;
1202
- st44:
2191
+ goto st89;
2192
+ st89:
1203
2193
  if ( ++p == pe )
1204
- goto _test_eof44;
1205
- case 44:
1206
- #line 1207 "src/parser.c"
2194
+ goto _test_eof89;
2195
+ case 89:
2196
+ #line 2197 "src/parser.c"
1207
2197
  switch( (*p) ) {
1208
- case 32: goto tr61;
2198
+ case 32: goto tr114;
1209
2199
  case 34: goto st0;
1210
- case 35: goto tr62;
1211
- case 37: goto st45;
1212
- case 59: goto tr64;
2200
+ case 35: goto tr115;
2201
+ case 37: goto st90;
2202
+ case 59: goto tr117;
1213
2203
  case 60: goto st0;
1214
2204
  case 62: goto st0;
1215
- case 63: goto tr65;
2205
+ case 63: goto tr118;
1216
2206
  case 127: goto st0;
1217
2207
  }
1218
2208
  if ( 0 <= (*p) && (*p) <= 31 )
1219
2209
  goto st0;
1220
- goto st44;
1221
- st45:
2210
+ goto st89;
2211
+ st90:
1222
2212
  if ( ++p == pe )
1223
- goto _test_eof45;
1224
- case 45:
2213
+ goto _test_eof90;
2214
+ case 90:
1225
2215
  if ( (*p) < 65 ) {
1226
2216
  if ( 48 <= (*p) && (*p) <= 57 )
1227
- goto st46;
2217
+ goto st91;
1228
2218
  } else if ( (*p) > 70 ) {
1229
2219
  if ( 97 <= (*p) && (*p) <= 102 )
1230
- goto st46;
2220
+ goto st91;
1231
2221
  } else
1232
- goto st46;
2222
+ goto st91;
1233
2223
  goto st0;
1234
- st46:
2224
+ st91:
1235
2225
  if ( ++p == pe )
1236
- goto _test_eof46;
1237
- case 46:
2226
+ goto _test_eof91;
2227
+ case 91:
1238
2228
  if ( (*p) < 65 ) {
1239
2229
  if ( 48 <= (*p) && (*p) <= 57 )
1240
- goto st44;
2230
+ goto st89;
1241
2231
  } else if ( (*p) > 70 ) {
1242
2232
  if ( 97 <= (*p) && (*p) <= 102 )
1243
- goto st44;
2233
+ goto st89;
1244
2234
  } else
1245
- goto st44;
2235
+ goto st89;
1246
2236
  goto st0;
1247
- tr64:
1248
- #line 79 "src/parser.rl"
2237
+ tr117:
2238
+ #line 61 "src/parser.rl"
1249
2239
  {
1250
- if(LEN(mark, p) > 1024) {
1251
- parser->overflow_error = TRUE;
1252
- {p++; cs = 47; goto _out;}
1253
- }
1254
- if(parser->request_path != NULL)
1255
- parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
2240
+ if(!apply_element(parser, MONGREL_REQUEST_PATH, PTR_TO(mark), p, 1024))
2241
+ {p++; cs = 92; goto _out;}
1256
2242
  }
1257
- goto st47;
1258
- st47:
2243
+ goto st92;
2244
+ st92:
1259
2245
  if ( ++p == pe )
1260
- goto _test_eof47;
1261
- case 47:
1262
- #line 1263 "src/parser.c"
2246
+ goto _test_eof92;
2247
+ case 92:
2248
+ #line 2249 "src/parser.c"
1263
2249
  switch( (*p) ) {
1264
2250
  case 32: goto tr8;
1265
2251
  case 34: goto st0;
1266
2252
  case 35: goto tr9;
1267
- case 37: goto st48;
2253
+ case 37: goto st93;
1268
2254
  case 60: goto st0;
1269
2255
  case 62: goto st0;
1270
- case 63: goto st50;
2256
+ case 63: goto st95;
1271
2257
  case 127: goto st0;
1272
2258
  }
1273
2259
  if ( 0 <= (*p) && (*p) <= 31 )
1274
2260
  goto st0;
1275
- goto st47;
1276
- st48:
2261
+ goto st92;
2262
+ st93:
1277
2263
  if ( ++p == pe )
1278
- goto _test_eof48;
1279
- case 48:
2264
+ goto _test_eof93;
2265
+ case 93:
1280
2266
  if ( (*p) < 65 ) {
1281
2267
  if ( 48 <= (*p) && (*p) <= 57 )
1282
- goto st49;
2268
+ goto st94;
1283
2269
  } else if ( (*p) > 70 ) {
1284
2270
  if ( 97 <= (*p) && (*p) <= 102 )
1285
- goto st49;
2271
+ goto st94;
1286
2272
  } else
1287
- goto st49;
2273
+ goto st94;
1288
2274
  goto st0;
1289
- st49:
2275
+ st94:
1290
2276
  if ( ++p == pe )
1291
- goto _test_eof49;
1292
- case 49:
2277
+ goto _test_eof94;
2278
+ case 94:
1293
2279
  if ( (*p) < 65 ) {
1294
2280
  if ( 48 <= (*p) && (*p) <= 57 )
1295
- goto st47;
2281
+ goto st92;
1296
2282
  } else if ( (*p) > 70 ) {
1297
2283
  if ( 97 <= (*p) && (*p) <= 102 )
1298
- goto st47;
2284
+ goto st92;
1299
2285
  } else
1300
- goto st47;
2286
+ goto st92;
1301
2287
  goto st0;
1302
- tr65:
1303
- #line 79 "src/parser.rl"
2288
+ tr118:
2289
+ #line 61 "src/parser.rl"
1304
2290
  {
1305
- if(LEN(mark, p) > 1024) {
1306
- parser->overflow_error = TRUE;
1307
- {p++; cs = 50; goto _out;}
1308
- }
1309
- if(parser->request_path != NULL)
1310
- parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
2291
+ if(!apply_element(parser, MONGREL_REQUEST_PATH, PTR_TO(mark), p, 1024))
2292
+ {p++; cs = 95; goto _out;}
1311
2293
  }
1312
- goto st50;
1313
- st50:
2294
+ goto st95;
2295
+ st95:
1314
2296
  if ( ++p == pe )
1315
- goto _test_eof50;
1316
- case 50:
1317
- #line 1318 "src/parser.c"
2297
+ goto _test_eof95;
2298
+ case 95:
2299
+ #line 2300 "src/parser.c"
1318
2300
  switch( (*p) ) {
1319
- case 32: goto tr72;
2301
+ case 32: goto tr125;
1320
2302
  case 34: goto st0;
1321
- case 35: goto tr73;
1322
- case 37: goto tr74;
2303
+ case 35: goto tr126;
2304
+ case 37: goto tr127;
1323
2305
  case 60: goto st0;
1324
2306
  case 62: goto st0;
1325
2307
  case 127: goto st0;
1326
2308
  }
1327
2309
  if ( 0 <= (*p) && (*p) <= 31 )
1328
2310
  goto st0;
1329
- goto tr71;
1330
- tr71:
1331
- #line 64 "src/parser.rl"
2311
+ goto tr124;
2312
+ tr124:
2313
+ #line 76 "src/parser.rl"
1332
2314
  {MARK(query_start, p); }
1333
- goto st51;
1334
- st51:
2315
+ goto st96;
2316
+ st96:
1335
2317
  if ( ++p == pe )
1336
- goto _test_eof51;
1337
- case 51:
1338
- #line 1339 "src/parser.c"
2318
+ goto _test_eof96;
2319
+ case 96:
2320
+ #line 2321 "src/parser.c"
1339
2321
  switch( (*p) ) {
1340
- case 32: goto tr76;
2322
+ case 32: goto tr129;
1341
2323
  case 34: goto st0;
1342
- case 35: goto tr77;
1343
- case 37: goto st52;
2324
+ case 35: goto tr130;
2325
+ case 37: goto st97;
1344
2326
  case 60: goto st0;
1345
2327
  case 62: goto st0;
1346
2328
  case 127: goto st0;
1347
2329
  }
1348
2330
  if ( 0 <= (*p) && (*p) <= 31 )
1349
2331
  goto st0;
1350
- goto st51;
1351
- tr74:
1352
- #line 64 "src/parser.rl"
2332
+ goto st96;
2333
+ tr127:
2334
+ #line 76 "src/parser.rl"
1353
2335
  {MARK(query_start, p); }
1354
- goto st52;
1355
- st52:
2336
+ goto st97;
2337
+ st97:
1356
2338
  if ( ++p == pe )
1357
- goto _test_eof52;
1358
- case 52:
1359
- #line 1360 "src/parser.c"
2339
+ goto _test_eof97;
2340
+ case 97:
2341
+ #line 2342 "src/parser.c"
1360
2342
  if ( (*p) < 65 ) {
1361
2343
  if ( 48 <= (*p) && (*p) <= 57 )
1362
- goto st53;
2344
+ goto st98;
1363
2345
  } else if ( (*p) > 70 ) {
1364
2346
  if ( 97 <= (*p) && (*p) <= 102 )
1365
- goto st53;
2347
+ goto st98;
1366
2348
  } else
1367
- goto st53;
2349
+ goto st98;
1368
2350
  goto st0;
1369
- st53:
2351
+ st98:
1370
2352
  if ( ++p == pe )
1371
- goto _test_eof53;
1372
- case 53:
2353
+ goto _test_eof98;
2354
+ case 98:
1373
2355
  if ( (*p) < 65 ) {
1374
2356
  if ( 48 <= (*p) && (*p) <= 57 )
1375
- goto st51;
2357
+ goto st96;
1376
2358
  } else if ( (*p) > 70 ) {
1377
2359
  if ( 97 <= (*p) && (*p) <= 102 )
1378
- goto st51;
2360
+ goto st96;
1379
2361
  } else
1380
- goto st51;
2362
+ goto st96;
1381
2363
  goto st0;
1382
- st54:
2364
+ st99:
1383
2365
  if ( ++p == pe )
1384
- goto _test_eof54;
1385
- case 54:
2366
+ goto _test_eof99;
2367
+ case 99:
1386
2368
  switch( (*p) ) {
1387
2369
  case 32: goto tr2;
1388
- case 36: goto st55;
1389
- case 95: goto st55;
2370
+ case 36: goto st100;
2371
+ case 95: goto st100;
1390
2372
  }
1391
2373
  if ( (*p) < 48 ) {
1392
2374
  if ( 45 <= (*p) && (*p) <= 46 )
1393
- goto st55;
2375
+ goto st100;
1394
2376
  } else if ( (*p) > 57 ) {
1395
2377
  if ( 65 <= (*p) && (*p) <= 90 )
1396
- goto st55;
2378
+ goto st100;
1397
2379
  } else
1398
- goto st55;
2380
+ goto st100;
1399
2381
  goto st0;
1400
- st55:
2382
+ st100:
1401
2383
  if ( ++p == pe )
1402
- goto _test_eof55;
1403
- case 55:
2384
+ goto _test_eof100;
2385
+ case 100:
1404
2386
  switch( (*p) ) {
1405
2387
  case 32: goto tr2;
1406
- case 36: goto st56;
1407
- case 95: goto st56;
2388
+ case 36: goto st101;
2389
+ case 95: goto st101;
1408
2390
  }
1409
2391
  if ( (*p) < 48 ) {
1410
2392
  if ( 45 <= (*p) && (*p) <= 46 )
1411
- goto st56;
2393
+ goto st101;
1412
2394
  } else if ( (*p) > 57 ) {
1413
2395
  if ( 65 <= (*p) && (*p) <= 90 )
1414
- goto st56;
2396
+ goto st101;
1415
2397
  } else
1416
- goto st56;
2398
+ goto st101;
1417
2399
  goto st0;
1418
- st56:
2400
+ st101:
1419
2401
  if ( ++p == pe )
1420
- goto _test_eof56;
1421
- case 56:
2402
+ goto _test_eof101;
2403
+ case 101:
1422
2404
  switch( (*p) ) {
1423
2405
  case 32: goto tr2;
1424
- case 36: goto st57;
1425
- case 95: goto st57;
2406
+ case 36: goto st102;
2407
+ case 95: goto st102;
1426
2408
  }
1427
2409
  if ( (*p) < 48 ) {
1428
2410
  if ( 45 <= (*p) && (*p) <= 46 )
1429
- goto st57;
2411
+ goto st102;
1430
2412
  } else if ( (*p) > 57 ) {
1431
2413
  if ( 65 <= (*p) && (*p) <= 90 )
1432
- goto st57;
2414
+ goto st102;
1433
2415
  } else
1434
- goto st57;
2416
+ goto st102;
1435
2417
  goto st0;
1436
- st57:
2418
+ st102:
1437
2419
  if ( ++p == pe )
1438
- goto _test_eof57;
1439
- case 57:
2420
+ goto _test_eof102;
2421
+ case 102:
1440
2422
  switch( (*p) ) {
1441
2423
  case 32: goto tr2;
1442
- case 36: goto st58;
1443
- case 95: goto st58;
2424
+ case 36: goto st103;
2425
+ case 95: goto st103;
1444
2426
  }
1445
2427
  if ( (*p) < 48 ) {
1446
2428
  if ( 45 <= (*p) && (*p) <= 46 )
1447
- goto st58;
2429
+ goto st103;
1448
2430
  } else if ( (*p) > 57 ) {
1449
2431
  if ( 65 <= (*p) && (*p) <= 90 )
1450
- goto st58;
2432
+ goto st103;
1451
2433
  } else
1452
- goto st58;
2434
+ goto st103;
1453
2435
  goto st0;
1454
- st58:
2436
+ st103:
1455
2437
  if ( ++p == pe )
1456
- goto _test_eof58;
1457
- case 58:
2438
+ goto _test_eof103;
2439
+ case 103:
1458
2440
  switch( (*p) ) {
1459
2441
  case 32: goto tr2;
1460
- case 36: goto st59;
1461
- case 95: goto st59;
2442
+ case 36: goto st104;
2443
+ case 95: goto st104;
1462
2444
  }
1463
2445
  if ( (*p) < 48 ) {
1464
2446
  if ( 45 <= (*p) && (*p) <= 46 )
1465
- goto st59;
2447
+ goto st104;
1466
2448
  } else if ( (*p) > 57 ) {
1467
2449
  if ( 65 <= (*p) && (*p) <= 90 )
1468
- goto st59;
2450
+ goto st104;
1469
2451
  } else
1470
- goto st59;
2452
+ goto st104;
1471
2453
  goto st0;
1472
- st59:
2454
+ st104:
1473
2455
  if ( ++p == pe )
1474
- goto _test_eof59;
1475
- case 59:
2456
+ goto _test_eof104;
2457
+ case 104:
1476
2458
  switch( (*p) ) {
1477
2459
  case 32: goto tr2;
1478
- case 36: goto st60;
1479
- case 95: goto st60;
2460
+ case 36: goto st105;
2461
+ case 95: goto st105;
1480
2462
  }
1481
2463
  if ( (*p) < 48 ) {
1482
2464
  if ( 45 <= (*p) && (*p) <= 46 )
1483
- goto st60;
2465
+ goto st105;
1484
2466
  } else if ( (*p) > 57 ) {
1485
2467
  if ( 65 <= (*p) && (*p) <= 90 )
1486
- goto st60;
2468
+ goto st105;
1487
2469
  } else
1488
- goto st60;
2470
+ goto st105;
1489
2471
  goto st0;
1490
- st60:
2472
+ st105:
1491
2473
  if ( ++p == pe )
1492
- goto _test_eof60;
1493
- case 60:
2474
+ goto _test_eof105;
2475
+ case 105:
1494
2476
  switch( (*p) ) {
1495
2477
  case 32: goto tr2;
1496
- case 36: goto st61;
1497
- case 95: goto st61;
2478
+ case 36: goto st106;
2479
+ case 95: goto st106;
1498
2480
  }
1499
2481
  if ( (*p) < 48 ) {
1500
2482
  if ( 45 <= (*p) && (*p) <= 46 )
1501
- goto st61;
2483
+ goto st106;
1502
2484
  } else if ( (*p) > 57 ) {
1503
2485
  if ( 65 <= (*p) && (*p) <= 90 )
1504
- goto st61;
2486
+ goto st106;
1505
2487
  } else
1506
- goto st61;
2488
+ goto st106;
1507
2489
  goto st0;
1508
- st61:
2490
+ st106:
1509
2491
  if ( ++p == pe )
1510
- goto _test_eof61;
1511
- case 61:
2492
+ goto _test_eof106;
2493
+ case 106:
1512
2494
  switch( (*p) ) {
1513
2495
  case 32: goto tr2;
1514
- case 36: goto st62;
1515
- case 95: goto st62;
2496
+ case 36: goto st107;
2497
+ case 95: goto st107;
1516
2498
  }
1517
2499
  if ( (*p) < 48 ) {
1518
2500
  if ( 45 <= (*p) && (*p) <= 46 )
1519
- goto st62;
2501
+ goto st107;
1520
2502
  } else if ( (*p) > 57 ) {
1521
2503
  if ( 65 <= (*p) && (*p) <= 90 )
1522
- goto st62;
2504
+ goto st107;
1523
2505
  } else
1524
- goto st62;
2506
+ goto st107;
1525
2507
  goto st0;
1526
- st62:
2508
+ st107:
1527
2509
  if ( ++p == pe )
1528
- goto _test_eof62;
1529
- case 62:
2510
+ goto _test_eof107;
2511
+ case 107:
1530
2512
  switch( (*p) ) {
1531
2513
  case 32: goto tr2;
1532
- case 36: goto st63;
1533
- case 95: goto st63;
2514
+ case 36: goto st108;
2515
+ case 95: goto st108;
1534
2516
  }
1535
2517
  if ( (*p) < 48 ) {
1536
2518
  if ( 45 <= (*p) && (*p) <= 46 )
1537
- goto st63;
2519
+ goto st108;
1538
2520
  } else if ( (*p) > 57 ) {
1539
2521
  if ( 65 <= (*p) && (*p) <= 90 )
1540
- goto st63;
2522
+ goto st108;
1541
2523
  } else
1542
- goto st63;
2524
+ goto st108;
1543
2525
  goto st0;
1544
- st63:
2526
+ st108:
1545
2527
  if ( ++p == pe )
1546
- goto _test_eof63;
1547
- case 63:
2528
+ goto _test_eof108;
2529
+ case 108:
1548
2530
  switch( (*p) ) {
1549
2531
  case 32: goto tr2;
1550
- case 36: goto st64;
1551
- case 95: goto st64;
2532
+ case 36: goto st109;
2533
+ case 95: goto st109;
1552
2534
  }
1553
2535
  if ( (*p) < 48 ) {
1554
2536
  if ( 45 <= (*p) && (*p) <= 46 )
1555
- goto st64;
2537
+ goto st109;
1556
2538
  } else if ( (*p) > 57 ) {
1557
2539
  if ( 65 <= (*p) && (*p) <= 90 )
1558
- goto st64;
2540
+ goto st109;
1559
2541
  } else
1560
- goto st64;
2542
+ goto st109;
1561
2543
  goto st0;
1562
- st64:
2544
+ st109:
1563
2545
  if ( ++p == pe )
1564
- goto _test_eof64;
1565
- case 64:
2546
+ goto _test_eof109;
2547
+ case 109:
1566
2548
  switch( (*p) ) {
1567
2549
  case 32: goto tr2;
1568
- case 36: goto st65;
1569
- case 95: goto st65;
2550
+ case 36: goto st110;
2551
+ case 95: goto st110;
1570
2552
  }
1571
2553
  if ( (*p) < 48 ) {
1572
2554
  if ( 45 <= (*p) && (*p) <= 46 )
1573
- goto st65;
2555
+ goto st110;
1574
2556
  } else if ( (*p) > 57 ) {
1575
2557
  if ( 65 <= (*p) && (*p) <= 90 )
1576
- goto st65;
2558
+ goto st110;
1577
2559
  } else
1578
- goto st65;
2560
+ goto st110;
1579
2561
  goto st0;
1580
- st65:
2562
+ st110:
1581
2563
  if ( ++p == pe )
1582
- goto _test_eof65;
1583
- case 65:
2564
+ goto _test_eof110;
2565
+ case 110:
1584
2566
  switch( (*p) ) {
1585
2567
  case 32: goto tr2;
1586
- case 36: goto st66;
1587
- case 95: goto st66;
2568
+ case 36: goto st111;
2569
+ case 95: goto st111;
1588
2570
  }
1589
2571
  if ( (*p) < 48 ) {
1590
2572
  if ( 45 <= (*p) && (*p) <= 46 )
1591
- goto st66;
2573
+ goto st111;
1592
2574
  } else if ( (*p) > 57 ) {
1593
2575
  if ( 65 <= (*p) && (*p) <= 90 )
1594
- goto st66;
2576
+ goto st111;
1595
2577
  } else
1596
- goto st66;
2578
+ goto st111;
1597
2579
  goto st0;
1598
- st66:
2580
+ st111:
1599
2581
  if ( ++p == pe )
1600
- goto _test_eof66;
1601
- case 66:
2582
+ goto _test_eof111;
2583
+ case 111:
1602
2584
  switch( (*p) ) {
1603
2585
  case 32: goto tr2;
1604
- case 36: goto st67;
1605
- case 95: goto st67;
2586
+ case 36: goto st112;
2587
+ case 95: goto st112;
1606
2588
  }
1607
2589
  if ( (*p) < 48 ) {
1608
2590
  if ( 45 <= (*p) && (*p) <= 46 )
1609
- goto st67;
2591
+ goto st112;
1610
2592
  } else if ( (*p) > 57 ) {
1611
2593
  if ( 65 <= (*p) && (*p) <= 90 )
1612
- goto st67;
2594
+ goto st112;
1613
2595
  } else
1614
- goto st67;
2596
+ goto st112;
1615
2597
  goto st0;
1616
- st67:
2598
+ st112:
1617
2599
  if ( ++p == pe )
1618
- goto _test_eof67;
1619
- case 67:
2600
+ goto _test_eof112;
2601
+ case 112:
1620
2602
  switch( (*p) ) {
1621
2603
  case 32: goto tr2;
1622
- case 36: goto st68;
1623
- case 95: goto st68;
2604
+ case 36: goto st113;
2605
+ case 95: goto st113;
1624
2606
  }
1625
2607
  if ( (*p) < 48 ) {
1626
2608
  if ( 45 <= (*p) && (*p) <= 46 )
1627
- goto st68;
2609
+ goto st113;
1628
2610
  } else if ( (*p) > 57 ) {
1629
2611
  if ( 65 <= (*p) && (*p) <= 90 )
1630
- goto st68;
2612
+ goto st113;
1631
2613
  } else
1632
- goto st68;
2614
+ goto st113;
1633
2615
  goto st0;
1634
- st68:
2616
+ st113:
1635
2617
  if ( ++p == pe )
1636
- goto _test_eof68;
1637
- case 68:
2618
+ goto _test_eof113;
2619
+ case 113:
1638
2620
  switch( (*p) ) {
1639
2621
  case 32: goto tr2;
1640
- case 36: goto st69;
1641
- case 95: goto st69;
2622
+ case 36: goto st114;
2623
+ case 95: goto st114;
1642
2624
  }
1643
2625
  if ( (*p) < 48 ) {
1644
2626
  if ( 45 <= (*p) && (*p) <= 46 )
1645
- goto st69;
2627
+ goto st114;
1646
2628
  } else if ( (*p) > 57 ) {
1647
2629
  if ( 65 <= (*p) && (*p) <= 90 )
1648
- goto st69;
2630
+ goto st114;
1649
2631
  } else
1650
- goto st69;
2632
+ goto st114;
1651
2633
  goto st0;
1652
- st69:
2634
+ st114:
1653
2635
  if ( ++p == pe )
1654
- goto _test_eof69;
1655
- case 69:
2636
+ goto _test_eof114;
2637
+ case 114:
1656
2638
  switch( (*p) ) {
1657
2639
  case 32: goto tr2;
1658
- case 36: goto st70;
1659
- case 95: goto st70;
2640
+ case 36: goto st115;
2641
+ case 95: goto st115;
1660
2642
  }
1661
2643
  if ( (*p) < 48 ) {
1662
2644
  if ( 45 <= (*p) && (*p) <= 46 )
1663
- goto st70;
2645
+ goto st115;
1664
2646
  } else if ( (*p) > 57 ) {
1665
2647
  if ( 65 <= (*p) && (*p) <= 90 )
1666
- goto st70;
2648
+ goto st115;
1667
2649
  } else
1668
- goto st70;
2650
+ goto st115;
1669
2651
  goto st0;
1670
- st70:
2652
+ st115:
1671
2653
  if ( ++p == pe )
1672
- goto _test_eof70;
1673
- case 70:
2654
+ goto _test_eof115;
2655
+ case 115:
1674
2656
  switch( (*p) ) {
1675
2657
  case 32: goto tr2;
1676
- case 36: goto st71;
1677
- case 95: goto st71;
2658
+ case 36: goto st116;
2659
+ case 95: goto st116;
1678
2660
  }
1679
2661
  if ( (*p) < 48 ) {
1680
2662
  if ( 45 <= (*p) && (*p) <= 46 )
1681
- goto st71;
2663
+ goto st116;
1682
2664
  } else if ( (*p) > 57 ) {
1683
2665
  if ( 65 <= (*p) && (*p) <= 90 )
1684
- goto st71;
2666
+ goto st116;
1685
2667
  } else
1686
- goto st71;
2668
+ goto st116;
1687
2669
  goto st0;
1688
- st71:
2670
+ st116:
1689
2671
  if ( ++p == pe )
1690
- goto _test_eof71;
1691
- case 71:
2672
+ goto _test_eof116;
2673
+ case 116:
1692
2674
  switch( (*p) ) {
1693
2675
  case 32: goto tr2;
1694
- case 36: goto st72;
1695
- case 95: goto st72;
2676
+ case 36: goto st117;
2677
+ case 95: goto st117;
1696
2678
  }
1697
2679
  if ( (*p) < 48 ) {
1698
2680
  if ( 45 <= (*p) && (*p) <= 46 )
1699
- goto st72;
2681
+ goto st117;
1700
2682
  } else if ( (*p) > 57 ) {
1701
2683
  if ( 65 <= (*p) && (*p) <= 90 )
1702
- goto st72;
2684
+ goto st117;
1703
2685
  } else
1704
- goto st72;
2686
+ goto st117;
1705
2687
  goto st0;
1706
- st72:
2688
+ st117:
1707
2689
  if ( ++p == pe )
1708
- goto _test_eof72;
1709
- case 72:
2690
+ goto _test_eof117;
2691
+ case 117:
1710
2692
  if ( (*p) == 32 )
1711
2693
  goto tr2;
1712
2694
  goto st0;
@@ -1726,7 +2708,7 @@ case 72:
1726
2708
  _test_eof14: cs = 14; goto _test_eof;
1727
2709
  _test_eof15: cs = 15; goto _test_eof;
1728
2710
  _test_eof16: cs = 16; goto _test_eof;
1729
- _test_eof73: cs = 73; goto _test_eof;
2711
+ _test_eof118: cs = 118; goto _test_eof;
1730
2712
  _test_eof17: cs = 17; goto _test_eof;
1731
2713
  _test_eof18: cs = 18; goto _test_eof;
1732
2714
  _test_eof19: cs = 19; goto _test_eof;
@@ -1783,11 +2765,56 @@ case 72:
1783
2765
  _test_eof70: cs = 70; goto _test_eof;
1784
2766
  _test_eof71: cs = 71; goto _test_eof;
1785
2767
  _test_eof72: cs = 72; goto _test_eof;
2768
+ _test_eof73: cs = 73; goto _test_eof;
2769
+ _test_eof74: cs = 74; goto _test_eof;
2770
+ _test_eof75: cs = 75; goto _test_eof;
2771
+ _test_eof76: cs = 76; goto _test_eof;
2772
+ _test_eof77: cs = 77; goto _test_eof;
2773
+ _test_eof78: cs = 78; goto _test_eof;
2774
+ _test_eof79: cs = 79; goto _test_eof;
2775
+ _test_eof80: cs = 80; goto _test_eof;
2776
+ _test_eof81: cs = 81; goto _test_eof;
2777
+ _test_eof82: cs = 82; goto _test_eof;
2778
+ _test_eof83: cs = 83; goto _test_eof;
2779
+ _test_eof84: cs = 84; goto _test_eof;
2780
+ _test_eof85: cs = 85; goto _test_eof;
2781
+ _test_eof86: cs = 86; goto _test_eof;
2782
+ _test_eof87: cs = 87; goto _test_eof;
2783
+ _test_eof88: cs = 88; goto _test_eof;
2784
+ _test_eof89: cs = 89; goto _test_eof;
2785
+ _test_eof90: cs = 90; goto _test_eof;
2786
+ _test_eof91: cs = 91; goto _test_eof;
2787
+ _test_eof92: cs = 92; goto _test_eof;
2788
+ _test_eof93: cs = 93; goto _test_eof;
2789
+ _test_eof94: cs = 94; goto _test_eof;
2790
+ _test_eof95: cs = 95; goto _test_eof;
2791
+ _test_eof96: cs = 96; goto _test_eof;
2792
+ _test_eof97: cs = 97; goto _test_eof;
2793
+ _test_eof98: cs = 98; goto _test_eof;
2794
+ _test_eof99: cs = 99; goto _test_eof;
2795
+ _test_eof100: cs = 100; goto _test_eof;
2796
+ _test_eof101: cs = 101; goto _test_eof;
2797
+ _test_eof102: cs = 102; goto _test_eof;
2798
+ _test_eof103: cs = 103; goto _test_eof;
2799
+ _test_eof104: cs = 104; goto _test_eof;
2800
+ _test_eof105: cs = 105; goto _test_eof;
2801
+ _test_eof106: cs = 106; goto _test_eof;
2802
+ _test_eof107: cs = 107; goto _test_eof;
2803
+ _test_eof108: cs = 108; goto _test_eof;
2804
+ _test_eof109: cs = 109; goto _test_eof;
2805
+ _test_eof110: cs = 110; goto _test_eof;
2806
+ _test_eof111: cs = 111; goto _test_eof;
2807
+ _test_eof112: cs = 112; goto _test_eof;
2808
+ _test_eof113: cs = 113; goto _test_eof;
2809
+ _test_eof114: cs = 114; goto _test_eof;
2810
+ _test_eof115: cs = 115; goto _test_eof;
2811
+ _test_eof116: cs = 116; goto _test_eof;
2812
+ _test_eof117: cs = 117; goto _test_eof;
1786
2813
 
1787
2814
  _test_eof: {}
1788
2815
  _out: {}
1789
2816
  }
1790
- #line 202 "src/parser.rl"
2817
+ #line 197 "src/parser.rl"
1791
2818
 
1792
2819
  parser->cs = cs;
1793
2820
  parser->nread += p - (buffer + off);
@@ -1799,6 +2826,10 @@ case 72:
1799
2826
  assert(parser->field_len <= len && "field has length longer than whole buffer");
1800
2827
  assert(parser->field_start < len && "field starts after buffer end");
1801
2828
 
2829
+ if(parser->nread > 1024 * (80 + 32))
2830
+ parser->overflow_error = TRUE;
2831
+
2832
+
1802
2833
  /* Ragel 6 does not use write eof; no need for this
1803
2834
  if(parser->body_start) {
1804
2835
  // final \r\n combo encountered so stop right here
@@ -1826,4 +2857,4 @@ int http_parser_has_error(http_parser *parser) {
1826
2857
 
1827
2858
  int http_parser_is_finished(http_parser *parser) {
1828
2859
  return parser->cs >= http_parser_first_final;
1829
- }
2860
+ }