thin 1.0.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of thin might be problematic. Click here for more details.
- data/CHANGELOG +26 -0
- data/example/async_app.ru +126 -0
- data/example/async_chat.ru +247 -0
- data/example/async_tailer.ru +100 -0
- data/example/config.ru +1 -1
- data/ext/thin_parser/parser.c +299 -1065
- data/ext/thin_parser/parser.rl +7 -9
- data/ext/thin_parser/thin.c +36 -36
- data/lib/rack/adapter/rails.rb +31 -23
- data/lib/thin.rb +2 -3
- data/lib/thin/command.rb +4 -3
- data/lib/thin/connection.rb +51 -15
- data/lib/thin/controllers/cluster.rb +7 -1
- data/lib/thin/controllers/controller.rb +1 -0
- data/lib/thin/request.rb +16 -2
- data/lib/thin/response.rb +4 -2
- data/lib/thin/runner.rb +1 -1
- data/lib/thin/version.rb +5 -5
- data/lib/thin_parser.bundle +0 -0
- data/spec/command_spec.rb +6 -1
- data/spec/controllers/cluster_spec.rb +33 -0
- data/spec/controllers/controller_spec.rb +11 -3
- data/spec/request/parser_spec.rb +28 -4
- data/spec/response_spec.rb +8 -0
- data/spec/runner_spec.rb +3 -2
- data/spec/server/pipelining_spec.rb +1 -0
- data/spec/server/stopping_spec.rb +13 -3
- data/spec/spec_helper.rb +2 -2
- data/tasks/gem.rake +9 -3
- metadata +9 -8
- data/COMMITTERS +0 -3
- data/lib/rack/handler/thin.rb +0 -18
data/example/config.ru
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# Check Rack::Builder doc for more details on this file format:
|
7
7
|
# http://rack.rubyforge.org/doc/classes/Rack/Builder.html
|
8
8
|
|
9
|
-
require File.dirname(__FILE__) + '/../lib/thin'
|
9
|
+
require ::File.dirname(__FILE__) + '/../lib/thin'
|
10
10
|
|
11
11
|
app = proc do |env|
|
12
12
|
# Response body has to respond to each and yield strings
|
data/ext/thin_parser/parser.c
CHANGED
@@ -22,6 +22,174 @@
|
|
22
22
|
/** Data **/
|
23
23
|
|
24
24
|
#line 25 "parser.c"
|
25
|
+
static const char _http_parser_actions[] = {
|
26
|
+
0, 1, 0, 1, 1, 1, 2, 1,
|
27
|
+
3, 1, 4, 1, 5, 1, 6, 1,
|
28
|
+
7, 1, 8, 1, 10, 1, 11, 1,
|
29
|
+
12, 2, 0, 7, 2, 3, 4, 2,
|
30
|
+
9, 6, 2, 11, 6, 3, 8, 9,
|
31
|
+
6
|
32
|
+
};
|
33
|
+
|
34
|
+
static const short _http_parser_key_offsets[] = {
|
35
|
+
0, 0, 8, 17, 27, 29, 30, 31,
|
36
|
+
32, 33, 34, 36, 39, 41, 44, 45,
|
37
|
+
61, 62, 78, 80, 81, 87, 93, 99,
|
38
|
+
105, 115, 121, 127, 133, 141, 147, 153,
|
39
|
+
160, 166, 172, 178, 184, 190, 196, 205,
|
40
|
+
214, 223, 232, 241, 250, 259, 268, 277,
|
41
|
+
286, 295, 304, 313, 322, 331, 340, 349,
|
42
|
+
358, 359
|
43
|
+
};
|
44
|
+
|
45
|
+
static const char _http_parser_trans_keys[] = {
|
46
|
+
36, 95, 45, 46, 48, 57, 65, 90,
|
47
|
+
32, 36, 95, 45, 46, 48, 57, 65,
|
48
|
+
90, 42, 43, 47, 58, 45, 57, 65,
|
49
|
+
90, 97, 122, 32, 35, 72, 84, 84,
|
50
|
+
80, 47, 48, 57, 46, 48, 57, 48,
|
51
|
+
57, 13, 48, 57, 10, 13, 33, 124,
|
52
|
+
126, 35, 39, 42, 43, 45, 46, 48,
|
53
|
+
57, 65, 90, 94, 122, 10, 33, 58,
|
54
|
+
124, 126, 35, 39, 42, 43, 45, 46,
|
55
|
+
48, 57, 65, 90, 94, 122, 13, 32,
|
56
|
+
13, 32, 35, 37, 127, 0, 31, 32,
|
57
|
+
35, 37, 127, 0, 31, 48, 57, 65,
|
58
|
+
70, 97, 102, 48, 57, 65, 70, 97,
|
59
|
+
102, 43, 58, 45, 46, 48, 57, 65,
|
60
|
+
90, 97, 122, 32, 35, 37, 127, 0,
|
61
|
+
31, 48, 57, 65, 70, 97, 102, 48,
|
62
|
+
57, 65, 70, 97, 102, 32, 35, 37,
|
63
|
+
59, 63, 127, 0, 31, 48, 57, 65,
|
64
|
+
70, 97, 102, 48, 57, 65, 70, 97,
|
65
|
+
102, 32, 35, 37, 63, 127, 0, 31,
|
66
|
+
48, 57, 65, 70, 97, 102, 48, 57,
|
67
|
+
65, 70, 97, 102, 32, 35, 37, 127,
|
68
|
+
0, 31, 32, 35, 37, 127, 0, 31,
|
69
|
+
48, 57, 65, 70, 97, 102, 48, 57,
|
70
|
+
65, 70, 97, 102, 32, 36, 95, 45,
|
71
|
+
46, 48, 57, 65, 90, 32, 36, 95,
|
72
|
+
45, 46, 48, 57, 65, 90, 32, 36,
|
73
|
+
95, 45, 46, 48, 57, 65, 90, 32,
|
74
|
+
36, 95, 45, 46, 48, 57, 65, 90,
|
75
|
+
32, 36, 95, 45, 46, 48, 57, 65,
|
76
|
+
90, 32, 36, 95, 45, 46, 48, 57,
|
77
|
+
65, 90, 32, 36, 95, 45, 46, 48,
|
78
|
+
57, 65, 90, 32, 36, 95, 45, 46,
|
79
|
+
48, 57, 65, 90, 32, 36, 95, 45,
|
80
|
+
46, 48, 57, 65, 90, 32, 36, 95,
|
81
|
+
45, 46, 48, 57, 65, 90, 32, 36,
|
82
|
+
95, 45, 46, 48, 57, 65, 90, 32,
|
83
|
+
36, 95, 45, 46, 48, 57, 65, 90,
|
84
|
+
32, 36, 95, 45, 46, 48, 57, 65,
|
85
|
+
90, 32, 36, 95, 45, 46, 48, 57,
|
86
|
+
65, 90, 32, 36, 95, 45, 46, 48,
|
87
|
+
57, 65, 90, 32, 36, 95, 45, 46,
|
88
|
+
48, 57, 65, 90, 32, 36, 95, 45,
|
89
|
+
46, 48, 57, 65, 90, 32, 36, 95,
|
90
|
+
45, 46, 48, 57, 65, 90, 32, 0
|
91
|
+
};
|
92
|
+
|
93
|
+
static const char _http_parser_single_lengths[] = {
|
94
|
+
0, 2, 3, 4, 2, 1, 1, 1,
|
95
|
+
1, 1, 0, 1, 0, 1, 1, 4,
|
96
|
+
1, 4, 2, 1, 4, 4, 0, 0,
|
97
|
+
2, 4, 0, 0, 6, 0, 0, 5,
|
98
|
+
0, 0, 4, 4, 0, 0, 3, 3,
|
99
|
+
3, 3, 3, 3, 3, 3, 3, 3,
|
100
|
+
3, 3, 3, 3, 3, 3, 3, 3,
|
101
|
+
1, 0
|
102
|
+
};
|
103
|
+
|
104
|
+
static const char _http_parser_range_lengths[] = {
|
105
|
+
0, 3, 3, 3, 0, 0, 0, 0,
|
106
|
+
0, 0, 1, 1, 1, 1, 0, 6,
|
107
|
+
0, 6, 0, 0, 1, 1, 3, 3,
|
108
|
+
4, 1, 3, 3, 1, 3, 3, 1,
|
109
|
+
3, 3, 1, 1, 3, 3, 3, 3,
|
110
|
+
3, 3, 3, 3, 3, 3, 3, 3,
|
111
|
+
3, 3, 3, 3, 3, 3, 3, 3,
|
112
|
+
0, 0
|
113
|
+
};
|
114
|
+
|
115
|
+
static const short _http_parser_index_offsets[] = {
|
116
|
+
0, 0, 6, 13, 21, 24, 26, 28,
|
117
|
+
30, 32, 34, 36, 39, 41, 44, 46,
|
118
|
+
57, 59, 70, 73, 75, 81, 87, 91,
|
119
|
+
95, 102, 108, 112, 116, 124, 128, 132,
|
120
|
+
139, 143, 147, 153, 159, 163, 167, 174,
|
121
|
+
181, 188, 195, 202, 209, 216, 223, 230,
|
122
|
+
237, 244, 251, 258, 265, 272, 279, 286,
|
123
|
+
293, 295
|
124
|
+
};
|
125
|
+
|
126
|
+
static const char _http_parser_indicies[] = {
|
127
|
+
0, 0, 0, 0, 0, 1, 2, 3,
|
128
|
+
3, 3, 3, 3, 1, 4, 5, 6,
|
129
|
+
7, 5, 5, 5, 1, 8, 9, 1,
|
130
|
+
10, 1, 11, 1, 12, 1, 13, 1,
|
131
|
+
14, 1, 15, 1, 16, 15, 1, 17,
|
132
|
+
1, 18, 17, 1, 19, 1, 20, 21,
|
133
|
+
21, 21, 21, 21, 21, 21, 21, 21,
|
134
|
+
1, 22, 1, 23, 24, 23, 23, 23,
|
135
|
+
23, 23, 23, 23, 23, 1, 26, 27,
|
136
|
+
25, 29, 28, 31, 1, 32, 1, 1,
|
137
|
+
30, 34, 1, 35, 1, 1, 33, 36,
|
138
|
+
36, 36, 1, 33, 33, 33, 1, 37,
|
139
|
+
38, 37, 37, 37, 37, 1, 8, 9,
|
140
|
+
39, 1, 1, 38, 40, 40, 40, 1,
|
141
|
+
38, 38, 38, 1, 42, 43, 44, 45,
|
142
|
+
46, 1, 1, 41, 47, 47, 47, 1,
|
143
|
+
41, 41, 41, 1, 8, 9, 49, 50,
|
144
|
+
1, 1, 48, 51, 51, 51, 1, 48,
|
145
|
+
48, 48, 1, 53, 54, 55, 1, 1,
|
146
|
+
52, 57, 58, 59, 1, 1, 56, 60,
|
147
|
+
60, 60, 1, 56, 56, 56, 1, 2,
|
148
|
+
61, 61, 61, 61, 61, 1, 2, 62,
|
149
|
+
62, 62, 62, 62, 1, 2, 63, 63,
|
150
|
+
63, 63, 63, 1, 2, 64, 64, 64,
|
151
|
+
64, 64, 1, 2, 65, 65, 65, 65,
|
152
|
+
65, 1, 2, 66, 66, 66, 66, 66,
|
153
|
+
1, 2, 67, 67, 67, 67, 67, 1,
|
154
|
+
2, 68, 68, 68, 68, 68, 1, 2,
|
155
|
+
69, 69, 69, 69, 69, 1, 2, 70,
|
156
|
+
70, 70, 70, 70, 1, 2, 71, 71,
|
157
|
+
71, 71, 71, 1, 2, 72, 72, 72,
|
158
|
+
72, 72, 1, 2, 73, 73, 73, 73,
|
159
|
+
73, 1, 2, 74, 74, 74, 74, 74,
|
160
|
+
1, 2, 75, 75, 75, 75, 75, 1,
|
161
|
+
2, 76, 76, 76, 76, 76, 1, 2,
|
162
|
+
77, 77, 77, 77, 77, 1, 2, 78,
|
163
|
+
78, 78, 78, 78, 1, 2, 1, 1,
|
164
|
+
0
|
165
|
+
};
|
166
|
+
|
167
|
+
static const char _http_parser_trans_targs[] = {
|
168
|
+
2, 0, 3, 38, 4, 24, 28, 25,
|
169
|
+
5, 20, 6, 7, 8, 9, 10, 11,
|
170
|
+
12, 13, 14, 15, 16, 17, 57, 17,
|
171
|
+
18, 19, 14, 18, 19, 14, 21, 5,
|
172
|
+
22, 21, 5, 22, 23, 24, 25, 26,
|
173
|
+
27, 28, 5, 20, 29, 31, 34, 30,
|
174
|
+
31, 32, 34, 33, 35, 5, 20, 36,
|
175
|
+
35, 5, 20, 36, 37, 39, 40, 41,
|
176
|
+
42, 43, 44, 45, 46, 47, 48, 49,
|
177
|
+
50, 51, 52, 53, 54, 55, 56
|
178
|
+
};
|
179
|
+
|
180
|
+
static const char _http_parser_trans_actions[] = {
|
181
|
+
1, 0, 11, 0, 1, 1, 1, 1,
|
182
|
+
13, 13, 1, 0, 0, 0, 0, 0,
|
183
|
+
0, 0, 19, 0, 0, 3, 23, 0,
|
184
|
+
5, 7, 28, 7, 0, 9, 1, 25,
|
185
|
+
1, 0, 15, 0, 0, 0, 0, 0,
|
186
|
+
0, 0, 34, 34, 0, 21, 21, 0,
|
187
|
+
0, 0, 0, 0, 17, 37, 37, 17,
|
188
|
+
0, 31, 31, 0, 0, 0, 0, 0,
|
189
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
190
|
+
0, 0, 0, 0, 0, 0, 0
|
191
|
+
};
|
192
|
+
|
25
193
|
static const int http_parser_start = 1;
|
26
194
|
static const int http_parser_first_final = 57;
|
27
195
|
static const int http_parser_error = 0;
|
@@ -30,10 +198,10 @@ static const int http_parser_en_main = 1;
|
|
30
198
|
|
31
199
|
#line 85 "parser.rl"
|
32
200
|
|
33
|
-
int
|
201
|
+
int thin_http_parser_init(http_parser *parser) {
|
34
202
|
int cs = 0;
|
35
203
|
|
36
|
-
#line
|
204
|
+
#line 205 "parser.c"
|
37
205
|
{
|
38
206
|
cs = http_parser_start;
|
39
207
|
}
|
@@ -51,7 +219,7 @@ int http_parser_init(http_parser *parser) {
|
|
51
219
|
|
52
220
|
|
53
221
|
/** exec **/
|
54
|
-
size_t
|
222
|
+
size_t thin_http_parser_execute(http_parser *parser, const char *buffer, size_t len, size_t off) {
|
55
223
|
const char *p, *pe;
|
56
224
|
int cs = parser->cs;
|
57
225
|
|
@@ -65,1106 +233,178 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len,
|
|
65
233
|
|
66
234
|
|
67
235
|
|
68
|
-
#line
|
236
|
+
#line 237 "parser.c"
|
69
237
|
{
|
238
|
+
int _klen;
|
239
|
+
unsigned int _trans;
|
240
|
+
const char *_acts;
|
241
|
+
unsigned int _nacts;
|
242
|
+
const char *_keys;
|
243
|
+
|
70
244
|
if ( p == pe )
|
245
|
+
goto _test_eof;
|
246
|
+
if ( cs == 0 )
|
71
247
|
goto _out;
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
248
|
+
_resume:
|
249
|
+
_keys = _http_parser_trans_keys + _http_parser_key_offsets[cs];
|
250
|
+
_trans = _http_parser_index_offsets[cs];
|
251
|
+
|
252
|
+
_klen = _http_parser_single_lengths[cs];
|
253
|
+
if ( _klen > 0 ) {
|
254
|
+
const char *_lower = _keys;
|
255
|
+
const char *_mid;
|
256
|
+
const char *_upper = _keys + _klen - 1;
|
257
|
+
while (1) {
|
258
|
+
if ( _upper < _lower )
|
259
|
+
break;
|
260
|
+
|
261
|
+
_mid = _lower + ((_upper-_lower) >> 1);
|
262
|
+
if ( (*p) < *_mid )
|
263
|
+
_upper = _mid - 1;
|
264
|
+
else if ( (*p) > *_mid )
|
265
|
+
_lower = _mid + 1;
|
266
|
+
else {
|
267
|
+
_trans += (_mid - _keys);
|
268
|
+
goto _match;
|
269
|
+
}
|
270
|
+
}
|
271
|
+
_keys += _klen;
|
272
|
+
_trans += _klen;
|
273
|
+
}
|
274
|
+
|
275
|
+
_klen = _http_parser_range_lengths[cs];
|
276
|
+
if ( _klen > 0 ) {
|
277
|
+
const char *_lower = _keys;
|
278
|
+
const char *_mid;
|
279
|
+
const char *_upper = _keys + (_klen<<1) - 2;
|
280
|
+
while (1) {
|
281
|
+
if ( _upper < _lower )
|
282
|
+
break;
|
283
|
+
|
284
|
+
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
|
285
|
+
if ( (*p) < _mid[0] )
|
286
|
+
_upper = _mid - 2;
|
287
|
+
else if ( (*p) > _mid[1] )
|
288
|
+
_lower = _mid + 2;
|
289
|
+
else {
|
290
|
+
_trans += ((_mid - _keys)>>1);
|
291
|
+
goto _match;
|
292
|
+
}
|
293
|
+
}
|
294
|
+
_trans += _klen;
|
78
295
|
}
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
296
|
+
|
297
|
+
_match:
|
298
|
+
_trans = _http_parser_indicies[_trans];
|
299
|
+
cs = _http_parser_trans_targs[_trans];
|
300
|
+
|
301
|
+
if ( _http_parser_trans_actions[_trans] == 0 )
|
302
|
+
goto _again;
|
303
|
+
|
304
|
+
_acts = _http_parser_actions + _http_parser_trans_actions[_trans];
|
305
|
+
_nacts = (unsigned int) *_acts++;
|
306
|
+
while ( _nacts-- > 0 )
|
307
|
+
{
|
308
|
+
switch ( *_acts++ )
|
309
|
+
{
|
310
|
+
case 0:
|
91
311
|
#line 22 "parser.rl"
|
92
312
|
{MARK(mark, p); }
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
313
|
+
break;
|
314
|
+
case 1:
|
315
|
+
#line 25 "parser.rl"
|
316
|
+
{ MARK(field_start, p); }
|
317
|
+
break;
|
318
|
+
case 2:
|
319
|
+
#line 26 "parser.rl"
|
320
|
+
{
|
321
|
+
parser->field_len = LEN(field_start, p);
|
322
|
+
}
|
323
|
+
break;
|
324
|
+
case 3:
|
325
|
+
#line 30 "parser.rl"
|
326
|
+
{ MARK(mark, p); }
|
327
|
+
break;
|
328
|
+
case 4:
|
329
|
+
#line 31 "parser.rl"
|
330
|
+
{
|
331
|
+
if (parser->http_field != NULL) {
|
332
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
333
|
+
}
|
334
|
+
}
|
335
|
+
break;
|
336
|
+
case 5:
|
114
337
|
#line 36 "parser.rl"
|
115
338
|
{
|
116
339
|
if (parser->request_method != NULL) {
|
117
340
|
parser->request_method(parser->data, PTR_TO(mark), LEN(mark, p));
|
118
341
|
}
|
119
342
|
}
|
120
|
-
|
121
|
-
|
122
|
-
if ( ++p == pe )
|
123
|
-
goto _out3;
|
124
|
-
case 3:
|
125
|
-
#line 126 "parser.c"
|
126
|
-
switch( (*p) ) {
|
127
|
-
case 42: goto tr4;
|
128
|
-
case 43: goto tr5;
|
129
|
-
case 47: goto tr6;
|
130
|
-
case 58: goto tr7;
|
131
|
-
}
|
132
|
-
if ( (*p) < 65 ) {
|
133
|
-
if ( 45 <= (*p) && (*p) <= 57 )
|
134
|
-
goto tr5;
|
135
|
-
} else if ( (*p) > 90 ) {
|
136
|
-
if ( 97 <= (*p) && (*p) <= 122 )
|
137
|
-
goto tr5;
|
138
|
-
} else
|
139
|
-
goto tr5;
|
140
|
-
goto st0;
|
141
|
-
tr4:
|
142
|
-
#line 22 "parser.rl"
|
143
|
-
{MARK(mark, p); }
|
144
|
-
goto st4;
|
145
|
-
st4:
|
146
|
-
if ( ++p == pe )
|
147
|
-
goto _out4;
|
148
|
-
case 4:
|
149
|
-
#line 150 "parser.c"
|
150
|
-
switch( (*p) ) {
|
151
|
-
case 32: goto tr8;
|
152
|
-
case 35: goto tr9;
|
153
|
-
}
|
154
|
-
goto st0;
|
155
|
-
tr8:
|
343
|
+
break;
|
344
|
+
case 6:
|
156
345
|
#line 41 "parser.rl"
|
157
346
|
{
|
158
347
|
if (parser->request_uri != NULL) {
|
159
348
|
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
160
349
|
}
|
161
350
|
}
|
162
|
-
|
163
|
-
|
351
|
+
break;
|
352
|
+
case 7:
|
164
353
|
#line 46 "parser.rl"
|
165
354
|
{
|
166
355
|
if (parser->fragment != NULL) {
|
167
356
|
parser->fragment(parser->data, PTR_TO(mark), LEN(mark, p));
|
168
357
|
}
|
169
358
|
}
|
170
|
-
|
171
|
-
|
172
|
-
#line 65 "parser.rl"
|
173
|
-
{
|
174
|
-
if (parser->request_path != NULL) {
|
175
|
-
parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
|
176
|
-
}
|
177
|
-
}
|
178
|
-
#line 41 "parser.rl"
|
179
|
-
{
|
180
|
-
if (parser->request_uri != NULL) {
|
181
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
182
|
-
}
|
183
|
-
}
|
184
|
-
goto st5;
|
185
|
-
tr51:
|
359
|
+
break;
|
360
|
+
case 8:
|
186
361
|
#line 52 "parser.rl"
|
187
362
|
{MARK(query_start, p); }
|
363
|
+
break;
|
364
|
+
case 9:
|
188
365
|
#line 53 "parser.rl"
|
189
366
|
{
|
190
367
|
if (parser->query_string != NULL) {
|
191
368
|
parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
|
192
369
|
}
|
193
370
|
}
|
194
|
-
|
195
|
-
|
196
|
-
if (parser->request_uri != NULL) {
|
197
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
198
|
-
}
|
199
|
-
}
|
200
|
-
goto st5;
|
201
|
-
tr55:
|
202
|
-
#line 53 "parser.rl"
|
203
|
-
{
|
204
|
-
if (parser->query_string != NULL) {
|
205
|
-
parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
|
206
|
-
}
|
207
|
-
}
|
208
|
-
#line 41 "parser.rl"
|
209
|
-
{
|
210
|
-
if (parser->request_uri != NULL) {
|
211
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
212
|
-
}
|
213
|
-
}
|
214
|
-
goto st5;
|
215
|
-
st5:
|
216
|
-
if ( ++p == pe )
|
217
|
-
goto _out5;
|
218
|
-
case 5:
|
219
|
-
#line 220 "parser.c"
|
220
|
-
if ( (*p) == 72 )
|
221
|
-
goto tr10;
|
222
|
-
goto st0;
|
223
|
-
tr10:
|
224
|
-
#line 22 "parser.rl"
|
225
|
-
{MARK(mark, p); }
|
226
|
-
goto st6;
|
227
|
-
st6:
|
228
|
-
if ( ++p == pe )
|
229
|
-
goto _out6;
|
230
|
-
case 6:
|
231
|
-
#line 232 "parser.c"
|
232
|
-
if ( (*p) == 84 )
|
233
|
-
goto st7;
|
234
|
-
goto st0;
|
235
|
-
st7:
|
236
|
-
if ( ++p == pe )
|
237
|
-
goto _out7;
|
238
|
-
case 7:
|
239
|
-
if ( (*p) == 84 )
|
240
|
-
goto st8;
|
241
|
-
goto st0;
|
242
|
-
st8:
|
243
|
-
if ( ++p == pe )
|
244
|
-
goto _out8;
|
245
|
-
case 8:
|
246
|
-
if ( (*p) == 80 )
|
247
|
-
goto st9;
|
248
|
-
goto st0;
|
249
|
-
st9:
|
250
|
-
if ( ++p == pe )
|
251
|
-
goto _out9;
|
252
|
-
case 9:
|
253
|
-
if ( (*p) == 47 )
|
254
|
-
goto st10;
|
255
|
-
goto st0;
|
256
|
-
st10:
|
257
|
-
if ( ++p == pe )
|
258
|
-
goto _out10;
|
259
|
-
case 10:
|
260
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
261
|
-
goto st11;
|
262
|
-
goto st0;
|
263
|
-
st11:
|
264
|
-
if ( ++p == pe )
|
265
|
-
goto _out11;
|
266
|
-
case 11:
|
267
|
-
if ( (*p) == 46 )
|
268
|
-
goto st12;
|
269
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
270
|
-
goto st11;
|
271
|
-
goto st0;
|
272
|
-
st12:
|
273
|
-
if ( ++p == pe )
|
274
|
-
goto _out12;
|
275
|
-
case 12:
|
276
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
277
|
-
goto st13;
|
278
|
-
goto st0;
|
279
|
-
st13:
|
280
|
-
if ( ++p == pe )
|
281
|
-
goto _out13;
|
282
|
-
case 13:
|
283
|
-
if ( (*p) == 13 )
|
284
|
-
goto tr18;
|
285
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
286
|
-
goto st13;
|
287
|
-
goto st0;
|
288
|
-
tr18:
|
371
|
+
break;
|
372
|
+
case 10:
|
289
373
|
#line 59 "parser.rl"
|
290
374
|
{
|
291
375
|
if (parser->http_version != NULL) {
|
292
376
|
parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p));
|
293
377
|
}
|
294
378
|
}
|
295
|
-
|
296
|
-
|
297
|
-
#line 31 "parser.rl"
|
298
|
-
{
|
299
|
-
if (parser->http_field != NULL) {
|
300
|
-
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
301
|
-
}
|
302
|
-
}
|
303
|
-
goto st14;
|
304
|
-
st14:
|
305
|
-
if ( ++p == pe )
|
306
|
-
goto _out14;
|
307
|
-
case 14:
|
308
|
-
#line 309 "parser.c"
|
309
|
-
if ( (*p) == 10 )
|
310
|
-
goto st15;
|
311
|
-
goto st0;
|
312
|
-
st15:
|
313
|
-
if ( ++p == pe )
|
314
|
-
goto _out15;
|
315
|
-
case 15:
|
316
|
-
switch( (*p) ) {
|
317
|
-
case 13: goto st16;
|
318
|
-
case 33: goto tr21;
|
319
|
-
case 124: goto tr21;
|
320
|
-
case 126: goto tr21;
|
321
|
-
}
|
322
|
-
if ( (*p) < 45 ) {
|
323
|
-
if ( (*p) > 39 ) {
|
324
|
-
if ( 42 <= (*p) && (*p) <= 43 )
|
325
|
-
goto tr21;
|
326
|
-
} else if ( (*p) >= 35 )
|
327
|
-
goto tr21;
|
328
|
-
} else if ( (*p) > 46 ) {
|
329
|
-
if ( (*p) < 65 ) {
|
330
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
331
|
-
goto tr21;
|
332
|
-
} else if ( (*p) > 90 ) {
|
333
|
-
if ( 94 <= (*p) && (*p) <= 122 )
|
334
|
-
goto tr21;
|
335
|
-
} else
|
336
|
-
goto tr21;
|
337
|
-
} else
|
338
|
-
goto tr21;
|
339
|
-
goto st0;
|
340
|
-
st16:
|
341
|
-
if ( ++p == pe )
|
342
|
-
goto _out16;
|
343
|
-
case 16:
|
344
|
-
if ( (*p) == 10 )
|
345
|
-
goto tr22;
|
346
|
-
goto st0;
|
347
|
-
tr22:
|
348
|
-
#line 71 "parser.rl"
|
349
|
-
{
|
350
|
-
parser->body_start = p - buffer + 1;
|
351
|
-
if (parser->header_done != NULL) {
|
352
|
-
parser->header_done(parser->data, p + 1, pe - p - 1);
|
353
|
-
}
|
354
|
-
goto _out57;
|
355
|
-
}
|
356
|
-
goto st57;
|
357
|
-
st57:
|
358
|
-
if ( ++p == pe )
|
359
|
-
goto _out57;
|
360
|
-
case 57:
|
361
|
-
#line 362 "parser.c"
|
362
|
-
goto st0;
|
363
|
-
tr21:
|
364
|
-
#line 25 "parser.rl"
|
365
|
-
{ MARK(field_start, p); }
|
366
|
-
goto st17;
|
367
|
-
st17:
|
368
|
-
if ( ++p == pe )
|
369
|
-
goto _out17;
|
370
|
-
case 17:
|
371
|
-
#line 372 "parser.c"
|
372
|
-
switch( (*p) ) {
|
373
|
-
case 33: goto st17;
|
374
|
-
case 58: goto tr24;
|
375
|
-
case 124: goto st17;
|
376
|
-
case 126: goto st17;
|
377
|
-
}
|
378
|
-
if ( (*p) < 45 ) {
|
379
|
-
if ( (*p) > 39 ) {
|
380
|
-
if ( 42 <= (*p) && (*p) <= 43 )
|
381
|
-
goto st17;
|
382
|
-
} else if ( (*p) >= 35 )
|
383
|
-
goto st17;
|
384
|
-
} else if ( (*p) > 46 ) {
|
385
|
-
if ( (*p) < 65 ) {
|
386
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
387
|
-
goto st17;
|
388
|
-
} else if ( (*p) > 90 ) {
|
389
|
-
if ( 94 <= (*p) && (*p) <= 122 )
|
390
|
-
goto st17;
|
391
|
-
} else
|
392
|
-
goto st17;
|
393
|
-
} else
|
394
|
-
goto st17;
|
395
|
-
goto st0;
|
396
|
-
tr24:
|
397
|
-
#line 26 "parser.rl"
|
398
|
-
{
|
399
|
-
parser->field_len = LEN(field_start, p);
|
400
|
-
}
|
401
|
-
goto st18;
|
402
|
-
tr27:
|
403
|
-
#line 30 "parser.rl"
|
404
|
-
{ MARK(mark, p); }
|
405
|
-
goto st18;
|
406
|
-
st18:
|
407
|
-
if ( ++p == pe )
|
408
|
-
goto _out18;
|
409
|
-
case 18:
|
410
|
-
#line 411 "parser.c"
|
411
|
-
switch( (*p) ) {
|
412
|
-
case 13: goto tr26;
|
413
|
-
case 32: goto tr27;
|
414
|
-
}
|
415
|
-
goto tr25;
|
416
|
-
tr25:
|
417
|
-
#line 30 "parser.rl"
|
418
|
-
{ MARK(mark, p); }
|
419
|
-
goto st19;
|
420
|
-
st19:
|
421
|
-
if ( ++p == pe )
|
422
|
-
goto _out19;
|
423
|
-
case 19:
|
424
|
-
#line 425 "parser.c"
|
425
|
-
if ( (*p) == 13 )
|
426
|
-
goto tr26;
|
427
|
-
goto st19;
|
428
|
-
tr9:
|
429
|
-
#line 41 "parser.rl"
|
430
|
-
{
|
431
|
-
if (parser->request_uri != NULL) {
|
432
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
433
|
-
}
|
434
|
-
}
|
435
|
-
goto st20;
|
436
|
-
tr41:
|
379
|
+
break;
|
380
|
+
case 11:
|
437
381
|
#line 65 "parser.rl"
|
438
382
|
{
|
439
383
|
if (parser->request_path != NULL) {
|
440
384
|
parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
|
441
385
|
}
|
442
386
|
}
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
447
|
-
}
|
448
|
-
}
|
449
|
-
goto st20;
|
450
|
-
tr52:
|
451
|
-
#line 52 "parser.rl"
|
452
|
-
{MARK(query_start, p); }
|
453
|
-
#line 53 "parser.rl"
|
454
|
-
{
|
455
|
-
if (parser->query_string != NULL) {
|
456
|
-
parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
|
457
|
-
}
|
458
|
-
}
|
459
|
-
#line 41 "parser.rl"
|
460
|
-
{
|
461
|
-
if (parser->request_uri != NULL) {
|
462
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
463
|
-
}
|
464
|
-
}
|
465
|
-
goto st20;
|
466
|
-
tr56:
|
467
|
-
#line 53 "parser.rl"
|
387
|
+
break;
|
388
|
+
case 12:
|
389
|
+
#line 71 "parser.rl"
|
468
390
|
{
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
}
|
473
|
-
#line 41 "parser.rl"
|
474
|
-
{
|
475
|
-
if (parser->request_uri != NULL) {
|
476
|
-
parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
|
477
|
-
}
|
478
|
-
}
|
479
|
-
goto st20;
|
480
|
-
st20:
|
481
|
-
if ( ++p == pe )
|
482
|
-
goto _out20;
|
483
|
-
case 20:
|
484
|
-
#line 485 "parser.c"
|
485
|
-
switch( (*p) ) {
|
486
|
-
case 32: goto tr30;
|
487
|
-
case 35: goto st0;
|
488
|
-
case 37: goto tr31;
|
489
|
-
case 127: goto st0;
|
490
|
-
}
|
491
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
492
|
-
goto st0;
|
493
|
-
goto tr29;
|
494
|
-
tr29:
|
495
|
-
#line 22 "parser.rl"
|
496
|
-
{MARK(mark, p); }
|
497
|
-
goto st21;
|
498
|
-
st21:
|
499
|
-
if ( ++p == pe )
|
500
|
-
goto _out21;
|
501
|
-
case 21:
|
502
|
-
#line 503 "parser.c"
|
503
|
-
switch( (*p) ) {
|
504
|
-
case 32: goto tr30;
|
505
|
-
case 35: goto st0;
|
506
|
-
case 37: goto st22;
|
507
|
-
case 127: goto st0;
|
508
|
-
}
|
509
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
510
|
-
goto st0;
|
511
|
-
goto st21;
|
512
|
-
tr31:
|
513
|
-
#line 22 "parser.rl"
|
514
|
-
{MARK(mark, p); }
|
515
|
-
goto st22;
|
516
|
-
st22:
|
517
|
-
if ( ++p == pe )
|
518
|
-
goto _out22;
|
519
|
-
case 22:
|
520
|
-
#line 521 "parser.c"
|
521
|
-
if ( (*p) < 65 ) {
|
522
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
523
|
-
goto st23;
|
524
|
-
} else if ( (*p) > 70 ) {
|
525
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
526
|
-
goto st23;
|
527
|
-
} else
|
528
|
-
goto st23;
|
529
|
-
goto st0;
|
530
|
-
st23:
|
531
|
-
if ( ++p == pe )
|
532
|
-
goto _out23;
|
533
|
-
case 23:
|
534
|
-
if ( (*p) < 65 ) {
|
535
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
536
|
-
goto st21;
|
537
|
-
} else if ( (*p) > 70 ) {
|
538
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
539
|
-
goto st21;
|
540
|
-
} else
|
541
|
-
goto st21;
|
542
|
-
goto st0;
|
543
|
-
tr5:
|
544
|
-
#line 22 "parser.rl"
|
545
|
-
{MARK(mark, p); }
|
546
|
-
goto st24;
|
547
|
-
st24:
|
548
|
-
if ( ++p == pe )
|
549
|
-
goto _out24;
|
550
|
-
case 24:
|
551
|
-
#line 552 "parser.c"
|
552
|
-
switch( (*p) ) {
|
553
|
-
case 43: goto st24;
|
554
|
-
case 58: goto st25;
|
555
|
-
}
|
556
|
-
if ( (*p) < 48 ) {
|
557
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
558
|
-
goto st24;
|
559
|
-
} else if ( (*p) > 57 ) {
|
560
|
-
if ( (*p) > 90 ) {
|
561
|
-
if ( 97 <= (*p) && (*p) <= 122 )
|
562
|
-
goto st24;
|
563
|
-
} else if ( (*p) >= 65 )
|
564
|
-
goto st24;
|
565
|
-
} else
|
566
|
-
goto st24;
|
567
|
-
goto st0;
|
568
|
-
tr7:
|
569
|
-
#line 22 "parser.rl"
|
570
|
-
{MARK(mark, p); }
|
571
|
-
goto st25;
|
572
|
-
st25:
|
573
|
-
if ( ++p == pe )
|
574
|
-
goto _out25;
|
575
|
-
case 25:
|
576
|
-
#line 577 "parser.c"
|
577
|
-
switch( (*p) ) {
|
578
|
-
case 32: goto tr8;
|
579
|
-
case 35: goto tr9;
|
580
|
-
case 37: goto st26;
|
581
|
-
case 127: goto st0;
|
582
|
-
}
|
583
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
584
|
-
goto st0;
|
585
|
-
goto st25;
|
586
|
-
st26:
|
587
|
-
if ( ++p == pe )
|
588
|
-
goto _out26;
|
589
|
-
case 26:
|
590
|
-
if ( (*p) < 65 ) {
|
591
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
592
|
-
goto st27;
|
593
|
-
} else if ( (*p) > 70 ) {
|
594
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
595
|
-
goto st27;
|
596
|
-
} else
|
597
|
-
goto st27;
|
598
|
-
goto st0;
|
599
|
-
st27:
|
600
|
-
if ( ++p == pe )
|
601
|
-
goto _out27;
|
602
|
-
case 27:
|
603
|
-
if ( (*p) < 65 ) {
|
604
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
605
|
-
goto st25;
|
606
|
-
} else if ( (*p) > 70 ) {
|
607
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
608
|
-
goto st25;
|
609
|
-
} else
|
610
|
-
goto st25;
|
611
|
-
goto st0;
|
612
|
-
tr6:
|
613
|
-
#line 22 "parser.rl"
|
614
|
-
{MARK(mark, p); }
|
615
|
-
goto st28;
|
616
|
-
st28:
|
617
|
-
if ( ++p == pe )
|
618
|
-
goto _out28;
|
619
|
-
case 28:
|
620
|
-
#line 621 "parser.c"
|
621
|
-
switch( (*p) ) {
|
622
|
-
case 32: goto tr40;
|
623
|
-
case 35: goto tr41;
|
624
|
-
case 37: goto st29;
|
625
|
-
case 59: goto tr43;
|
626
|
-
case 63: goto tr44;
|
627
|
-
case 127: goto st0;
|
628
|
-
}
|
629
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
630
|
-
goto st0;
|
631
|
-
goto st28;
|
632
|
-
st29:
|
633
|
-
if ( ++p == pe )
|
634
|
-
goto _out29;
|
635
|
-
case 29:
|
636
|
-
if ( (*p) < 65 ) {
|
637
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
638
|
-
goto st30;
|
639
|
-
} else if ( (*p) > 70 ) {
|
640
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
641
|
-
goto st30;
|
642
|
-
} else
|
643
|
-
goto st30;
|
644
|
-
goto st0;
|
645
|
-
st30:
|
646
|
-
if ( ++p == pe )
|
647
|
-
goto _out30;
|
648
|
-
case 30:
|
649
|
-
if ( (*p) < 65 ) {
|
650
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
651
|
-
goto st28;
|
652
|
-
} else if ( (*p) > 70 ) {
|
653
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
654
|
-
goto st28;
|
655
|
-
} else
|
656
|
-
goto st28;
|
657
|
-
goto st0;
|
658
|
-
tr43:
|
659
|
-
#line 65 "parser.rl"
|
660
|
-
{
|
661
|
-
if (parser->request_path != NULL) {
|
662
|
-
parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
|
663
|
-
}
|
664
|
-
}
|
665
|
-
goto st31;
|
666
|
-
st31:
|
667
|
-
if ( ++p == pe )
|
668
|
-
goto _out31;
|
669
|
-
case 31:
|
670
|
-
#line 671 "parser.c"
|
671
|
-
switch( (*p) ) {
|
672
|
-
case 32: goto tr8;
|
673
|
-
case 35: goto tr9;
|
674
|
-
case 37: goto st32;
|
675
|
-
case 63: goto st34;
|
676
|
-
case 127: goto st0;
|
677
|
-
}
|
678
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
679
|
-
goto st0;
|
680
|
-
goto st31;
|
681
|
-
st32:
|
682
|
-
if ( ++p == pe )
|
683
|
-
goto _out32;
|
684
|
-
case 32:
|
685
|
-
if ( (*p) < 65 ) {
|
686
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
687
|
-
goto st33;
|
688
|
-
} else if ( (*p) > 70 ) {
|
689
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
690
|
-
goto st33;
|
691
|
-
} else
|
692
|
-
goto st33;
|
693
|
-
goto st0;
|
694
|
-
st33:
|
695
|
-
if ( ++p == pe )
|
696
|
-
goto _out33;
|
697
|
-
case 33:
|
698
|
-
if ( (*p) < 65 ) {
|
699
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
700
|
-
goto st31;
|
701
|
-
} else if ( (*p) > 70 ) {
|
702
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
703
|
-
goto st31;
|
704
|
-
} else
|
705
|
-
goto st31;
|
706
|
-
goto st0;
|
707
|
-
tr44:
|
708
|
-
#line 65 "parser.rl"
|
709
|
-
{
|
710
|
-
if (parser->request_path != NULL) {
|
711
|
-
parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
|
391
|
+
parser->body_start = p - buffer + 1;
|
392
|
+
if (parser->header_done != NULL) {
|
393
|
+
parser->header_done(parser->data, p + 1, pe - p - 1);
|
712
394
|
}
|
395
|
+
{p++; goto _out; }
|
713
396
|
}
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
goto _out34;
|
718
|
-
case 34:
|
719
|
-
#line 720 "parser.c"
|
720
|
-
switch( (*p) ) {
|
721
|
-
case 32: goto tr51;
|
722
|
-
case 35: goto tr52;
|
723
|
-
case 37: goto tr53;
|
724
|
-
case 127: goto st0;
|
725
|
-
}
|
726
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
727
|
-
goto st0;
|
728
|
-
goto tr50;
|
729
|
-
tr50:
|
730
|
-
#line 52 "parser.rl"
|
731
|
-
{MARK(query_start, p); }
|
732
|
-
goto st35;
|
733
|
-
st35:
|
734
|
-
if ( ++p == pe )
|
735
|
-
goto _out35;
|
736
|
-
case 35:
|
737
|
-
#line 738 "parser.c"
|
738
|
-
switch( (*p) ) {
|
739
|
-
case 32: goto tr55;
|
740
|
-
case 35: goto tr56;
|
741
|
-
case 37: goto st36;
|
742
|
-
case 127: goto st0;
|
397
|
+
break;
|
398
|
+
#line 399 "parser.c"
|
399
|
+
}
|
743
400
|
}
|
744
|
-
if ( 0 <= (*p) && (*p) <= 31 )
|
745
|
-
goto st0;
|
746
|
-
goto st35;
|
747
|
-
tr53:
|
748
|
-
#line 52 "parser.rl"
|
749
|
-
{MARK(query_start, p); }
|
750
|
-
goto st36;
|
751
|
-
st36:
|
752
|
-
if ( ++p == pe )
|
753
|
-
goto _out36;
|
754
|
-
case 36:
|
755
|
-
#line 756 "parser.c"
|
756
|
-
if ( (*p) < 65 ) {
|
757
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
758
|
-
goto st37;
|
759
|
-
} else if ( (*p) > 70 ) {
|
760
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
761
|
-
goto st37;
|
762
|
-
} else
|
763
|
-
goto st37;
|
764
|
-
goto st0;
|
765
|
-
st37:
|
766
|
-
if ( ++p == pe )
|
767
|
-
goto _out37;
|
768
|
-
case 37:
|
769
|
-
if ( (*p) < 65 ) {
|
770
|
-
if ( 48 <= (*p) && (*p) <= 57 )
|
771
|
-
goto st35;
|
772
|
-
} else if ( (*p) > 70 ) {
|
773
|
-
if ( 97 <= (*p) && (*p) <= 102 )
|
774
|
-
goto st35;
|
775
|
-
} else
|
776
|
-
goto st35;
|
777
|
-
goto st0;
|
778
|
-
st38:
|
779
|
-
if ( ++p == pe )
|
780
|
-
goto _out38;
|
781
|
-
case 38:
|
782
|
-
switch( (*p) ) {
|
783
|
-
case 32: goto tr2;
|
784
|
-
case 36: goto st39;
|
785
|
-
case 95: goto st39;
|
786
|
-
}
|
787
|
-
if ( (*p) < 48 ) {
|
788
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
789
|
-
goto st39;
|
790
|
-
} else if ( (*p) > 57 ) {
|
791
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
792
|
-
goto st39;
|
793
|
-
} else
|
794
|
-
goto st39;
|
795
|
-
goto st0;
|
796
|
-
st39:
|
797
|
-
if ( ++p == pe )
|
798
|
-
goto _out39;
|
799
|
-
case 39:
|
800
|
-
switch( (*p) ) {
|
801
|
-
case 32: goto tr2;
|
802
|
-
case 36: goto st40;
|
803
|
-
case 95: goto st40;
|
804
|
-
}
|
805
|
-
if ( (*p) < 48 ) {
|
806
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
807
|
-
goto st40;
|
808
|
-
} else if ( (*p) > 57 ) {
|
809
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
810
|
-
goto st40;
|
811
|
-
} else
|
812
|
-
goto st40;
|
813
|
-
goto st0;
|
814
|
-
st40:
|
815
|
-
if ( ++p == pe )
|
816
|
-
goto _out40;
|
817
|
-
case 40:
|
818
|
-
switch( (*p) ) {
|
819
|
-
case 32: goto tr2;
|
820
|
-
case 36: goto st41;
|
821
|
-
case 95: goto st41;
|
822
|
-
}
|
823
|
-
if ( (*p) < 48 ) {
|
824
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
825
|
-
goto st41;
|
826
|
-
} else if ( (*p) > 57 ) {
|
827
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
828
|
-
goto st41;
|
829
|
-
} else
|
830
|
-
goto st41;
|
831
|
-
goto st0;
|
832
|
-
st41:
|
833
|
-
if ( ++p == pe )
|
834
|
-
goto _out41;
|
835
|
-
case 41:
|
836
|
-
switch( (*p) ) {
|
837
|
-
case 32: goto tr2;
|
838
|
-
case 36: goto st42;
|
839
|
-
case 95: goto st42;
|
840
|
-
}
|
841
|
-
if ( (*p) < 48 ) {
|
842
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
843
|
-
goto st42;
|
844
|
-
} else if ( (*p) > 57 ) {
|
845
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
846
|
-
goto st42;
|
847
|
-
} else
|
848
|
-
goto st42;
|
849
|
-
goto st0;
|
850
|
-
st42:
|
851
|
-
if ( ++p == pe )
|
852
|
-
goto _out42;
|
853
|
-
case 42:
|
854
|
-
switch( (*p) ) {
|
855
|
-
case 32: goto tr2;
|
856
|
-
case 36: goto st43;
|
857
|
-
case 95: goto st43;
|
858
|
-
}
|
859
|
-
if ( (*p) < 48 ) {
|
860
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
861
|
-
goto st43;
|
862
|
-
} else if ( (*p) > 57 ) {
|
863
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
864
|
-
goto st43;
|
865
|
-
} else
|
866
|
-
goto st43;
|
867
|
-
goto st0;
|
868
|
-
st43:
|
869
|
-
if ( ++p == pe )
|
870
|
-
goto _out43;
|
871
|
-
case 43:
|
872
|
-
switch( (*p) ) {
|
873
|
-
case 32: goto tr2;
|
874
|
-
case 36: goto st44;
|
875
|
-
case 95: goto st44;
|
876
|
-
}
|
877
|
-
if ( (*p) < 48 ) {
|
878
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
879
|
-
goto st44;
|
880
|
-
} else if ( (*p) > 57 ) {
|
881
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
882
|
-
goto st44;
|
883
|
-
} else
|
884
|
-
goto st44;
|
885
|
-
goto st0;
|
886
|
-
st44:
|
887
|
-
if ( ++p == pe )
|
888
|
-
goto _out44;
|
889
|
-
case 44:
|
890
|
-
switch( (*p) ) {
|
891
|
-
case 32: goto tr2;
|
892
|
-
case 36: goto st45;
|
893
|
-
case 95: goto st45;
|
894
|
-
}
|
895
|
-
if ( (*p) < 48 ) {
|
896
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
897
|
-
goto st45;
|
898
|
-
} else if ( (*p) > 57 ) {
|
899
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
900
|
-
goto st45;
|
901
|
-
} else
|
902
|
-
goto st45;
|
903
|
-
goto st0;
|
904
|
-
st45:
|
905
|
-
if ( ++p == pe )
|
906
|
-
goto _out45;
|
907
|
-
case 45:
|
908
|
-
switch( (*p) ) {
|
909
|
-
case 32: goto tr2;
|
910
|
-
case 36: goto st46;
|
911
|
-
case 95: goto st46;
|
912
|
-
}
|
913
|
-
if ( (*p) < 48 ) {
|
914
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
915
|
-
goto st46;
|
916
|
-
} else if ( (*p) > 57 ) {
|
917
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
918
|
-
goto st46;
|
919
|
-
} else
|
920
|
-
goto st46;
|
921
|
-
goto st0;
|
922
|
-
st46:
|
923
|
-
if ( ++p == pe )
|
924
|
-
goto _out46;
|
925
|
-
case 46:
|
926
|
-
switch( (*p) ) {
|
927
|
-
case 32: goto tr2;
|
928
|
-
case 36: goto st47;
|
929
|
-
case 95: goto st47;
|
930
|
-
}
|
931
|
-
if ( (*p) < 48 ) {
|
932
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
933
|
-
goto st47;
|
934
|
-
} else if ( (*p) > 57 ) {
|
935
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
936
|
-
goto st47;
|
937
|
-
} else
|
938
|
-
goto st47;
|
939
|
-
goto st0;
|
940
|
-
st47:
|
941
|
-
if ( ++p == pe )
|
942
|
-
goto _out47;
|
943
|
-
case 47:
|
944
|
-
switch( (*p) ) {
|
945
|
-
case 32: goto tr2;
|
946
|
-
case 36: goto st48;
|
947
|
-
case 95: goto st48;
|
948
|
-
}
|
949
|
-
if ( (*p) < 48 ) {
|
950
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
951
|
-
goto st48;
|
952
|
-
} else if ( (*p) > 57 ) {
|
953
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
954
|
-
goto st48;
|
955
|
-
} else
|
956
|
-
goto st48;
|
957
|
-
goto st0;
|
958
|
-
st48:
|
959
|
-
if ( ++p == pe )
|
960
|
-
goto _out48;
|
961
|
-
case 48:
|
962
|
-
switch( (*p) ) {
|
963
|
-
case 32: goto tr2;
|
964
|
-
case 36: goto st49;
|
965
|
-
case 95: goto st49;
|
966
|
-
}
|
967
|
-
if ( (*p) < 48 ) {
|
968
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
969
|
-
goto st49;
|
970
|
-
} else if ( (*p) > 57 ) {
|
971
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
972
|
-
goto st49;
|
973
|
-
} else
|
974
|
-
goto st49;
|
975
|
-
goto st0;
|
976
|
-
st49:
|
977
|
-
if ( ++p == pe )
|
978
|
-
goto _out49;
|
979
|
-
case 49:
|
980
|
-
switch( (*p) ) {
|
981
|
-
case 32: goto tr2;
|
982
|
-
case 36: goto st50;
|
983
|
-
case 95: goto st50;
|
984
|
-
}
|
985
|
-
if ( (*p) < 48 ) {
|
986
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
987
|
-
goto st50;
|
988
|
-
} else if ( (*p) > 57 ) {
|
989
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
990
|
-
goto st50;
|
991
|
-
} else
|
992
|
-
goto st50;
|
993
|
-
goto st0;
|
994
|
-
st50:
|
995
|
-
if ( ++p == pe )
|
996
|
-
goto _out50;
|
997
|
-
case 50:
|
998
|
-
switch( (*p) ) {
|
999
|
-
case 32: goto tr2;
|
1000
|
-
case 36: goto st51;
|
1001
|
-
case 95: goto st51;
|
1002
|
-
}
|
1003
|
-
if ( (*p) < 48 ) {
|
1004
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1005
|
-
goto st51;
|
1006
|
-
} else if ( (*p) > 57 ) {
|
1007
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1008
|
-
goto st51;
|
1009
|
-
} else
|
1010
|
-
goto st51;
|
1011
|
-
goto st0;
|
1012
|
-
st51:
|
1013
|
-
if ( ++p == pe )
|
1014
|
-
goto _out51;
|
1015
|
-
case 51:
|
1016
|
-
switch( (*p) ) {
|
1017
|
-
case 32: goto tr2;
|
1018
|
-
case 36: goto st52;
|
1019
|
-
case 95: goto st52;
|
1020
|
-
}
|
1021
|
-
if ( (*p) < 48 ) {
|
1022
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1023
|
-
goto st52;
|
1024
|
-
} else if ( (*p) > 57 ) {
|
1025
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1026
|
-
goto st52;
|
1027
|
-
} else
|
1028
|
-
goto st52;
|
1029
|
-
goto st0;
|
1030
|
-
st52:
|
1031
|
-
if ( ++p == pe )
|
1032
|
-
goto _out52;
|
1033
|
-
case 52:
|
1034
|
-
switch( (*p) ) {
|
1035
|
-
case 32: goto tr2;
|
1036
|
-
case 36: goto st53;
|
1037
|
-
case 95: goto st53;
|
1038
|
-
}
|
1039
|
-
if ( (*p) < 48 ) {
|
1040
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1041
|
-
goto st53;
|
1042
|
-
} else if ( (*p) > 57 ) {
|
1043
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1044
|
-
goto st53;
|
1045
|
-
} else
|
1046
|
-
goto st53;
|
1047
|
-
goto st0;
|
1048
|
-
st53:
|
1049
|
-
if ( ++p == pe )
|
1050
|
-
goto _out53;
|
1051
|
-
case 53:
|
1052
|
-
switch( (*p) ) {
|
1053
|
-
case 32: goto tr2;
|
1054
|
-
case 36: goto st54;
|
1055
|
-
case 95: goto st54;
|
1056
|
-
}
|
1057
|
-
if ( (*p) < 48 ) {
|
1058
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1059
|
-
goto st54;
|
1060
|
-
} else if ( (*p) > 57 ) {
|
1061
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1062
|
-
goto st54;
|
1063
|
-
} else
|
1064
|
-
goto st54;
|
1065
|
-
goto st0;
|
1066
|
-
st54:
|
1067
|
-
if ( ++p == pe )
|
1068
|
-
goto _out54;
|
1069
|
-
case 54:
|
1070
|
-
switch( (*p) ) {
|
1071
|
-
case 32: goto tr2;
|
1072
|
-
case 36: goto st55;
|
1073
|
-
case 95: goto st55;
|
1074
|
-
}
|
1075
|
-
if ( (*p) < 48 ) {
|
1076
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1077
|
-
goto st55;
|
1078
|
-
} else if ( (*p) > 57 ) {
|
1079
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1080
|
-
goto st55;
|
1081
|
-
} else
|
1082
|
-
goto st55;
|
1083
|
-
goto st0;
|
1084
|
-
st55:
|
1085
|
-
if ( ++p == pe )
|
1086
|
-
goto _out55;
|
1087
|
-
case 55:
|
1088
|
-
switch( (*p) ) {
|
1089
|
-
case 32: goto tr2;
|
1090
|
-
case 36: goto st56;
|
1091
|
-
case 95: goto st56;
|
1092
|
-
}
|
1093
|
-
if ( (*p) < 48 ) {
|
1094
|
-
if ( 45 <= (*p) && (*p) <= 46 )
|
1095
|
-
goto st56;
|
1096
|
-
} else if ( (*p) > 57 ) {
|
1097
|
-
if ( 65 <= (*p) && (*p) <= 90 )
|
1098
|
-
goto st56;
|
1099
|
-
} else
|
1100
|
-
goto st56;
|
1101
|
-
goto st0;
|
1102
|
-
st56:
|
1103
|
-
if ( ++p == pe )
|
1104
|
-
goto _out56;
|
1105
|
-
case 56:
|
1106
|
-
if ( (*p) == 32 )
|
1107
|
-
goto tr2;
|
1108
|
-
goto st0;
|
1109
|
-
}
|
1110
|
-
_out0: cs = 0; goto _out;
|
1111
|
-
_out2: cs = 2; goto _out;
|
1112
|
-
_out3: cs = 3; goto _out;
|
1113
|
-
_out4: cs = 4; goto _out;
|
1114
|
-
_out5: cs = 5; goto _out;
|
1115
|
-
_out6: cs = 6; goto _out;
|
1116
|
-
_out7: cs = 7; goto _out;
|
1117
|
-
_out8: cs = 8; goto _out;
|
1118
|
-
_out9: cs = 9; goto _out;
|
1119
|
-
_out10: cs = 10; goto _out;
|
1120
|
-
_out11: cs = 11; goto _out;
|
1121
|
-
_out12: cs = 12; goto _out;
|
1122
|
-
_out13: cs = 13; goto _out;
|
1123
|
-
_out14: cs = 14; goto _out;
|
1124
|
-
_out15: cs = 15; goto _out;
|
1125
|
-
_out16: cs = 16; goto _out;
|
1126
|
-
_out57: cs = 57; goto _out;
|
1127
|
-
_out17: cs = 17; goto _out;
|
1128
|
-
_out18: cs = 18; goto _out;
|
1129
|
-
_out19: cs = 19; goto _out;
|
1130
|
-
_out20: cs = 20; goto _out;
|
1131
|
-
_out21: cs = 21; goto _out;
|
1132
|
-
_out22: cs = 22; goto _out;
|
1133
|
-
_out23: cs = 23; goto _out;
|
1134
|
-
_out24: cs = 24; goto _out;
|
1135
|
-
_out25: cs = 25; goto _out;
|
1136
|
-
_out26: cs = 26; goto _out;
|
1137
|
-
_out27: cs = 27; goto _out;
|
1138
|
-
_out28: cs = 28; goto _out;
|
1139
|
-
_out29: cs = 29; goto _out;
|
1140
|
-
_out30: cs = 30; goto _out;
|
1141
|
-
_out31: cs = 31; goto _out;
|
1142
|
-
_out32: cs = 32; goto _out;
|
1143
|
-
_out33: cs = 33; goto _out;
|
1144
|
-
_out34: cs = 34; goto _out;
|
1145
|
-
_out35: cs = 35; goto _out;
|
1146
|
-
_out36: cs = 36; goto _out;
|
1147
|
-
_out37: cs = 37; goto _out;
|
1148
|
-
_out38: cs = 38; goto _out;
|
1149
|
-
_out39: cs = 39; goto _out;
|
1150
|
-
_out40: cs = 40; goto _out;
|
1151
|
-
_out41: cs = 41; goto _out;
|
1152
|
-
_out42: cs = 42; goto _out;
|
1153
|
-
_out43: cs = 43; goto _out;
|
1154
|
-
_out44: cs = 44; goto _out;
|
1155
|
-
_out45: cs = 45; goto _out;
|
1156
|
-
_out46: cs = 46; goto _out;
|
1157
|
-
_out47: cs = 47; goto _out;
|
1158
|
-
_out48: cs = 48; goto _out;
|
1159
|
-
_out49: cs = 49; goto _out;
|
1160
|
-
_out50: cs = 50; goto _out;
|
1161
|
-
_out51: cs = 51; goto _out;
|
1162
|
-
_out52: cs = 52; goto _out;
|
1163
|
-
_out53: cs = 53; goto _out;
|
1164
|
-
_out54: cs = 54; goto _out;
|
1165
|
-
_out55: cs = 55; goto _out;
|
1166
|
-
_out56: cs = 56; goto _out;
|
1167
401
|
|
402
|
+
_again:
|
403
|
+
if ( cs == 0 )
|
404
|
+
goto _out;
|
405
|
+
if ( ++p != pe )
|
406
|
+
goto _resume;
|
407
|
+
_test_eof: {}
|
1168
408
|
_out: {}
|
1169
409
|
}
|
1170
410
|
#line 116 "parser.rl"
|
@@ -1181,38 +421,32 @@ case 56:
|
|
1181
421
|
|
1182
422
|
if(parser->body_start) {
|
1183
423
|
/* final \r\n combo encountered so stop right here */
|
1184
|
-
|
1185
|
-
#line 1186 "parser.c"
|
1186
|
-
#line 130 "parser.rl"
|
1187
424
|
parser->nread++;
|
1188
425
|
}
|
1189
426
|
|
1190
427
|
return(parser->nread);
|
1191
428
|
}
|
1192
429
|
|
1193
|
-
int
|
430
|
+
int thin_http_parser_finish(http_parser *parser)
|
1194
431
|
{
|
1195
432
|
int cs = parser->cs;
|
1196
433
|
|
1197
|
-
|
1198
|
-
#line 1199 "parser.c"
|
1199
|
-
#line 141 "parser.rl"
|
1200
434
|
|
1201
435
|
parser->cs = cs;
|
1202
436
|
|
1203
|
-
if (
|
437
|
+
if (thin_http_parser_has_error(parser) ) {
|
1204
438
|
return -1;
|
1205
|
-
} else if (
|
439
|
+
} else if (thin_http_parser_is_finished(parser) ) {
|
1206
440
|
return 1;
|
1207
441
|
} else {
|
1208
442
|
return 0;
|
1209
443
|
}
|
1210
444
|
}
|
1211
445
|
|
1212
|
-
int
|
446
|
+
int thin_http_parser_has_error(http_parser *parser) {
|
1213
447
|
return parser->cs == http_parser_error;
|
1214
448
|
}
|
1215
449
|
|
1216
|
-
int
|
450
|
+
int thin_http_parser_is_finished(http_parser *parser) {
|
1217
451
|
return parser->cs == http_parser_first_final;
|
1218
452
|
}
|