ebb 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/src/ebb.h CHANGED
@@ -1,6 +1,6 @@
1
- /* Ebb Web Server
2
- * Copyright (c) 2007 Ry Dahl <ry.d4hl@gmail.com>
3
- * This software is released under the "MIT License". See README file for details.
1
+ /* The Ebb Web Server
2
+ * Copyright (c) 2008 Ry Dahl. This software is released under the MIT
3
+ * License. See README file for details.
4
4
  */
5
5
  #ifndef ebb_h
6
6
  #define ebb_h
@@ -18,7 +18,7 @@
18
18
  typedef struct ebb_server ebb_server;
19
19
  typedef struct ebb_client ebb_client;
20
20
 
21
- #define EBB_BUFFERSIZE (40*1024)
21
+ #define EBB_BUFFERSIZE (1024 * (80 + 32) * 2)
22
22
  #define EBB_MAX_CLIENTS 950
23
23
  #define EBB_TIMEOUT 30.0
24
24
  #define EBB_MAX_ENV 100
@@ -30,19 +30,29 @@ typedef struct ebb_client ebb_client;
30
30
  /*** Ebb Client ***/
31
31
  void ebb_client_close(ebb_client*);
32
32
  int ebb_client_read(ebb_client *client, char *buffer, int length);
33
+ void ebb_client_write_status(ebb_client*, int status, const char *human_status);
34
+ void ebb_client_write_header(ebb_client*, const char *field, const char *value);
33
35
  void ebb_client_write(ebb_client*, const char *data, int length);
34
36
  void ebb_client_finished( ebb_client *client);
35
37
 
36
- enum { EBB_REQUEST_METHOD
37
- , EBB_REQUEST_URI
38
- , EBB_FRAGMENT
39
- , EBB_REQUEST_PATH
40
- , EBB_QUERY_STRING
41
- , EBB_HTTP_VERSION
42
- , EBB_SERVER_NAME
43
- , EBB_SERVER_PORT
44
- , EBB_CONTENT_LENGTH
45
- };
38
+
39
+ struct ebb_env_item {
40
+ enum { EBB_FIELD_VALUE_PAIR
41
+ , EBB_REQUEST_METHOD
42
+ , EBB_REQUEST_URI
43
+ , EBB_FRAGMENT
44
+ , EBB_REQUEST_PATH
45
+ , EBB_QUERY_STRING
46
+ , EBB_HTTP_VERSION
47
+ , EBB_SERVER_NAME
48
+ , EBB_SERVER_PORT
49
+ , EBB_CONTENT_LENGTH
50
+ } type;
51
+ const char *field;
52
+ int field_length;
53
+ const char *value;
54
+ int value_length;
55
+ };
46
56
 
47
57
  struct ebb_client {
48
58
  EBB_TCP_COMMON
@@ -65,12 +75,13 @@ struct ebb_client {
65
75
 
66
76
  ev_timer timeout_watcher;
67
77
 
78
+ int status_sent;
79
+ int headers_sent;
80
+ int body_sent;
81
+
68
82
  /* the ENV structure */
69
83
  int env_size;
70
- const char *env_fields[EBB_MAX_ENV];
71
- int env_field_lengths[EBB_MAX_ENV];
72
- const char *env_values[EBB_MAX_ENV];
73
- int env_value_lengths[EBB_MAX_ENV];
84
+ struct ebb_env_item env[EBB_MAX_ENV];
74
85
  };
75
86
 
76
87
  /*** Ebb Server ***/
@@ -1,8 +1,7 @@
1
1
  /* A ruby binding to the ebb web server
2
- * Copyright (c) 2007 Ry Dahl <ry.d4hl@gmail.com>
3
- * This software is released under the "MIT License". See README file for details.
2
+ * Copyright (c) 2008 Ry Dahl. This software is released under the MIT
3
+ * License. See README file for details.
4
4
  */
5
-
6
5
  #include <ruby.h>
7
6
  #include <assert.h>
8
7
  #include <fcntl.h>
@@ -11,7 +10,6 @@
11
10
 
12
11
  static VALUE cServer;
13
12
  static VALUE cClient;
14
-
15
13
  static VALUE global_http_prefix;
16
14
  static VALUE global_request_method;
17
15
  static VALUE global_request_uri;
@@ -26,51 +24,17 @@ static VALUE global_path_info;
26
24
  static VALUE global_content_length;
27
25
  static VALUE global_http_host;
28
26
 
27
+ /* Variables with a leading underscore are C-level variables */
29
28
 
30
- /* Variables with an underscore are C-level variables */
31
-
32
- VALUE env_field(const char *field, int length)
33
- {
34
- VALUE f;
35
- char *ch, *end;
36
-
37
- if(field == NULL) {
38
- switch(length) {
39
- case EBB_REQUEST_METHOD: return global_request_method;
40
- case EBB_REQUEST_URI: return global_request_uri;
41
- case EBB_FRAGMENT: return global_fragment;
42
- case EBB_REQUEST_PATH: return global_request_path;
43
- case EBB_QUERY_STRING: return global_query_string;
44
- case EBB_HTTP_VERSION: return global_http_version;
45
- case EBB_SERVER_NAME: return global_server_name;
46
- case EBB_SERVER_PORT: return global_server_port;
47
- case EBB_CONTENT_LENGTH: return global_content_length;
48
- default: assert(FALSE); /* unknown const */
49
- }
50
- } else {
51
- f = rb_str_dup(global_http_prefix);
52
- f = rb_str_buf_cat(f, field, length);
53
-
54
- for(ch = RSTRING_PTR(f), end = ch + RSTRING_LEN(f); ch < end; ch++) {
55
- if(*ch == '-') {
56
- *ch = '_';
57
- } else {
58
- *ch = toupper(*ch);
59
- }
60
- }
61
- return f;
62
- }
63
- assert(FALSE);
64
- return Qnil;
65
- }
29
+ #define ASCII_UPPER(ch) ('a' <= ch && ch <= 'z' ? ch - 'a' + 'A' : ch)
66
30
 
67
31
  VALUE client_new(ebb_client *_client)
68
32
  {
69
33
  VALUE client = Data_Wrap_Struct(cClient, 0, 0, _client);
70
- // rb_iv_set(client, "@content_length", INT2FIX(_client->content_length));
71
34
  return client;
72
35
  }
73
36
 
37
+
74
38
  void request_cb(ebb_client *_client, void *data)
75
39
  {
76
40
  VALUE server = (VALUE)data;
@@ -81,23 +45,15 @@ void request_cb(ebb_client *_client, void *data)
81
45
  rb_ary_push(waiting_clients, client);
82
46
  }
83
47
 
48
+
84
49
  VALUE server_alloc(VALUE self)
85
50
  {
51
+ struct ev_loop *loop = ev_default_loop (0);
86
52
  ebb_server *_server = ebb_server_alloc();
87
53
  VALUE server = Qnil;
88
54
  server = Data_Wrap_Struct(cServer, 0, ebb_server_free, _server);
89
- return server;
90
- }
91
-
92
-
93
- VALUE server_initialize(VALUE x, VALUE server)
94
- {
95
- struct ev_loop *loop = ev_default_loop (0);
96
- ebb_server *_server;
97
-
98
- Data_Get_Struct(server, ebb_server, _server);
99
55
  ebb_server_init(_server, loop, request_cb, (void*)server);
100
- return Qnil;
56
+ return server;
101
57
  }
102
58
 
103
59
 
@@ -146,6 +102,7 @@ VALUE server_process_connections(VALUE x, VALUE server)
146
102
  return Qfalse;
147
103
  }
148
104
 
105
+
149
106
  VALUE server_unlisten(VALUE x, VALUE server)
150
107
  {
151
108
  ebb_server *_server;
@@ -155,20 +112,56 @@ VALUE server_unlisten(VALUE x, VALUE server)
155
112
  }
156
113
 
157
114
 
115
+ VALUE env_field(struct ebb_env_item *item)
116
+ {
117
+ VALUE f;
118
+ switch(item->type) {
119
+ case EBB_FIELD_VALUE_PAIR:
120
+ f = rb_str_new(NULL, RSTRING_LEN(global_http_prefix) + item->field_length);
121
+ memcpy( RSTRING_PTR(f)
122
+ , RSTRING_PTR(global_http_prefix)
123
+ , RSTRING_LEN(global_http_prefix)
124
+ );
125
+ int i;
126
+ for(i = 0; i < item->field_length; i++) {
127
+ char *ch = RSTRING_PTR(f) + RSTRING_LEN(global_http_prefix) + i;
128
+ *ch = item->field[i] == '-' ? '_' : ASCII_UPPER(item->field[i]);
129
+ }
130
+ return f;
131
+ case EBB_REQUEST_METHOD: return global_request_method;
132
+ case EBB_REQUEST_URI: return global_request_uri;
133
+ case EBB_FRAGMENT: return global_fragment;
134
+ case EBB_REQUEST_PATH: return global_request_path;
135
+ case EBB_QUERY_STRING: return global_query_string;
136
+ case EBB_HTTP_VERSION: return global_http_version;
137
+ case EBB_SERVER_NAME: return global_server_name;
138
+ case EBB_SERVER_PORT: return global_server_port;
139
+ case EBB_CONTENT_LENGTH: return global_content_length;
140
+ }
141
+ assert(FALSE);
142
+ return Qnil;
143
+ }
144
+
145
+
146
+ VALUE env_value(struct ebb_env_item *item)
147
+ {
148
+ if(item->value_length > 0)
149
+ return rb_str_new(item->value, item->value_length);
150
+ else
151
+ return Qnil;
152
+ }
153
+
154
+
158
155
  VALUE client_env(VALUE x, VALUE client)
159
156
  {
160
157
  ebb_client *_client;
161
158
  VALUE hash = rb_hash_new();
162
159
  int i;
163
160
  Data_Get_Struct(client, ebb_client, _client);
164
- /* This client->env_fields, client->env_value structure is pretty hacky
165
- * and a bit hard to follow. Look at the #defines at the top of ebb.c to
166
- * see what they are doing. Basically it's a list of (ptr,length) pairs
167
- * for both a field and value
168
- */
161
+
169
162
  for(i=0; i < _client->env_size; i++) {
170
- rb_hash_aset(hash, env_field(_client->env_fields[i], _client->env_field_lengths[i])
171
- , rb_str_new(_client->env_values[i], _client->env_value_lengths[i])
163
+ rb_hash_aset(hash, env_field(&_client->env[i])
164
+ , env_value(&_client->env[i])
172
165
  );
173
166
  }
174
167
  rb_hash_aset(hash, global_path_info, rb_hash_aref(hash, global_request_path));
@@ -199,6 +192,21 @@ VALUE client_read_input(VALUE x, VALUE client, VALUE size)
199
192
  return string;
200
193
  }
201
194
 
195
+ VALUE client_write_status(VALUE x, VALUE client, VALUE status, VALUE human_status)
196
+ {
197
+ ebb_client *_client;
198
+ Data_Get_Struct(client, ebb_client, _client);
199
+ ebb_client_write_status(_client, FIX2INT(status), StringValuePtr(human_status));
200
+ return Qnil;
201
+ }
202
+
203
+ VALUE client_write_header(VALUE x, VALUE client, VALUE field, VALUE value)
204
+ {
205
+ ebb_client *_client;
206
+ Data_Get_Struct(client, ebb_client, _client);
207
+ ebb_client_write_header(_client, StringValuePtr(field), StringValuePtr(value));
208
+ return Qnil;
209
+ }
202
210
 
203
211
  VALUE client_write(VALUE x, VALUE client, VALUE string)
204
212
  {
@@ -241,7 +249,6 @@ void Init_ebb_ext()
241
249
 
242
250
  cServer = rb_define_class_under(mEbb, "Server", rb_cObject);
243
251
  rb_define_alloc_func(cServer, server_alloc);
244
- rb_define_singleton_method(mFFI, "server_initialize", server_initialize, 1);
245
252
  rb_define_singleton_method(mFFI, "server_process_connections", server_process_connections, 1);
246
253
  rb_define_singleton_method(mFFI, "server_listen_on_port", server_listen_on_port, 2);
247
254
  rb_define_singleton_method(mFFI, "server_listen_on_socket", server_listen_on_socket, 2);
@@ -249,8 +256,9 @@ void Init_ebb_ext()
249
256
 
250
257
  cClient = rb_define_class_under(mEbb, "Client", rb_cObject);
251
258
  rb_define_singleton_method(mFFI, "client_read_input", client_read_input, 2);
259
+ rb_define_singleton_method(mFFI, "client_write_status", client_write_status, 3);
260
+ rb_define_singleton_method(mFFI, "client_write_header", client_write_header, 3);
252
261
  rb_define_singleton_method(mFFI, "client_write", client_write, 2);
253
262
  rb_define_singleton_method(mFFI, "client_finished", client_finished, 1);
254
263
  rb_define_singleton_method(mFFI, "client_env", client_env, 1);
255
-
256
264
  }
@@ -38,7 +38,8 @@ $LDFLAGS << " -lpthread "
38
38
  $CFLAGS << " -I#{libev_dir} " << flags.join(' ')
39
39
  $defs << "-DRUBY_VERSION_CODE=#{RUBY_VERSION.gsub(/\D/, '')}"
40
40
 
41
+ $srcs = ['ebb.c', 'ebb_ruby.c', 'parser.c']
42
+ $objs = ['ebb.o', 'ebb_ruby.o', 'parser.o']
41
43
 
42
44
  dir_config('ebb_ext')
43
45
  create_makefile('ebb_ext')
44
-
@@ -10,42 +10,52 @@
10
10
  #include <ctype.h>
11
11
  #include <string.h>
12
12
 
13
+ #define TRUE 1
14
+ #define FALSE 0
13
15
  #define LEN(AT, FPC) (FPC - buffer - parser->AT)
14
16
  #define MARK(M,FPC) (parser->M = (FPC) - buffer)
15
17
  #define PTR_TO(F) (buffer + parser->F)
16
18
 
17
19
  /** machine **/
18
- #line 122 "src/parser.rl"
20
+ #line 159 "src/parser.rl"
19
21
 
20
22
 
21
23
  /** Data **/
22
24
 
23
- #line 24 "src/parser.c"
25
+ #line 26 "src/parser.c"
24
26
  static const int http_parser_start = 1;
25
- static const int http_parser_first_final = 69;
27
+ static const int http_parser_first_final = 82;
26
28
  static const int http_parser_error = 0;
27
29
 
28
30
  static const int http_parser_en_main = 1;
29
31
 
30
- #line 126 "src/parser.rl"
32
+ #line 163 "src/parser.rl"
31
33
 
32
- int http_parser_init(http_parser *parser) {
34
+ void http_parser_init(http_parser *parser) {
33
35
  int cs = 0;
34
36
 
35
- #line 36 "src/parser.c"
37
+ #line 38 "src/parser.c"
36
38
  {
37
39
  cs = http_parser_start;
38
40
  }
39
- #line 130 "src/parser.rl"
41
+ #line 167 "src/parser.rl"
40
42
  parser->cs = cs;
43
+ parser->overflow_error = FALSE;
41
44
  parser->body_start = 0;
42
45
  parser->content_len = 0;
43
46
  parser->mark = 0;
44
47
  parser->nread = 0;
45
48
  parser->field_len = 0;
46
- parser->field_start = 0;
47
-
48
- return(1);
49
+ parser->field_start = 0;
50
+ parser->data = NULL;
51
+ 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;
49
59
  }
50
60
 
51
61
 
@@ -53,21 +63,21 @@ int http_parser_init(http_parser *parser) {
53
63
  size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, size_t off) {
54
64
  const char *p, *pe;
55
65
  int cs = parser->cs;
56
-
66
+
57
67
  assert(off <= len && "offset past end of buffer");
58
-
68
+
59
69
  p = buffer+off;
60
70
  pe = buffer+len;
61
-
62
- assert(*pe == '\0' && "pointer does not end on NUL");
71
+
72
+ /* Ragel 6 does not require this */
73
+ // assert(*pe == '\0' && "pointer does not end on NUL");
63
74
  assert(pe - p == len - off && "pointers aren't same distance");
64
-
65
-
66
75
 
67
- #line 68 "src/parser.c"
76
+
77
+ #line 78 "src/parser.c"
68
78
  {
69
79
  if ( p == pe )
70
- goto _out;
80
+ goto _test_eof;
71
81
  switch ( cs )
72
82
  {
73
83
  case 1:
@@ -85,32 +95,33 @@ case 1:
85
95
  goto tr0;
86
96
  goto st0;
87
97
  st0:
88
- goto _out0;
98
+ cs = 0;
99
+ goto _out;
89
100
  tr0:
90
- #line 20 "src/parser.rl"
101
+ #line 22 "src/parser.rl"
91
102
  {MARK(mark, p); }
92
103
  goto st2;
93
104
  st2:
94
105
  if ( ++p == pe )
95
- goto _out2;
106
+ goto _test_eof2;
96
107
  case 2:
97
- #line 98 "src/parser.c"
108
+ #line 109 "src/parser.c"
98
109
  switch( (*p) ) {
99
110
  case 32: goto tr2;
100
- case 36: goto st50;
101
- case 95: goto st50;
111
+ case 36: goto st63;
112
+ case 95: goto st63;
102
113
  }
103
114
  if ( (*p) < 48 ) {
104
115
  if ( 45 <= (*p) && (*p) <= 46 )
105
- goto st50;
116
+ goto st63;
106
117
  } else if ( (*p) > 57 ) {
107
118
  if ( 65 <= (*p) && (*p) <= 90 )
108
- goto st50;
119
+ goto st63;
109
120
  } else
110
- goto st50;
121
+ goto st63;
111
122
  goto st0;
112
123
  tr2:
113
- #line 41 "src/parser.rl"
124
+ #line 50 "src/parser.rl"
114
125
  {
115
126
  if(parser->request_method != NULL)
116
127
  parser->request_method(parser->data, PTR_TO(mark), LEN(mark, p));
@@ -118,9 +129,9 @@ tr2:
118
129
  goto st3;
119
130
  st3:
120
131
  if ( ++p == pe )
121
- goto _out3;
132
+ goto _test_eof3;
122
133
  case 3:
123
- #line 124 "src/parser.c"
134
+ #line 135 "src/parser.c"
124
135
  switch( (*p) ) {
125
136
  case 42: goto tr4;
126
137
  case 43: goto tr5;
@@ -137,113 +148,169 @@ case 3:
137
148
  goto tr5;
138
149
  goto st0;
139
150
  tr4:
140
- #line 20 "src/parser.rl"
151
+ #line 22 "src/parser.rl"
141
152
  {MARK(mark, p); }
142
153
  goto st4;
143
154
  st4:
144
155
  if ( ++p == pe )
145
- goto _out4;
156
+ goto _test_eof4;
146
157
  case 4:
147
- #line 148 "src/parser.c"
148
- if ( (*p) == 32 )
149
- goto tr8;
158
+ #line 159 "src/parser.c"
159
+ switch( (*p) ) {
160
+ case 32: goto tr8;
161
+ case 35: goto tr9;
162
+ }
150
163
  goto st0;
151
164
  tr8:
152
- #line 45 "src/parser.rl"
153
- {
165
+ #line 55 "src/parser.rl"
166
+ {
167
+ if(LEN(mark, p) > 12 * 1024) {
168
+ parser->overflow_error = TRUE;
169
+ {p++; cs = 5; goto _out;}
170
+ }
154
171
  if(parser->request_uri != NULL)
155
172
  parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
156
173
  }
157
174
  goto st5;
158
- tr52:
159
- #line 61 "src/parser.rl"
175
+ tr58:
176
+ #line 22 "src/parser.rl"
177
+ {MARK(mark, p); }
178
+ #line 88 "src/parser.rl"
179
+ {
180
+ /* Don't know if this length is specified somewhere or not */
181
+ if(LEN(mark, p) > 1024) {
182
+ parser->overflow_error = TRUE;
183
+ {p++; cs = 5; goto _out;}
184
+ }
185
+ if(parser->fragment != NULL)
186
+ parser->fragment(parser->data, PTR_TO(mark), LEN(mark, p));
187
+ }
188
+ goto st5;
189
+ tr61:
190
+ #line 88 "src/parser.rl"
160
191
  {
192
+ /* Don't know if this length is specified somewhere or not */
193
+ if(LEN(mark, p) > 1024) {
194
+ parser->overflow_error = TRUE;
195
+ {p++; cs = 5; goto _out;}
196
+ }
197
+ if(parser->fragment != NULL)
198
+ parser->fragment(parser->data, PTR_TO(mark), LEN(mark, p));
199
+ }
200
+ goto st5;
201
+ tr69:
202
+ #line 79 "src/parser.rl"
203
+ {
204
+ if(LEN(mark, p) > 1024) {
205
+ parser->overflow_error = TRUE;
206
+ {p++; cs = 5; goto _out;}
207
+ }
161
208
  if(parser->request_path != NULL)
162
209
  parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
163
210
  }
164
- #line 45 "src/parser.rl"
165
- {
211
+ #line 55 "src/parser.rl"
212
+ {
213
+ if(LEN(mark, p) > 12 * 1024) {
214
+ parser->overflow_error = TRUE;
215
+ {p++; cs = 5; goto _out;}
216
+ }
166
217
  if(parser->request_uri != NULL)
167
218
  parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
168
219
  }
169
220
  goto st5;
170
- tr62:
171
- #line 50 "src/parser.rl"
221
+ tr80:
222
+ #line 64 "src/parser.rl"
172
223
  {MARK(query_start, p); }
173
- #line 51 "src/parser.rl"
224
+ #line 65 "src/parser.rl"
174
225
  {
226
+ if(LEN(query_start, p) > 10 * 1024) {
227
+ parser->overflow_error = TRUE;
228
+ {p++; cs = 5; goto _out;}
229
+ }
175
230
  if(parser->query_string != NULL)
176
231
  parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
177
232
  }
178
- #line 45 "src/parser.rl"
179
- {
233
+ #line 55 "src/parser.rl"
234
+ {
235
+ if(LEN(mark, p) > 12 * 1024) {
236
+ parser->overflow_error = TRUE;
237
+ {p++; cs = 5; goto _out;}
238
+ }
180
239
  if(parser->request_uri != NULL)
181
240
  parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
182
241
  }
183
242
  goto st5;
184
- tr65:
185
- #line 51 "src/parser.rl"
243
+ tr84:
244
+ #line 65 "src/parser.rl"
186
245
  {
246
+ if(LEN(query_start, p) > 10 * 1024) {
247
+ parser->overflow_error = TRUE;
248
+ {p++; cs = 5; goto _out;}
249
+ }
187
250
  if(parser->query_string != NULL)
188
251
  parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
189
252
  }
190
- #line 45 "src/parser.rl"
191
- {
253
+ #line 55 "src/parser.rl"
254
+ {
255
+ if(LEN(mark, p) > 12 * 1024) {
256
+ parser->overflow_error = TRUE;
257
+ {p++; cs = 5; goto _out;}
258
+ }
192
259
  if(parser->request_uri != NULL)
193
260
  parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
194
261
  }
195
262
  goto st5;
196
263
  st5:
197
264
  if ( ++p == pe )
198
- goto _out5;
265
+ goto _test_eof5;
199
266
  case 5:
200
- #line 201 "src/parser.c"
267
+ #line 268 "src/parser.c"
201
268
  if ( (*p) == 72 )
202
- goto tr9;
269
+ goto tr10;
203
270
  goto st0;
204
- tr9:
205
- #line 20 "src/parser.rl"
271
+ tr10:
272
+ #line 22 "src/parser.rl"
206
273
  {MARK(mark, p); }
207
274
  goto st6;
208
275
  st6:
209
276
  if ( ++p == pe )
210
- goto _out6;
277
+ goto _test_eof6;
211
278
  case 6:
212
- #line 213 "src/parser.c"
279
+ #line 280 "src/parser.c"
213
280
  if ( (*p) == 84 )
214
281
  goto st7;
215
282
  goto st0;
216
283
  st7:
217
284
  if ( ++p == pe )
218
- goto _out7;
285
+ goto _test_eof7;
219
286
  case 7:
220
287
  if ( (*p) == 84 )
221
288
  goto st8;
222
289
  goto st0;
223
290
  st8:
224
291
  if ( ++p == pe )
225
- goto _out8;
292
+ goto _test_eof8;
226
293
  case 8:
227
294
  if ( (*p) == 80 )
228
295
  goto st9;
229
296
  goto st0;
230
297
  st9:
231
298
  if ( ++p == pe )
232
- goto _out9;
299
+ goto _test_eof9;
233
300
  case 9:
234
301
  if ( (*p) == 47 )
235
302
  goto st10;
236
303
  goto st0;
237
304
  st10:
238
305
  if ( ++p == pe )
239
- goto _out10;
306
+ goto _test_eof10;
240
307
  case 10:
241
308
  if ( 48 <= (*p) && (*p) <= 57 )
242
309
  goto st11;
243
310
  goto st0;
244
311
  st11:
245
312
  if ( ++p == pe )
246
- goto _out11;
313
+ goto _test_eof11;
247
314
  case 11:
248
315
  if ( (*p) == 46 )
249
316
  goto st12;
@@ -252,121 +319,147 @@ case 11:
252
319
  goto st0;
253
320
  st12:
254
321
  if ( ++p == pe )
255
- goto _out12;
322
+ goto _test_eof12;
256
323
  case 12:
257
324
  if ( 48 <= (*p) && (*p) <= 57 )
258
325
  goto st13;
259
326
  goto st0;
260
327
  st13:
261
328
  if ( ++p == pe )
262
- goto _out13;
329
+ goto _test_eof13;
263
330
  case 13:
264
331
  if ( (*p) == 13 )
265
- goto tr17;
332
+ goto tr18;
266
333
  if ( 48 <= (*p) && (*p) <= 57 )
267
334
  goto st13;
268
335
  goto st0;
269
- tr17:
270
- #line 56 "src/parser.rl"
336
+ tr18:
337
+ #line 74 "src/parser.rl"
271
338
  {
272
339
  if(parser->http_version != NULL)
273
340
  parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p));
274
341
  }
275
342
  goto st14;
276
- tr26:
277
- #line 29 "src/parser.rl"
278
- {
343
+ tr27:
344
+ #line 33 "src/parser.rl"
345
+ { MARK(mark, p); }
346
+ #line 34 "src/parser.rl"
347
+ {
348
+ if(LEN(mark, p) > 80 * 1024) {
349
+ parser->overflow_error = TRUE;
350
+ {p++; cs = 14; goto _out;}
351
+ }
279
352
  if(parser->http_field != NULL) {
280
353
  parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
281
354
  }
282
355
  }
283
356
  goto st14;
284
- tr44:
285
- #line 29 "src/parser.rl"
286
- {
357
+ tr30:
358
+ #line 34 "src/parser.rl"
359
+ {
360
+ if(LEN(mark, p) > 80 * 1024) {
361
+ parser->overflow_error = TRUE;
362
+ {p++; cs = 14; goto _out;}
363
+ }
287
364
  if(parser->http_field != NULL) {
288
365
  parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
289
366
  }
290
367
  }
291
- #line 35 "src/parser.rl"
368
+ goto st14;
369
+ tr47:
370
+ #line 44 "src/parser.rl"
292
371
  {
293
372
  if(parser->content_length != NULL) {
294
373
  parser->content_length(parser->data, PTR_TO(mark), LEN(mark, p));
295
374
  }
375
+ }
376
+ #line 34 "src/parser.rl"
377
+ {
378
+ if(LEN(mark, p) > 80 * 1024) {
379
+ parser->overflow_error = TRUE;
380
+ {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
+ }
296
385
  }
297
386
  goto st14;
298
387
  st14:
299
388
  if ( ++p == pe )
300
- goto _out14;
389
+ goto _test_eof14;
301
390
  case 14:
302
- #line 303 "src/parser.c"
391
+ #line 392 "src/parser.c"
303
392
  if ( (*p) == 10 )
304
393
  goto st15;
305
394
  goto st0;
306
395
  st15:
307
396
  if ( ++p == pe )
308
- goto _out15;
397
+ goto _test_eof15;
309
398
  case 15:
310
399
  switch( (*p) ) {
311
400
  case 13: goto st16;
312
- case 33: goto tr20;
313
- case 67: goto tr21;
314
- case 99: goto tr21;
315
- case 124: goto tr20;
316
- case 126: goto tr20;
401
+ case 33: goto tr21;
402
+ case 67: goto tr22;
403
+ case 99: goto tr22;
404
+ case 124: goto tr21;
405
+ case 126: goto tr21;
317
406
  }
318
407
  if ( (*p) < 45 ) {
319
408
  if ( (*p) > 39 ) {
320
409
  if ( 42 <= (*p) && (*p) <= 43 )
321
- goto tr20;
410
+ goto tr21;
322
411
  } else if ( (*p) >= 35 )
323
- goto tr20;
412
+ goto tr21;
324
413
  } else if ( (*p) > 46 ) {
325
414
  if ( (*p) < 65 ) {
326
415
  if ( 48 <= (*p) && (*p) <= 57 )
327
- goto tr20;
416
+ goto tr21;
328
417
  } else if ( (*p) > 90 ) {
329
418
  if ( 94 <= (*p) && (*p) <= 122 )
330
- goto tr20;
419
+ goto tr21;
331
420
  } else
332
- goto tr20;
421
+ goto tr21;
333
422
  } else
334
- goto tr20;
423
+ goto tr21;
335
424
  goto st0;
336
425
  st16:
337
426
  if ( ++p == pe )
338
- goto _out16;
427
+ goto _test_eof16;
339
428
  case 16:
340
429
  if ( (*p) == 10 )
341
- goto tr22;
430
+ goto tr23;
342
431
  goto st0;
343
- tr22:
344
- #line 66 "src/parser.rl"
345
- {
432
+ tr23:
433
+ #line 98 "src/parser.rl"
434
+ {
435
+ if(parser->nread > 1024 * (80 + 32)) {
436
+ parser->overflow_error = TRUE;
437
+ {p++; cs = 82; goto _out;}
438
+ }
346
439
  parser->body_start = p - buffer + 1;
347
440
  if(parser->header_done != NULL)
348
441
  parser->header_done(parser->data, p + 1, pe - p - 1);
349
- goto _out69;
442
+ {p++; cs = 82; goto _out;}
350
443
  }
351
- goto st69;
352
- st69:
444
+ goto st82;
445
+ st82:
353
446
  if ( ++p == pe )
354
- goto _out69;
355
- case 69:
356
- #line 357 "src/parser.c"
447
+ goto _test_eof82;
448
+ case 82:
449
+ #line 450 "src/parser.c"
357
450
  goto st0;
358
- tr20:
359
- #line 23 "src/parser.rl"
451
+ tr21:
452
+ #line 24 "src/parser.rl"
360
453
  { MARK(field_start, p); }
361
454
  goto st17;
362
455
  st17:
363
456
  if ( ++p == pe )
364
- goto _out17;
457
+ goto _test_eof17;
365
458
  case 17:
366
- #line 367 "src/parser.c"
459
+ #line 460 "src/parser.c"
367
460
  switch( (*p) ) {
368
461
  case 33: goto st17;
369
- case 58: goto tr24;
462
+ case 58: goto tr25;
370
463
  case 124: goto st17;
371
464
  case 126: goto st17;
372
465
  }
@@ -388,50 +481,54 @@ case 17:
388
481
  } else
389
482
  goto st17;
390
483
  goto st0;
391
- tr24:
392
- #line 24 "src/parser.rl"
484
+ tr25:
485
+ #line 25 "src/parser.rl"
393
486
  {
394
487
  parser->field_len = LEN(field_start, p);
488
+ if(parser->field_len > 256) {
489
+ parser->overflow_error = TRUE;
490
+ {p++; cs = 18; goto _out;}
491
+ }
395
492
  }
396
493
  goto st18;
397
- tr27:
398
- #line 28 "src/parser.rl"
494
+ tr28:
495
+ #line 33 "src/parser.rl"
399
496
  { MARK(mark, p); }
400
497
  goto st18;
401
498
  st18:
402
499
  if ( ++p == pe )
403
- goto _out18;
500
+ goto _test_eof18;
404
501
  case 18:
405
- #line 406 "src/parser.c"
502
+ #line 503 "src/parser.c"
406
503
  switch( (*p) ) {
407
- case 13: goto tr26;
408
- case 32: goto tr27;
504
+ case 13: goto tr27;
505
+ case 32: goto tr28;
409
506
  }
410
- goto tr25;
411
- tr25:
412
- #line 28 "src/parser.rl"
507
+ goto tr26;
508
+ tr26:
509
+ #line 33 "src/parser.rl"
413
510
  { MARK(mark, p); }
414
511
  goto st19;
415
512
  st19:
416
513
  if ( ++p == pe )
417
- goto _out19;
514
+ goto _test_eof19;
418
515
  case 19:
419
- #line 420 "src/parser.c"
516
+ #line 517 "src/parser.c"
420
517
  if ( (*p) == 13 )
421
- goto tr26;
518
+ goto tr30;
422
519
  goto st19;
423
- tr21:
424
- #line 23 "src/parser.rl"
520
+ tr22:
521
+ #line 24 "src/parser.rl"
425
522
  { MARK(field_start, p); }
426
523
  goto st20;
427
524
  st20:
428
525
  if ( ++p == pe )
429
- goto _out20;
526
+ goto _test_eof20;
430
527
  case 20:
431
- #line 432 "src/parser.c"
528
+ #line 529 "src/parser.c"
432
529
  switch( (*p) ) {
433
530
  case 33: goto st17;
434
- case 58: goto tr24;
531
+ case 58: goto tr25;
435
532
  case 79: goto st21;
436
533
  case 111: goto st21;
437
534
  case 124: goto st17;
@@ -457,11 +554,11 @@ case 20:
457
554
  goto st0;
458
555
  st21:
459
556
  if ( ++p == pe )
460
- goto _out21;
557
+ goto _test_eof21;
461
558
  case 21:
462
559
  switch( (*p) ) {
463
560
  case 33: goto st17;
464
- case 58: goto tr24;
561
+ case 58: goto tr25;
465
562
  case 78: goto st22;
466
563
  case 110: goto st22;
467
564
  case 124: goto st17;
@@ -487,11 +584,11 @@ case 21:
487
584
  goto st0;
488
585
  st22:
489
586
  if ( ++p == pe )
490
- goto _out22;
587
+ goto _test_eof22;
491
588
  case 22:
492
589
  switch( (*p) ) {
493
590
  case 33: goto st17;
494
- case 58: goto tr24;
591
+ case 58: goto tr25;
495
592
  case 84: goto st23;
496
593
  case 116: goto st23;
497
594
  case 124: goto st17;
@@ -517,11 +614,11 @@ case 22:
517
614
  goto st0;
518
615
  st23:
519
616
  if ( ++p == pe )
520
- goto _out23;
617
+ goto _test_eof23;
521
618
  case 23:
522
619
  switch( (*p) ) {
523
620
  case 33: goto st17;
524
- case 58: goto tr24;
621
+ case 58: goto tr25;
525
622
  case 69: goto st24;
526
623
  case 101: goto st24;
527
624
  case 124: goto st17;
@@ -547,11 +644,11 @@ case 23:
547
644
  goto st0;
548
645
  st24:
549
646
  if ( ++p == pe )
550
- goto _out24;
647
+ goto _test_eof24;
551
648
  case 24:
552
649
  switch( (*p) ) {
553
650
  case 33: goto st17;
554
- case 58: goto tr24;
651
+ case 58: goto tr25;
555
652
  case 78: goto st25;
556
653
  case 110: goto st25;
557
654
  case 124: goto st17;
@@ -577,11 +674,11 @@ case 24:
577
674
  goto st0;
578
675
  st25:
579
676
  if ( ++p == pe )
580
- goto _out25;
677
+ goto _test_eof25;
581
678
  case 25:
582
679
  switch( (*p) ) {
583
680
  case 33: goto st17;
584
- case 58: goto tr24;
681
+ case 58: goto tr25;
585
682
  case 84: goto st26;
586
683
  case 116: goto st26;
587
684
  case 124: goto st17;
@@ -607,13 +704,13 @@ case 25:
607
704
  goto st0;
608
705
  st26:
609
706
  if ( ++p == pe )
610
- goto _out26;
707
+ goto _test_eof26;
611
708
  case 26:
612
709
  switch( (*p) ) {
613
710
  case 33: goto st17;
614
711
  case 45: goto st27;
615
712
  case 46: goto st17;
616
- case 58: goto tr24;
713
+ case 58: goto tr25;
617
714
  case 124: goto st17;
618
715
  case 126: goto st17;
619
716
  }
@@ -634,11 +731,11 @@ case 26:
634
731
  goto st0;
635
732
  st27:
636
733
  if ( ++p == pe )
637
- goto _out27;
734
+ goto _test_eof27;
638
735
  case 27:
639
736
  switch( (*p) ) {
640
737
  case 33: goto st17;
641
- case 58: goto tr24;
738
+ case 58: goto tr25;
642
739
  case 76: goto st28;
643
740
  case 108: goto st28;
644
741
  case 124: goto st17;
@@ -664,11 +761,11 @@ case 27:
664
761
  goto st0;
665
762
  st28:
666
763
  if ( ++p == pe )
667
- goto _out28;
764
+ goto _test_eof28;
668
765
  case 28:
669
766
  switch( (*p) ) {
670
767
  case 33: goto st17;
671
- case 58: goto tr24;
768
+ case 58: goto tr25;
672
769
  case 69: goto st29;
673
770
  case 101: goto st29;
674
771
  case 124: goto st17;
@@ -694,11 +791,11 @@ case 28:
694
791
  goto st0;
695
792
  st29:
696
793
  if ( ++p == pe )
697
- goto _out29;
794
+ goto _test_eof29;
698
795
  case 29:
699
796
  switch( (*p) ) {
700
797
  case 33: goto st17;
701
- case 58: goto tr24;
798
+ case 58: goto tr25;
702
799
  case 78: goto st30;
703
800
  case 110: goto st30;
704
801
  case 124: goto st17;
@@ -724,11 +821,11 @@ case 29:
724
821
  goto st0;
725
822
  st30:
726
823
  if ( ++p == pe )
727
- goto _out30;
824
+ goto _test_eof30;
728
825
  case 30:
729
826
  switch( (*p) ) {
730
827
  case 33: goto st17;
731
- case 58: goto tr24;
828
+ case 58: goto tr25;
732
829
  case 71: goto st31;
733
830
  case 103: goto st31;
734
831
  case 124: goto st17;
@@ -754,11 +851,11 @@ case 30:
754
851
  goto st0;
755
852
  st31:
756
853
  if ( ++p == pe )
757
- goto _out31;
854
+ goto _test_eof31;
758
855
  case 31:
759
856
  switch( (*p) ) {
760
857
  case 33: goto st17;
761
- case 58: goto tr24;
858
+ case 58: goto tr25;
762
859
  case 84: goto st32;
763
860
  case 116: goto st32;
764
861
  case 124: goto st17;
@@ -784,11 +881,11 @@ case 31:
784
881
  goto st0;
785
882
  st32:
786
883
  if ( ++p == pe )
787
- goto _out32;
884
+ goto _test_eof32;
788
885
  case 32:
789
886
  switch( (*p) ) {
790
887
  case 33: goto st17;
791
- case 58: goto tr24;
888
+ case 58: goto tr25;
792
889
  case 72: goto st33;
793
890
  case 104: goto st33;
794
891
  case 124: goto st17;
@@ -814,11 +911,11 @@ case 32:
814
911
  goto st0;
815
912
  st33:
816
913
  if ( ++p == pe )
817
- goto _out33;
914
+ goto _test_eof33;
818
915
  case 33:
819
916
  switch( (*p) ) {
820
917
  case 33: goto st17;
821
- case 58: goto tr42;
918
+ case 58: goto tr44;
822
919
  case 124: goto st17;
823
920
  case 126: goto st17;
824
921
  }
@@ -840,745 +937,981 @@ case 33:
840
937
  } else
841
938
  goto st17;
842
939
  goto st0;
843
- tr42:
844
- #line 24 "src/parser.rl"
940
+ tr44:
941
+ #line 25 "src/parser.rl"
845
942
  {
846
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
+ }
847
948
  }
848
949
  goto st34;
849
950
  tr45:
850
- #line 20 "src/parser.rl"
851
- {MARK(mark, p); }
852
- #line 28 "src/parser.rl"
951
+ #line 33 "src/parser.rl"
853
952
  { MARK(mark, p); }
854
953
  goto st34;
855
954
  st34:
856
955
  if ( ++p == pe )
857
- goto _out34;
956
+ goto _test_eof34;
858
957
  case 34:
859
- #line 860 "src/parser.c"
958
+ #line 959 "src/parser.c"
860
959
  switch( (*p) ) {
861
- case 13: goto tr44;
960
+ case 13: goto tr27;
862
961
  case 32: goto tr45;
863
962
  }
864
- goto tr43;
865
- tr43:
866
- #line 20 "src/parser.rl"
963
+ if ( 48 <= (*p) && (*p) <= 57 )
964
+ goto tr46;
965
+ goto tr26;
966
+ tr46:
967
+ #line 22 "src/parser.rl"
867
968
  {MARK(mark, p); }
868
- #line 28 "src/parser.rl"
969
+ #line 33 "src/parser.rl"
869
970
  { MARK(mark, p); }
870
971
  goto st35;
871
972
  st35:
872
973
  if ( ++p == pe )
873
- goto _out35;
974
+ goto _test_eof35;
874
975
  case 35:
875
- #line 876 "src/parser.c"
976
+ #line 977 "src/parser.c"
876
977
  if ( (*p) == 13 )
877
- goto tr44;
878
- goto st35;
879
- tr5:
880
- #line 20 "src/parser.rl"
881
- {MARK(mark, p); }
882
- goto st36;
978
+ goto tr47;
979
+ if ( 48 <= (*p) && (*p) <= 57 )
980
+ goto st36;
981
+ goto st19;
883
982
  st36:
884
983
  if ( ++p == pe )
885
- goto _out36;
984
+ goto _test_eof36;
886
985
  case 36:
887
- #line 888 "src/parser.c"
986
+ if ( (*p) == 13 )
987
+ goto tr47;
988
+ if ( 48 <= (*p) && (*p) <= 57 )
989
+ goto st37;
990
+ goto st19;
991
+ st37:
992
+ if ( ++p == pe )
993
+ goto _test_eof37;
994
+ case 37:
995
+ if ( (*p) == 13 )
996
+ goto tr47;
997
+ if ( 48 <= (*p) && (*p) <= 57 )
998
+ goto st38;
999
+ goto st19;
1000
+ st38:
1001
+ if ( ++p == pe )
1002
+ goto _test_eof38;
1003
+ case 38:
1004
+ if ( (*p) == 13 )
1005
+ goto tr47;
1006
+ if ( 48 <= (*p) && (*p) <= 57 )
1007
+ goto st39;
1008
+ goto st19;
1009
+ st39:
1010
+ if ( ++p == pe )
1011
+ goto _test_eof39;
1012
+ case 39:
1013
+ if ( (*p) == 13 )
1014
+ goto tr47;
1015
+ if ( 48 <= (*p) && (*p) <= 57 )
1016
+ goto st40;
1017
+ goto st19;
1018
+ st40:
1019
+ if ( ++p == pe )
1020
+ goto _test_eof40;
1021
+ case 40:
1022
+ if ( (*p) == 13 )
1023
+ goto tr47;
1024
+ if ( 48 <= (*p) && (*p) <= 57 )
1025
+ goto st41;
1026
+ goto st19;
1027
+ st41:
1028
+ if ( ++p == pe )
1029
+ goto _test_eof41;
1030
+ case 41:
1031
+ if ( (*p) == 13 )
1032
+ goto tr47;
1033
+ if ( 48 <= (*p) && (*p) <= 57 )
1034
+ goto st42;
1035
+ goto st19;
1036
+ st42:
1037
+ if ( ++p == pe )
1038
+ goto _test_eof42;
1039
+ case 42:
1040
+ if ( (*p) == 13 )
1041
+ goto tr47;
1042
+ if ( 48 <= (*p) && (*p) <= 57 )
1043
+ goto st43;
1044
+ goto st19;
1045
+ st43:
1046
+ if ( ++p == pe )
1047
+ goto _test_eof43;
1048
+ case 43:
1049
+ if ( (*p) == 13 )
1050
+ goto tr47;
1051
+ if ( 48 <= (*p) && (*p) <= 57 )
1052
+ goto st44;
1053
+ goto st19;
1054
+ st44:
1055
+ if ( ++p == pe )
1056
+ goto _test_eof44;
1057
+ case 44:
1058
+ if ( (*p) == 13 )
1059
+ goto tr47;
1060
+ goto st19;
1061
+ tr9:
1062
+ #line 55 "src/parser.rl"
1063
+ {
1064
+ if(LEN(mark, p) > 12 * 1024) {
1065
+ parser->overflow_error = TRUE;
1066
+ {p++; cs = 45; goto _out;}
1067
+ }
1068
+ if(parser->request_uri != NULL)
1069
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
1070
+ }
1071
+ goto st45;
1072
+ tr70:
1073
+ #line 79 "src/parser.rl"
1074
+ {
1075
+ if(LEN(mark, p) > 1024) {
1076
+ parser->overflow_error = TRUE;
1077
+ {p++; cs = 45; goto _out;}
1078
+ }
1079
+ if(parser->request_path != NULL)
1080
+ parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
1081
+ }
1082
+ #line 55 "src/parser.rl"
1083
+ {
1084
+ if(LEN(mark, p) > 12 * 1024) {
1085
+ parser->overflow_error = TRUE;
1086
+ {p++; cs = 45; goto _out;}
1087
+ }
1088
+ if(parser->request_uri != NULL)
1089
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
1090
+ }
1091
+ goto st45;
1092
+ tr81:
1093
+ #line 64 "src/parser.rl"
1094
+ {MARK(query_start, p); }
1095
+ #line 65 "src/parser.rl"
1096
+ {
1097
+ if(LEN(query_start, p) > 10 * 1024) {
1098
+ parser->overflow_error = TRUE;
1099
+ {p++; cs = 45; goto _out;}
1100
+ }
1101
+ if(parser->query_string != NULL)
1102
+ parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
1103
+ }
1104
+ #line 55 "src/parser.rl"
1105
+ {
1106
+ if(LEN(mark, p) > 12 * 1024) {
1107
+ parser->overflow_error = TRUE;
1108
+ {p++; cs = 45; goto _out;}
1109
+ }
1110
+ if(parser->request_uri != NULL)
1111
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
1112
+ }
1113
+ goto st45;
1114
+ tr85:
1115
+ #line 65 "src/parser.rl"
1116
+ {
1117
+ if(LEN(query_start, p) > 10 * 1024) {
1118
+ parser->overflow_error = TRUE;
1119
+ {p++; cs = 45; goto _out;}
1120
+ }
1121
+ if(parser->query_string != NULL)
1122
+ parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
1123
+ }
1124
+ #line 55 "src/parser.rl"
1125
+ {
1126
+ if(LEN(mark, p) > 12 * 1024) {
1127
+ parser->overflow_error = TRUE;
1128
+ {p++; cs = 45; goto _out;}
1129
+ }
1130
+ if(parser->request_uri != NULL)
1131
+ parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
1132
+ }
1133
+ goto st45;
1134
+ st45:
1135
+ if ( ++p == pe )
1136
+ goto _test_eof45;
1137
+ case 45:
1138
+ #line 1139 "src/parser.c"
1139
+ switch( (*p) ) {
1140
+ case 32: goto tr58;
1141
+ case 37: goto tr59;
1142
+ case 60: goto st0;
1143
+ case 62: goto st0;
1144
+ case 127: goto st0;
1145
+ }
1146
+ if ( (*p) > 31 ) {
1147
+ if ( 34 <= (*p) && (*p) <= 35 )
1148
+ goto st0;
1149
+ } else if ( (*p) >= 0 )
1150
+ goto st0;
1151
+ goto tr57;
1152
+ tr57:
1153
+ #line 22 "src/parser.rl"
1154
+ {MARK(mark, p); }
1155
+ goto st46;
1156
+ st46:
1157
+ if ( ++p == pe )
1158
+ goto _test_eof46;
1159
+ case 46:
1160
+ #line 1161 "src/parser.c"
1161
+ switch( (*p) ) {
1162
+ case 32: goto tr61;
1163
+ case 37: goto st47;
1164
+ case 60: goto st0;
1165
+ case 62: goto st0;
1166
+ case 127: goto st0;
1167
+ }
1168
+ if ( (*p) > 31 ) {
1169
+ if ( 34 <= (*p) && (*p) <= 35 )
1170
+ goto st0;
1171
+ } else if ( (*p) >= 0 )
1172
+ goto st0;
1173
+ goto st46;
1174
+ tr59:
1175
+ #line 22 "src/parser.rl"
1176
+ {MARK(mark, p); }
1177
+ goto st47;
1178
+ st47:
1179
+ if ( ++p == pe )
1180
+ goto _test_eof47;
1181
+ case 47:
1182
+ #line 1183 "src/parser.c"
1183
+ if ( (*p) < 65 ) {
1184
+ if ( 48 <= (*p) && (*p) <= 57 )
1185
+ goto st48;
1186
+ } else if ( (*p) > 70 ) {
1187
+ if ( 97 <= (*p) && (*p) <= 102 )
1188
+ goto st48;
1189
+ } else
1190
+ goto st48;
1191
+ goto st0;
1192
+ st48:
1193
+ if ( ++p == pe )
1194
+ goto _test_eof48;
1195
+ case 48:
1196
+ if ( (*p) < 65 ) {
1197
+ if ( 48 <= (*p) && (*p) <= 57 )
1198
+ goto st46;
1199
+ } else if ( (*p) > 70 ) {
1200
+ if ( 97 <= (*p) && (*p) <= 102 )
1201
+ goto st46;
1202
+ } else
1203
+ goto st46;
1204
+ goto st0;
1205
+ tr5:
1206
+ #line 22 "src/parser.rl"
1207
+ {MARK(mark, p); }
1208
+ goto st49;
1209
+ st49:
1210
+ if ( ++p == pe )
1211
+ goto _test_eof49;
1212
+ case 49:
1213
+ #line 1214 "src/parser.c"
888
1214
  switch( (*p) ) {
889
- case 43: goto st36;
890
- case 58: goto st37;
1215
+ case 43: goto st49;
1216
+ case 58: goto st50;
891
1217
  }
892
1218
  if ( (*p) < 48 ) {
893
1219
  if ( 45 <= (*p) && (*p) <= 46 )
894
- goto st36;
1220
+ goto st49;
895
1221
  } else if ( (*p) > 57 ) {
896
1222
  if ( (*p) > 90 ) {
897
1223
  if ( 97 <= (*p) && (*p) <= 122 )
898
- goto st36;
1224
+ goto st49;
899
1225
  } else if ( (*p) >= 65 )
900
- goto st36;
1226
+ goto st49;
901
1227
  } else
902
- goto st36;
1228
+ goto st49;
903
1229
  goto st0;
904
1230
  tr7:
905
- #line 20 "src/parser.rl"
1231
+ #line 22 "src/parser.rl"
906
1232
  {MARK(mark, p); }
907
- goto st37;
908
- st37:
1233
+ goto st50;
1234
+ st50:
909
1235
  if ( ++p == pe )
910
- goto _out37;
911
- case 37:
912
- #line 913 "src/parser.c"
1236
+ goto _test_eof50;
1237
+ case 50:
1238
+ #line 1239 "src/parser.c"
913
1239
  switch( (*p) ) {
914
1240
  case 32: goto tr8;
915
- case 37: goto st38;
1241
+ case 34: goto st0;
1242
+ case 35: goto tr9;
1243
+ case 37: goto st51;
916
1244
  case 60: goto st0;
917
1245
  case 62: goto st0;
918
1246
  case 127: goto st0;
919
1247
  }
920
- if ( (*p) > 31 ) {
921
- if ( 34 <= (*p) && (*p) <= 35 )
922
- goto st0;
923
- } else if ( (*p) >= 0 )
1248
+ if ( 0 <= (*p) && (*p) <= 31 )
924
1249
  goto st0;
925
- goto st37;
926
- st38:
1250
+ goto st50;
1251
+ st51:
927
1252
  if ( ++p == pe )
928
- goto _out38;
929
- case 38:
1253
+ goto _test_eof51;
1254
+ case 51:
930
1255
  if ( (*p) < 65 ) {
931
1256
  if ( 48 <= (*p) && (*p) <= 57 )
932
- goto st39;
1257
+ goto st52;
933
1258
  } else if ( (*p) > 70 ) {
934
1259
  if ( 97 <= (*p) && (*p) <= 102 )
935
- goto st39;
1260
+ goto st52;
936
1261
  } else
937
- goto st39;
1262
+ goto st52;
938
1263
  goto st0;
939
- st39:
1264
+ st52:
940
1265
  if ( ++p == pe )
941
- goto _out39;
942
- case 39:
1266
+ goto _test_eof52;
1267
+ case 52:
943
1268
  if ( (*p) < 65 ) {
944
1269
  if ( 48 <= (*p) && (*p) <= 57 )
945
- goto st37;
1270
+ goto st50;
946
1271
  } else if ( (*p) > 70 ) {
947
1272
  if ( 97 <= (*p) && (*p) <= 102 )
948
- goto st37;
1273
+ goto st50;
949
1274
  } else
950
- goto st37;
1275
+ goto st50;
951
1276
  goto st0;
952
1277
  tr6:
953
- #line 20 "src/parser.rl"
1278
+ #line 22 "src/parser.rl"
954
1279
  {MARK(mark, p); }
955
- goto st40;
956
- st40:
1280
+ goto st53;
1281
+ st53:
957
1282
  if ( ++p == pe )
958
- goto _out40;
959
- case 40:
960
- #line 961 "src/parser.c"
1283
+ goto _test_eof53;
1284
+ case 53:
1285
+ #line 1286 "src/parser.c"
961
1286
  switch( (*p) ) {
962
- case 32: goto tr52;
963
- case 37: goto st41;
964
- case 59: goto tr54;
1287
+ case 32: goto tr69;
1288
+ case 34: goto st0;
1289
+ case 35: goto tr70;
1290
+ case 37: goto st54;
1291
+ case 59: goto tr72;
965
1292
  case 60: goto st0;
966
1293
  case 62: goto st0;
967
- case 63: goto tr55;
1294
+ case 63: goto tr73;
968
1295
  case 127: goto st0;
969
1296
  }
970
- if ( (*p) > 31 ) {
971
- if ( 34 <= (*p) && (*p) <= 35 )
972
- goto st0;
973
- } else if ( (*p) >= 0 )
1297
+ if ( 0 <= (*p) && (*p) <= 31 )
974
1298
  goto st0;
975
- goto st40;
976
- st41:
1299
+ goto st53;
1300
+ st54:
977
1301
  if ( ++p == pe )
978
- goto _out41;
979
- case 41:
1302
+ goto _test_eof54;
1303
+ case 54:
980
1304
  if ( (*p) < 65 ) {
981
1305
  if ( 48 <= (*p) && (*p) <= 57 )
982
- goto st42;
1306
+ goto st55;
983
1307
  } else if ( (*p) > 70 ) {
984
1308
  if ( 97 <= (*p) && (*p) <= 102 )
985
- goto st42;
1309
+ goto st55;
986
1310
  } else
987
- goto st42;
1311
+ goto st55;
988
1312
  goto st0;
989
- st42:
1313
+ st55:
990
1314
  if ( ++p == pe )
991
- goto _out42;
992
- case 42:
1315
+ goto _test_eof55;
1316
+ case 55:
993
1317
  if ( (*p) < 65 ) {
994
1318
  if ( 48 <= (*p) && (*p) <= 57 )
995
- goto st40;
1319
+ goto st53;
996
1320
  } else if ( (*p) > 70 ) {
997
1321
  if ( 97 <= (*p) && (*p) <= 102 )
998
- goto st40;
1322
+ goto st53;
999
1323
  } else
1000
- goto st40;
1324
+ goto st53;
1001
1325
  goto st0;
1002
- tr54:
1003
- #line 61 "src/parser.rl"
1326
+ tr72:
1327
+ #line 79 "src/parser.rl"
1004
1328
  {
1329
+ if(LEN(mark, p) > 1024) {
1330
+ parser->overflow_error = TRUE;
1331
+ {p++; cs = 56; goto _out;}
1332
+ }
1005
1333
  if(parser->request_path != NULL)
1006
1334
  parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
1007
1335
  }
1008
- goto st43;
1009
- st43:
1336
+ goto st56;
1337
+ st56:
1010
1338
  if ( ++p == pe )
1011
- goto _out43;
1012
- case 43:
1013
- #line 1014 "src/parser.c"
1339
+ goto _test_eof56;
1340
+ case 56:
1341
+ #line 1342 "src/parser.c"
1014
1342
  switch( (*p) ) {
1015
1343
  case 32: goto tr8;
1016
- case 37: goto st44;
1344
+ case 34: goto st0;
1345
+ case 35: goto tr9;
1346
+ case 37: goto st57;
1017
1347
  case 60: goto st0;
1018
1348
  case 62: goto st0;
1019
- case 63: goto st46;
1349
+ case 63: goto st59;
1020
1350
  case 127: goto st0;
1021
1351
  }
1022
- if ( (*p) > 31 ) {
1023
- if ( 34 <= (*p) && (*p) <= 35 )
1024
- goto st0;
1025
- } else if ( (*p) >= 0 )
1352
+ if ( 0 <= (*p) && (*p) <= 31 )
1026
1353
  goto st0;
1027
- goto st43;
1028
- st44:
1354
+ goto st56;
1355
+ st57:
1029
1356
  if ( ++p == pe )
1030
- goto _out44;
1031
- case 44:
1357
+ goto _test_eof57;
1358
+ case 57:
1032
1359
  if ( (*p) < 65 ) {
1033
1360
  if ( 48 <= (*p) && (*p) <= 57 )
1034
- goto st45;
1361
+ goto st58;
1035
1362
  } else if ( (*p) > 70 ) {
1036
1363
  if ( 97 <= (*p) && (*p) <= 102 )
1037
- goto st45;
1364
+ goto st58;
1038
1365
  } else
1039
- goto st45;
1366
+ goto st58;
1040
1367
  goto st0;
1041
- st45:
1368
+ st58:
1042
1369
  if ( ++p == pe )
1043
- goto _out45;
1044
- case 45:
1370
+ goto _test_eof58;
1371
+ case 58:
1045
1372
  if ( (*p) < 65 ) {
1046
1373
  if ( 48 <= (*p) && (*p) <= 57 )
1047
- goto st43;
1374
+ goto st56;
1048
1375
  } else if ( (*p) > 70 ) {
1049
1376
  if ( 97 <= (*p) && (*p) <= 102 )
1050
- goto st43;
1377
+ goto st56;
1051
1378
  } else
1052
- goto st43;
1379
+ goto st56;
1053
1380
  goto st0;
1054
- tr55:
1055
- #line 61 "src/parser.rl"
1381
+ tr73:
1382
+ #line 79 "src/parser.rl"
1056
1383
  {
1384
+ if(LEN(mark, p) > 1024) {
1385
+ parser->overflow_error = TRUE;
1386
+ {p++; cs = 59; goto _out;}
1387
+ }
1057
1388
  if(parser->request_path != NULL)
1058
1389
  parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
1059
1390
  }
1060
- goto st46;
1061
- st46:
1391
+ goto st59;
1392
+ st59:
1062
1393
  if ( ++p == pe )
1063
- goto _out46;
1064
- case 46:
1065
- #line 1066 "src/parser.c"
1394
+ goto _test_eof59;
1395
+ case 59:
1396
+ #line 1397 "src/parser.c"
1066
1397
  switch( (*p) ) {
1067
- case 32: goto tr62;
1068
- case 37: goto tr63;
1398
+ case 32: goto tr80;
1399
+ case 34: goto st0;
1400
+ case 35: goto tr81;
1401
+ case 37: goto tr82;
1069
1402
  case 60: goto st0;
1070
1403
  case 62: goto st0;
1071
1404
  case 127: goto st0;
1072
1405
  }
1073
- if ( (*p) > 31 ) {
1074
- if ( 34 <= (*p) && (*p) <= 35 )
1075
- goto st0;
1076
- } else if ( (*p) >= 0 )
1406
+ if ( 0 <= (*p) && (*p) <= 31 )
1077
1407
  goto st0;
1078
- goto tr61;
1079
- tr61:
1080
- #line 50 "src/parser.rl"
1408
+ goto tr79;
1409
+ tr79:
1410
+ #line 64 "src/parser.rl"
1081
1411
  {MARK(query_start, p); }
1082
- goto st47;
1083
- st47:
1412
+ goto st60;
1413
+ st60:
1084
1414
  if ( ++p == pe )
1085
- goto _out47;
1086
- case 47:
1087
- #line 1088 "src/parser.c"
1415
+ goto _test_eof60;
1416
+ case 60:
1417
+ #line 1418 "src/parser.c"
1088
1418
  switch( (*p) ) {
1089
- case 32: goto tr65;
1090
- case 37: goto st48;
1419
+ case 32: goto tr84;
1420
+ case 34: goto st0;
1421
+ case 35: goto tr85;
1422
+ case 37: goto st61;
1091
1423
  case 60: goto st0;
1092
1424
  case 62: goto st0;
1093
1425
  case 127: goto st0;
1094
1426
  }
1095
- if ( (*p) > 31 ) {
1096
- if ( 34 <= (*p) && (*p) <= 35 )
1097
- goto st0;
1098
- } else if ( (*p) >= 0 )
1427
+ if ( 0 <= (*p) && (*p) <= 31 )
1099
1428
  goto st0;
1100
- goto st47;
1101
- tr63:
1102
- #line 50 "src/parser.rl"
1429
+ goto st60;
1430
+ tr82:
1431
+ #line 64 "src/parser.rl"
1103
1432
  {MARK(query_start, p); }
1104
- goto st48;
1105
- st48:
1433
+ goto st61;
1434
+ st61:
1106
1435
  if ( ++p == pe )
1107
- goto _out48;
1108
- case 48:
1109
- #line 1110 "src/parser.c"
1436
+ goto _test_eof61;
1437
+ case 61:
1438
+ #line 1439 "src/parser.c"
1110
1439
  if ( (*p) < 65 ) {
1111
1440
  if ( 48 <= (*p) && (*p) <= 57 )
1112
- goto st49;
1441
+ goto st62;
1113
1442
  } else if ( (*p) > 70 ) {
1114
1443
  if ( 97 <= (*p) && (*p) <= 102 )
1115
- goto st49;
1444
+ goto st62;
1116
1445
  } else
1117
- goto st49;
1446
+ goto st62;
1118
1447
  goto st0;
1119
- st49:
1448
+ st62:
1120
1449
  if ( ++p == pe )
1121
- goto _out49;
1122
- case 49:
1450
+ goto _test_eof62;
1451
+ case 62:
1123
1452
  if ( (*p) < 65 ) {
1124
1453
  if ( 48 <= (*p) && (*p) <= 57 )
1125
- goto st47;
1454
+ goto st60;
1126
1455
  } else if ( (*p) > 70 ) {
1127
1456
  if ( 97 <= (*p) && (*p) <= 102 )
1128
- goto st47;
1457
+ goto st60;
1129
1458
  } else
1130
- goto st47;
1459
+ goto st60;
1131
1460
  goto st0;
1132
- st50:
1461
+ st63:
1133
1462
  if ( ++p == pe )
1134
- goto _out50;
1135
- case 50:
1463
+ goto _test_eof63;
1464
+ case 63:
1136
1465
  switch( (*p) ) {
1137
1466
  case 32: goto tr2;
1138
- case 36: goto st51;
1139
- case 95: goto st51;
1467
+ case 36: goto st64;
1468
+ case 95: goto st64;
1140
1469
  }
1141
1470
  if ( (*p) < 48 ) {
1142
1471
  if ( 45 <= (*p) && (*p) <= 46 )
1143
- goto st51;
1472
+ goto st64;
1144
1473
  } else if ( (*p) > 57 ) {
1145
1474
  if ( 65 <= (*p) && (*p) <= 90 )
1146
- goto st51;
1475
+ goto st64;
1147
1476
  } else
1148
- goto st51;
1477
+ goto st64;
1149
1478
  goto st0;
1150
- st51:
1479
+ st64:
1151
1480
  if ( ++p == pe )
1152
- goto _out51;
1153
- case 51:
1481
+ goto _test_eof64;
1482
+ case 64:
1154
1483
  switch( (*p) ) {
1155
1484
  case 32: goto tr2;
1156
- case 36: goto st52;
1157
- case 95: goto st52;
1485
+ case 36: goto st65;
1486
+ case 95: goto st65;
1158
1487
  }
1159
1488
  if ( (*p) < 48 ) {
1160
1489
  if ( 45 <= (*p) && (*p) <= 46 )
1161
- goto st52;
1490
+ goto st65;
1162
1491
  } else if ( (*p) > 57 ) {
1163
1492
  if ( 65 <= (*p) && (*p) <= 90 )
1164
- goto st52;
1493
+ goto st65;
1165
1494
  } else
1166
- goto st52;
1495
+ goto st65;
1167
1496
  goto st0;
1168
- st52:
1497
+ st65:
1169
1498
  if ( ++p == pe )
1170
- goto _out52;
1171
- case 52:
1499
+ goto _test_eof65;
1500
+ case 65:
1172
1501
  switch( (*p) ) {
1173
1502
  case 32: goto tr2;
1174
- case 36: goto st53;
1175
- case 95: goto st53;
1503
+ case 36: goto st66;
1504
+ case 95: goto st66;
1176
1505
  }
1177
1506
  if ( (*p) < 48 ) {
1178
1507
  if ( 45 <= (*p) && (*p) <= 46 )
1179
- goto st53;
1508
+ goto st66;
1180
1509
  } else if ( (*p) > 57 ) {
1181
1510
  if ( 65 <= (*p) && (*p) <= 90 )
1182
- goto st53;
1511
+ goto st66;
1183
1512
  } else
1184
- goto st53;
1513
+ goto st66;
1185
1514
  goto st0;
1186
- st53:
1515
+ st66:
1187
1516
  if ( ++p == pe )
1188
- goto _out53;
1189
- case 53:
1517
+ goto _test_eof66;
1518
+ case 66:
1190
1519
  switch( (*p) ) {
1191
1520
  case 32: goto tr2;
1192
- case 36: goto st54;
1193
- case 95: goto st54;
1521
+ case 36: goto st67;
1522
+ case 95: goto st67;
1194
1523
  }
1195
1524
  if ( (*p) < 48 ) {
1196
1525
  if ( 45 <= (*p) && (*p) <= 46 )
1197
- goto st54;
1526
+ goto st67;
1198
1527
  } else if ( (*p) > 57 ) {
1199
1528
  if ( 65 <= (*p) && (*p) <= 90 )
1200
- goto st54;
1529
+ goto st67;
1201
1530
  } else
1202
- goto st54;
1531
+ goto st67;
1203
1532
  goto st0;
1204
- st54:
1533
+ st67:
1205
1534
  if ( ++p == pe )
1206
- goto _out54;
1207
- case 54:
1535
+ goto _test_eof67;
1536
+ case 67:
1208
1537
  switch( (*p) ) {
1209
1538
  case 32: goto tr2;
1210
- case 36: goto st55;
1211
- case 95: goto st55;
1539
+ case 36: goto st68;
1540
+ case 95: goto st68;
1212
1541
  }
1213
1542
  if ( (*p) < 48 ) {
1214
1543
  if ( 45 <= (*p) && (*p) <= 46 )
1215
- goto st55;
1544
+ goto st68;
1216
1545
  } else if ( (*p) > 57 ) {
1217
1546
  if ( 65 <= (*p) && (*p) <= 90 )
1218
- goto st55;
1547
+ goto st68;
1219
1548
  } else
1220
- goto st55;
1549
+ goto st68;
1221
1550
  goto st0;
1222
- st55:
1551
+ st68:
1223
1552
  if ( ++p == pe )
1224
- goto _out55;
1225
- case 55:
1553
+ goto _test_eof68;
1554
+ case 68:
1226
1555
  switch( (*p) ) {
1227
1556
  case 32: goto tr2;
1228
- case 36: goto st56;
1229
- case 95: goto st56;
1557
+ case 36: goto st69;
1558
+ case 95: goto st69;
1230
1559
  }
1231
1560
  if ( (*p) < 48 ) {
1232
1561
  if ( 45 <= (*p) && (*p) <= 46 )
1233
- goto st56;
1562
+ goto st69;
1234
1563
  } else if ( (*p) > 57 ) {
1235
1564
  if ( 65 <= (*p) && (*p) <= 90 )
1236
- goto st56;
1565
+ goto st69;
1237
1566
  } else
1238
- goto st56;
1567
+ goto st69;
1239
1568
  goto st0;
1240
- st56:
1569
+ st69:
1241
1570
  if ( ++p == pe )
1242
- goto _out56;
1243
- case 56:
1571
+ goto _test_eof69;
1572
+ case 69:
1244
1573
  switch( (*p) ) {
1245
1574
  case 32: goto tr2;
1246
- case 36: goto st57;
1247
- case 95: goto st57;
1575
+ case 36: goto st70;
1576
+ case 95: goto st70;
1248
1577
  }
1249
1578
  if ( (*p) < 48 ) {
1250
1579
  if ( 45 <= (*p) && (*p) <= 46 )
1251
- goto st57;
1580
+ goto st70;
1252
1581
  } else if ( (*p) > 57 ) {
1253
1582
  if ( 65 <= (*p) && (*p) <= 90 )
1254
- goto st57;
1583
+ goto st70;
1255
1584
  } else
1256
- goto st57;
1585
+ goto st70;
1257
1586
  goto st0;
1258
- st57:
1587
+ st70:
1259
1588
  if ( ++p == pe )
1260
- goto _out57;
1261
- case 57:
1589
+ goto _test_eof70;
1590
+ case 70:
1262
1591
  switch( (*p) ) {
1263
1592
  case 32: goto tr2;
1264
- case 36: goto st58;
1265
- case 95: goto st58;
1593
+ case 36: goto st71;
1594
+ case 95: goto st71;
1266
1595
  }
1267
1596
  if ( (*p) < 48 ) {
1268
1597
  if ( 45 <= (*p) && (*p) <= 46 )
1269
- goto st58;
1598
+ goto st71;
1270
1599
  } else if ( (*p) > 57 ) {
1271
1600
  if ( 65 <= (*p) && (*p) <= 90 )
1272
- goto st58;
1601
+ goto st71;
1273
1602
  } else
1274
- goto st58;
1603
+ goto st71;
1275
1604
  goto st0;
1276
- st58:
1605
+ st71:
1277
1606
  if ( ++p == pe )
1278
- goto _out58;
1279
- case 58:
1607
+ goto _test_eof71;
1608
+ case 71:
1280
1609
  switch( (*p) ) {
1281
1610
  case 32: goto tr2;
1282
- case 36: goto st59;
1283
- case 95: goto st59;
1611
+ case 36: goto st72;
1612
+ case 95: goto st72;
1284
1613
  }
1285
1614
  if ( (*p) < 48 ) {
1286
1615
  if ( 45 <= (*p) && (*p) <= 46 )
1287
- goto st59;
1616
+ goto st72;
1288
1617
  } else if ( (*p) > 57 ) {
1289
1618
  if ( 65 <= (*p) && (*p) <= 90 )
1290
- goto st59;
1619
+ goto st72;
1291
1620
  } else
1292
- goto st59;
1621
+ goto st72;
1293
1622
  goto st0;
1294
- st59:
1623
+ st72:
1295
1624
  if ( ++p == pe )
1296
- goto _out59;
1297
- case 59:
1625
+ goto _test_eof72;
1626
+ case 72:
1298
1627
  switch( (*p) ) {
1299
1628
  case 32: goto tr2;
1300
- case 36: goto st60;
1301
- case 95: goto st60;
1629
+ case 36: goto st73;
1630
+ case 95: goto st73;
1302
1631
  }
1303
1632
  if ( (*p) < 48 ) {
1304
1633
  if ( 45 <= (*p) && (*p) <= 46 )
1305
- goto st60;
1634
+ goto st73;
1306
1635
  } else if ( (*p) > 57 ) {
1307
1636
  if ( 65 <= (*p) && (*p) <= 90 )
1308
- goto st60;
1637
+ goto st73;
1309
1638
  } else
1310
- goto st60;
1639
+ goto st73;
1311
1640
  goto st0;
1312
- st60:
1641
+ st73:
1313
1642
  if ( ++p == pe )
1314
- goto _out60;
1315
- case 60:
1643
+ goto _test_eof73;
1644
+ case 73:
1316
1645
  switch( (*p) ) {
1317
1646
  case 32: goto tr2;
1318
- case 36: goto st61;
1319
- case 95: goto st61;
1647
+ case 36: goto st74;
1648
+ case 95: goto st74;
1320
1649
  }
1321
1650
  if ( (*p) < 48 ) {
1322
1651
  if ( 45 <= (*p) && (*p) <= 46 )
1323
- goto st61;
1652
+ goto st74;
1324
1653
  } else if ( (*p) > 57 ) {
1325
1654
  if ( 65 <= (*p) && (*p) <= 90 )
1326
- goto st61;
1655
+ goto st74;
1327
1656
  } else
1328
- goto st61;
1657
+ goto st74;
1329
1658
  goto st0;
1330
- st61:
1659
+ st74:
1331
1660
  if ( ++p == pe )
1332
- goto _out61;
1333
- case 61:
1661
+ goto _test_eof74;
1662
+ case 74:
1334
1663
  switch( (*p) ) {
1335
1664
  case 32: goto tr2;
1336
- case 36: goto st62;
1337
- case 95: goto st62;
1665
+ case 36: goto st75;
1666
+ case 95: goto st75;
1338
1667
  }
1339
1668
  if ( (*p) < 48 ) {
1340
1669
  if ( 45 <= (*p) && (*p) <= 46 )
1341
- goto st62;
1670
+ goto st75;
1342
1671
  } else if ( (*p) > 57 ) {
1343
1672
  if ( 65 <= (*p) && (*p) <= 90 )
1344
- goto st62;
1673
+ goto st75;
1345
1674
  } else
1346
- goto st62;
1675
+ goto st75;
1347
1676
  goto st0;
1348
- st62:
1677
+ st75:
1349
1678
  if ( ++p == pe )
1350
- goto _out62;
1351
- case 62:
1679
+ goto _test_eof75;
1680
+ case 75:
1352
1681
  switch( (*p) ) {
1353
1682
  case 32: goto tr2;
1354
- case 36: goto st63;
1355
- case 95: goto st63;
1683
+ case 36: goto st76;
1684
+ case 95: goto st76;
1356
1685
  }
1357
1686
  if ( (*p) < 48 ) {
1358
1687
  if ( 45 <= (*p) && (*p) <= 46 )
1359
- goto st63;
1688
+ goto st76;
1360
1689
  } else if ( (*p) > 57 ) {
1361
1690
  if ( 65 <= (*p) && (*p) <= 90 )
1362
- goto st63;
1691
+ goto st76;
1363
1692
  } else
1364
- goto st63;
1693
+ goto st76;
1365
1694
  goto st0;
1366
- st63:
1695
+ st76:
1367
1696
  if ( ++p == pe )
1368
- goto _out63;
1369
- case 63:
1697
+ goto _test_eof76;
1698
+ case 76:
1370
1699
  switch( (*p) ) {
1371
1700
  case 32: goto tr2;
1372
- case 36: goto st64;
1373
- case 95: goto st64;
1701
+ case 36: goto st77;
1702
+ case 95: goto st77;
1374
1703
  }
1375
1704
  if ( (*p) < 48 ) {
1376
1705
  if ( 45 <= (*p) && (*p) <= 46 )
1377
- goto st64;
1706
+ goto st77;
1378
1707
  } else if ( (*p) > 57 ) {
1379
1708
  if ( 65 <= (*p) && (*p) <= 90 )
1380
- goto st64;
1709
+ goto st77;
1381
1710
  } else
1382
- goto st64;
1711
+ goto st77;
1383
1712
  goto st0;
1384
- st64:
1713
+ st77:
1385
1714
  if ( ++p == pe )
1386
- goto _out64;
1387
- case 64:
1715
+ goto _test_eof77;
1716
+ case 77:
1388
1717
  switch( (*p) ) {
1389
1718
  case 32: goto tr2;
1390
- case 36: goto st65;
1391
- case 95: goto st65;
1719
+ case 36: goto st78;
1720
+ case 95: goto st78;
1392
1721
  }
1393
1722
  if ( (*p) < 48 ) {
1394
1723
  if ( 45 <= (*p) && (*p) <= 46 )
1395
- goto st65;
1724
+ goto st78;
1396
1725
  } else if ( (*p) > 57 ) {
1397
1726
  if ( 65 <= (*p) && (*p) <= 90 )
1398
- goto st65;
1727
+ goto st78;
1399
1728
  } else
1400
- goto st65;
1729
+ goto st78;
1401
1730
  goto st0;
1402
- st65:
1731
+ st78:
1403
1732
  if ( ++p == pe )
1404
- goto _out65;
1405
- case 65:
1733
+ goto _test_eof78;
1734
+ case 78:
1406
1735
  switch( (*p) ) {
1407
1736
  case 32: goto tr2;
1408
- case 36: goto st66;
1409
- case 95: goto st66;
1737
+ case 36: goto st79;
1738
+ case 95: goto st79;
1410
1739
  }
1411
1740
  if ( (*p) < 48 ) {
1412
1741
  if ( 45 <= (*p) && (*p) <= 46 )
1413
- goto st66;
1742
+ goto st79;
1414
1743
  } else if ( (*p) > 57 ) {
1415
1744
  if ( 65 <= (*p) && (*p) <= 90 )
1416
- goto st66;
1745
+ goto st79;
1417
1746
  } else
1418
- goto st66;
1747
+ goto st79;
1419
1748
  goto st0;
1420
- st66:
1749
+ st79:
1421
1750
  if ( ++p == pe )
1422
- goto _out66;
1423
- case 66:
1751
+ goto _test_eof79;
1752
+ case 79:
1424
1753
  switch( (*p) ) {
1425
1754
  case 32: goto tr2;
1426
- case 36: goto st67;
1427
- case 95: goto st67;
1755
+ case 36: goto st80;
1756
+ case 95: goto st80;
1428
1757
  }
1429
1758
  if ( (*p) < 48 ) {
1430
1759
  if ( 45 <= (*p) && (*p) <= 46 )
1431
- goto st67;
1760
+ goto st80;
1432
1761
  } else if ( (*p) > 57 ) {
1433
1762
  if ( 65 <= (*p) && (*p) <= 90 )
1434
- goto st67;
1763
+ goto st80;
1435
1764
  } else
1436
- goto st67;
1765
+ goto st80;
1437
1766
  goto st0;
1438
- st67:
1767
+ st80:
1439
1768
  if ( ++p == pe )
1440
- goto _out67;
1441
- case 67:
1769
+ goto _test_eof80;
1770
+ case 80:
1442
1771
  switch( (*p) ) {
1443
1772
  case 32: goto tr2;
1444
- case 36: goto st68;
1445
- case 95: goto st68;
1773
+ case 36: goto st81;
1774
+ case 95: goto st81;
1446
1775
  }
1447
1776
  if ( (*p) < 48 ) {
1448
1777
  if ( 45 <= (*p) && (*p) <= 46 )
1449
- goto st68;
1778
+ goto st81;
1450
1779
  } else if ( (*p) > 57 ) {
1451
1780
  if ( 65 <= (*p) && (*p) <= 90 )
1452
- goto st68;
1781
+ goto st81;
1453
1782
  } else
1454
- goto st68;
1783
+ goto st81;
1455
1784
  goto st0;
1456
- st68:
1785
+ st81:
1457
1786
  if ( ++p == pe )
1458
- goto _out68;
1459
- case 68:
1787
+ goto _test_eof81;
1788
+ case 81:
1460
1789
  if ( (*p) == 32 )
1461
1790
  goto tr2;
1462
1791
  goto st0;
1463
1792
  }
1464
- _out0: cs = 0; goto _out;
1465
- _out2: cs = 2; goto _out;
1466
- _out3: cs = 3; goto _out;
1467
- _out4: cs = 4; goto _out;
1468
- _out5: cs = 5; goto _out;
1469
- _out6: cs = 6; goto _out;
1470
- _out7: cs = 7; goto _out;
1471
- _out8: cs = 8; goto _out;
1472
- _out9: cs = 9; goto _out;
1473
- _out10: cs = 10; goto _out;
1474
- _out11: cs = 11; goto _out;
1475
- _out12: cs = 12; goto _out;
1476
- _out13: cs = 13; goto _out;
1477
- _out14: cs = 14; goto _out;
1478
- _out15: cs = 15; goto _out;
1479
- _out16: cs = 16; goto _out;
1480
- _out69: cs = 69; goto _out;
1481
- _out17: cs = 17; goto _out;
1482
- _out18: cs = 18; goto _out;
1483
- _out19: cs = 19; goto _out;
1484
- _out20: cs = 20; goto _out;
1485
- _out21: cs = 21; goto _out;
1486
- _out22: cs = 22; goto _out;
1487
- _out23: cs = 23; goto _out;
1488
- _out24: cs = 24; goto _out;
1489
- _out25: cs = 25; goto _out;
1490
- _out26: cs = 26; goto _out;
1491
- _out27: cs = 27; goto _out;
1492
- _out28: cs = 28; goto _out;
1493
- _out29: cs = 29; goto _out;
1494
- _out30: cs = 30; goto _out;
1495
- _out31: cs = 31; goto _out;
1496
- _out32: cs = 32; goto _out;
1497
- _out33: cs = 33; goto _out;
1498
- _out34: cs = 34; goto _out;
1499
- _out35: cs = 35; goto _out;
1500
- _out36: cs = 36; goto _out;
1501
- _out37: cs = 37; goto _out;
1502
- _out38: cs = 38; goto _out;
1503
- _out39: cs = 39; goto _out;
1504
- _out40: cs = 40; goto _out;
1505
- _out41: cs = 41; goto _out;
1506
- _out42: cs = 42; goto _out;
1507
- _out43: cs = 43; goto _out;
1508
- _out44: cs = 44; goto _out;
1509
- _out45: cs = 45; goto _out;
1510
- _out46: cs = 46; goto _out;
1511
- _out47: cs = 47; goto _out;
1512
- _out48: cs = 48; goto _out;
1513
- _out49: cs = 49; goto _out;
1514
- _out50: cs = 50; goto _out;
1515
- _out51: cs = 51; goto _out;
1516
- _out52: cs = 52; goto _out;
1517
- _out53: cs = 53; goto _out;
1518
- _out54: cs = 54; goto _out;
1519
- _out55: cs = 55; goto _out;
1520
- _out56: cs = 56; goto _out;
1521
- _out57: cs = 57; goto _out;
1522
- _out58: cs = 58; goto _out;
1523
- _out59: cs = 59; goto _out;
1524
- _out60: cs = 60; goto _out;
1525
- _out61: cs = 61; goto _out;
1526
- _out62: cs = 62; goto _out;
1527
- _out63: cs = 63; goto _out;
1528
- _out64: cs = 64; goto _out;
1529
- _out65: cs = 65; goto _out;
1530
- _out66: cs = 66; goto _out;
1531
- _out67: cs = 67; goto _out;
1532
- _out68: cs = 68; goto _out;
1793
+ _test_eof2: cs = 2; goto _test_eof;
1794
+ _test_eof3: cs = 3; goto _test_eof;
1795
+ _test_eof4: cs = 4; goto _test_eof;
1796
+ _test_eof5: cs = 5; goto _test_eof;
1797
+ _test_eof6: cs = 6; goto _test_eof;
1798
+ _test_eof7: cs = 7; goto _test_eof;
1799
+ _test_eof8: cs = 8; goto _test_eof;
1800
+ _test_eof9: cs = 9; goto _test_eof;
1801
+ _test_eof10: cs = 10; goto _test_eof;
1802
+ _test_eof11: cs = 11; goto _test_eof;
1803
+ _test_eof12: cs = 12; goto _test_eof;
1804
+ _test_eof13: cs = 13; goto _test_eof;
1805
+ _test_eof14: cs = 14; goto _test_eof;
1806
+ _test_eof15: cs = 15; goto _test_eof;
1807
+ _test_eof16: cs = 16; goto _test_eof;
1808
+ _test_eof82: cs = 82; goto _test_eof;
1809
+ _test_eof17: cs = 17; goto _test_eof;
1810
+ _test_eof18: cs = 18; goto _test_eof;
1811
+ _test_eof19: cs = 19; goto _test_eof;
1812
+ _test_eof20: cs = 20; goto _test_eof;
1813
+ _test_eof21: cs = 21; goto _test_eof;
1814
+ _test_eof22: cs = 22; goto _test_eof;
1815
+ _test_eof23: cs = 23; goto _test_eof;
1816
+ _test_eof24: cs = 24; goto _test_eof;
1817
+ _test_eof25: cs = 25; goto _test_eof;
1818
+ _test_eof26: cs = 26; goto _test_eof;
1819
+ _test_eof27: cs = 27; goto _test_eof;
1820
+ _test_eof28: cs = 28; goto _test_eof;
1821
+ _test_eof29: cs = 29; goto _test_eof;
1822
+ _test_eof30: cs = 30; goto _test_eof;
1823
+ _test_eof31: cs = 31; goto _test_eof;
1824
+ _test_eof32: cs = 32; goto _test_eof;
1825
+ _test_eof33: cs = 33; goto _test_eof;
1826
+ _test_eof34: cs = 34; goto _test_eof;
1827
+ _test_eof35: cs = 35; goto _test_eof;
1828
+ _test_eof36: cs = 36; goto _test_eof;
1829
+ _test_eof37: cs = 37; goto _test_eof;
1830
+ _test_eof38: cs = 38; goto _test_eof;
1831
+ _test_eof39: cs = 39; goto _test_eof;
1832
+ _test_eof40: cs = 40; goto _test_eof;
1833
+ _test_eof41: cs = 41; goto _test_eof;
1834
+ _test_eof42: cs = 42; goto _test_eof;
1835
+ _test_eof43: cs = 43; goto _test_eof;
1836
+ _test_eof44: cs = 44; goto _test_eof;
1837
+ _test_eof45: cs = 45; goto _test_eof;
1838
+ _test_eof46: cs = 46; goto _test_eof;
1839
+ _test_eof47: cs = 47; goto _test_eof;
1840
+ _test_eof48: cs = 48; goto _test_eof;
1841
+ _test_eof49: cs = 49; goto _test_eof;
1842
+ _test_eof50: cs = 50; goto _test_eof;
1843
+ _test_eof51: cs = 51; goto _test_eof;
1844
+ _test_eof52: cs = 52; goto _test_eof;
1845
+ _test_eof53: cs = 53; goto _test_eof;
1846
+ _test_eof54: cs = 54; goto _test_eof;
1847
+ _test_eof55: cs = 55; goto _test_eof;
1848
+ _test_eof56: cs = 56; goto _test_eof;
1849
+ _test_eof57: cs = 57; goto _test_eof;
1850
+ _test_eof58: cs = 58; goto _test_eof;
1851
+ _test_eof59: cs = 59; goto _test_eof;
1852
+ _test_eof60: cs = 60; goto _test_eof;
1853
+ _test_eof61: cs = 61; goto _test_eof;
1854
+ _test_eof62: cs = 62; goto _test_eof;
1855
+ _test_eof63: cs = 63; goto _test_eof;
1856
+ _test_eof64: cs = 64; goto _test_eof;
1857
+ _test_eof65: cs = 65; goto _test_eof;
1858
+ _test_eof66: cs = 66; goto _test_eof;
1859
+ _test_eof67: cs = 67; goto _test_eof;
1860
+ _test_eof68: cs = 68; goto _test_eof;
1861
+ _test_eof69: cs = 69; goto _test_eof;
1862
+ _test_eof70: cs = 70; goto _test_eof;
1863
+ _test_eof71: cs = 71; goto _test_eof;
1864
+ _test_eof72: cs = 72; goto _test_eof;
1865
+ _test_eof73: cs = 73; goto _test_eof;
1866
+ _test_eof74: cs = 74; goto _test_eof;
1867
+ _test_eof75: cs = 75; goto _test_eof;
1868
+ _test_eof76: cs = 76; goto _test_eof;
1869
+ _test_eof77: cs = 77; goto _test_eof;
1870
+ _test_eof78: cs = 78; goto _test_eof;
1871
+ _test_eof79: cs = 79; goto _test_eof;
1872
+ _test_eof80: cs = 80; goto _test_eof;
1873
+ _test_eof81: cs = 81; goto _test_eof;
1533
1874
 
1875
+ _test_eof: {}
1534
1876
  _out: {}
1535
1877
  }
1536
- #line 157 "src/parser.rl"
1537
-
1878
+ #line 202 "src/parser.rl"
1879
+
1538
1880
  parser->cs = cs;
1539
1881
  parser->nread += p - (buffer + off);
1540
-
1882
+
1541
1883
  assert(p <= pe && "buffer overflow after parsing execute");
1542
1884
  assert(parser->nread <= len && "nread longer than length");
1543
1885
  assert(parser->body_start <= len && "body starts after buffer end");
1544
1886
  assert(parser->mark < len && "mark is after buffer end");
1545
1887
  assert(parser->field_len <= len && "field has length longer than whole buffer");
1546
1888
  assert(parser->field_start < len && "field starts after buffer end");
1547
-
1889
+
1890
+ /* Ragel 6 does not use write eof; no need for this
1548
1891
  if(parser->body_start) {
1549
- /* final \r\n combo encountered so stop right here */
1550
-
1551
- #line 1552 "src/parser.c"
1552
- #line 171 "src/parser.rl"
1892
+ // final \r\n combo encountered so stop right here
1553
1893
  parser->nread++;
1894
+ %% write eof;
1554
1895
  }
1555
-
1896
+ */
1897
+
1556
1898
  return(parser->nread);
1557
1899
  }
1558
1900
 
1559
1901
  int http_parser_finish(http_parser *parser)
1560
1902
  {
1561
- int cs = parser->cs;
1562
-
1563
-
1564
- #line 1565 "src/parser.c"
1565
- #line 182 "src/parser.rl"
1566
-
1567
- parser->cs = cs;
1568
-
1569
- if (http_parser_has_error(parser) ) {
1903
+ if (http_parser_has_error(parser))
1570
1904
  return -1;
1571
- } else if (http_parser_is_finished(parser) ) {
1905
+ else if (http_parser_is_finished(parser))
1572
1906
  return 1;
1573
- } else {
1907
+ else
1574
1908
  return 0;
1575
- }
1576
1909
  }
1577
1910
 
1578
1911
  int http_parser_has_error(http_parser *parser) {
1579
- return parser->cs == http_parser_error;
1912
+ return parser->cs == http_parser_error || parser->overflow_error;
1580
1913
  }
1581
1914
 
1582
1915
  int http_parser_is_finished(http_parser *parser) {
1583
- return parser->cs == http_parser_first_final;
1584
- }
1916
+ return parser->cs >= http_parser_first_final;
1917
+ }