fast_http 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/http11_client/MANIFEST +0 -0
- data/ext/http11_client/Makefile +157 -0
- data/ext/http11_client/conftest.dSYM/Contents/Info.plist +25 -0
- data/ext/http11_client/conftest.dSYM/Contents/Resources/DWARF/conftest +0 -0
- data/ext/http11_client/ext_help.h +14 -0
- data/ext/http11_client/extconf.rb +6 -0
- data/ext/http11_client/http11_client.bundle +0 -0
- data/ext/http11_client/http11_client.c +302 -0
- data/ext/http11_client/http11_client.o +0 -0
- data/ext/http11_client/http11_parser.c +1052 -0
- data/ext/http11_client/http11_parser.h +48 -0
- data/ext/http11_client/http11_parser.o +0 -0
- data/ext/http11_client/http11_parser.rl +173 -0
- data/ext/http11_client/mkmf.log +12 -0
- data/lib/fast_http.rb +3 -0
- data/lib/fast_http/client.rb +441 -0
- data/lib/fast_http/pushbackio.rb +90 -0
- data/test/test_httpparser.rb +47 -0
- metadata +84 -0
Binary file
|
@@ -0,0 +1,1052 @@
|
|
1
|
+
#line 1 "ext/http11_client/http11_parser.rl"
|
2
|
+
/**
|
3
|
+
* Copyright (c) 2005 Zed A. Shaw
|
4
|
+
* You can redistribute it and/or modify it under the same terms as Ruby.
|
5
|
+
*/
|
6
|
+
|
7
|
+
#include "http11_parser.h"
|
8
|
+
#include <stdio.h>
|
9
|
+
#include <assert.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include <ctype.h>
|
12
|
+
#include <string.h>
|
13
|
+
|
14
|
+
#define LEN(AT, FPC) (FPC - buffer - parser->AT)
|
15
|
+
#define MARK(M,FPC) (parser->M = (FPC) - buffer)
|
16
|
+
#define PTR_TO(F) (buffer + parser->F)
|
17
|
+
#define L(M) fprintf(stderr, "" # M "\n");
|
18
|
+
|
19
|
+
|
20
|
+
/** machine **/
|
21
|
+
#line 95 "ext/http11_client/http11_parser.rl"
|
22
|
+
|
23
|
+
|
24
|
+
/** Data **/
|
25
|
+
|
26
|
+
#line 27 "ext/http11_client/http11_parser.c"
|
27
|
+
static const int httpclient_parser_start = 0;
|
28
|
+
|
29
|
+
static const int httpclient_parser_first_final = 36;
|
30
|
+
|
31
|
+
static const int httpclient_parser_error = 1;
|
32
|
+
|
33
|
+
#line 99 "ext/http11_client/http11_parser.rl"
|
34
|
+
|
35
|
+
int httpclient_parser_init(httpclient_parser *parser) {
|
36
|
+
int cs = 0;
|
37
|
+
|
38
|
+
#line 39 "ext/http11_client/http11_parser.c"
|
39
|
+
{
|
40
|
+
cs = httpclient_parser_start;
|
41
|
+
}
|
42
|
+
#line 103 "ext/http11_client/http11_parser.rl"
|
43
|
+
parser->cs = cs;
|
44
|
+
parser->body_start = 0;
|
45
|
+
parser->content_len = 0;
|
46
|
+
parser->mark = 0;
|
47
|
+
parser->nread = 0;
|
48
|
+
parser->field_len = 0;
|
49
|
+
parser->field_start = 0;
|
50
|
+
|
51
|
+
return(1);
|
52
|
+
}
|
53
|
+
|
54
|
+
|
55
|
+
/** exec **/
|
56
|
+
size_t httpclient_parser_execute(httpclient_parser *parser, const char *buffer, size_t len, size_t off) {
|
57
|
+
const char *p, *pe;
|
58
|
+
int cs = parser->cs;
|
59
|
+
|
60
|
+
assert(off <= len && "offset past end of buffer");
|
61
|
+
|
62
|
+
p = buffer+off;
|
63
|
+
pe = buffer+len;
|
64
|
+
|
65
|
+
assert(*pe == '\0' && "pointer does not end on NUL");
|
66
|
+
assert(pe - p == len - off && "pointers aren't same distance");
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
#line 71 "ext/http11_client/http11_parser.c"
|
71
|
+
{
|
72
|
+
if ( p == pe )
|
73
|
+
goto _out;
|
74
|
+
switch ( cs )
|
75
|
+
{
|
76
|
+
case 0:
|
77
|
+
switch( (*p) ) {
|
78
|
+
case 13: goto st2;
|
79
|
+
case 48: goto tr16;
|
80
|
+
case 59: goto st15;
|
81
|
+
case 72: goto tr19;
|
82
|
+
}
|
83
|
+
if ( (*p) < 65 ) {
|
84
|
+
if ( 49 <= (*p) && (*p) <= 57 )
|
85
|
+
goto tr17;
|
86
|
+
} else if ( (*p) > 70 ) {
|
87
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
88
|
+
goto tr17;
|
89
|
+
} else
|
90
|
+
goto tr17;
|
91
|
+
goto st1;
|
92
|
+
st1:
|
93
|
+
goto _out1;
|
94
|
+
tr44:
|
95
|
+
#line 33 "ext/http11_client/http11_parser.rl"
|
96
|
+
{
|
97
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
98
|
+
}
|
99
|
+
goto st2;
|
100
|
+
tr52:
|
101
|
+
#line 27 "ext/http11_client/http11_parser.rl"
|
102
|
+
{
|
103
|
+
parser->field_len = LEN(field_start, p);
|
104
|
+
}
|
105
|
+
#line 31 "ext/http11_client/http11_parser.rl"
|
106
|
+
{ MARK(mark, p); }
|
107
|
+
#line 33 "ext/http11_client/http11_parser.rl"
|
108
|
+
{
|
109
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
110
|
+
}
|
111
|
+
goto st2;
|
112
|
+
st2:
|
113
|
+
if ( ++p == pe )
|
114
|
+
goto _out2;
|
115
|
+
case 2:
|
116
|
+
#line 117 "ext/http11_client/http11_parser.c"
|
117
|
+
if ( (*p) == 10 )
|
118
|
+
goto tr34;
|
119
|
+
goto st1;
|
120
|
+
tr33:
|
121
|
+
#line 57 "ext/http11_client/http11_parser.rl"
|
122
|
+
{
|
123
|
+
parser->body_start = p - buffer + 1;
|
124
|
+
if(parser->header_done != NULL)
|
125
|
+
parser->header_done(parser->data, p + 1, pe - p - 1);
|
126
|
+
goto _out36;
|
127
|
+
}
|
128
|
+
goto st36;
|
129
|
+
tr34:
|
130
|
+
#line 53 "ext/http11_client/http11_parser.rl"
|
131
|
+
{
|
132
|
+
parser->last_chunk(parser->data, NULL, 0);
|
133
|
+
}
|
134
|
+
#line 57 "ext/http11_client/http11_parser.rl"
|
135
|
+
{
|
136
|
+
parser->body_start = p - buffer + 1;
|
137
|
+
if(parser->header_done != NULL)
|
138
|
+
parser->header_done(parser->data, p + 1, pe - p - 1);
|
139
|
+
goto _out36;
|
140
|
+
}
|
141
|
+
goto st36;
|
142
|
+
tr35:
|
143
|
+
#line 57 "ext/http11_client/http11_parser.rl"
|
144
|
+
{
|
145
|
+
parser->body_start = p - buffer + 1;
|
146
|
+
if(parser->header_done != NULL)
|
147
|
+
parser->header_done(parser->data, p + 1, pe - p - 1);
|
148
|
+
goto _out36;
|
149
|
+
}
|
150
|
+
#line 53 "ext/http11_client/http11_parser.rl"
|
151
|
+
{
|
152
|
+
parser->last_chunk(parser->data, NULL, 0);
|
153
|
+
}
|
154
|
+
goto st36;
|
155
|
+
st36:
|
156
|
+
if ( ++p == pe )
|
157
|
+
goto _out36;
|
158
|
+
case 36:
|
159
|
+
#line 160 "ext/http11_client/http11_parser.c"
|
160
|
+
goto st1;
|
161
|
+
tr16:
|
162
|
+
#line 23 "ext/http11_client/http11_parser.rl"
|
163
|
+
{MARK(mark, p); }
|
164
|
+
goto st3;
|
165
|
+
st3:
|
166
|
+
if ( ++p == pe )
|
167
|
+
goto _out3;
|
168
|
+
case 3:
|
169
|
+
#line 170 "ext/http11_client/http11_parser.c"
|
170
|
+
switch( (*p) ) {
|
171
|
+
case 13: goto tr50;
|
172
|
+
case 59: goto tr51;
|
173
|
+
}
|
174
|
+
if ( (*p) < 65 ) {
|
175
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
176
|
+
goto st5;
|
177
|
+
} else if ( (*p) > 70 ) {
|
178
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
179
|
+
goto st5;
|
180
|
+
} else
|
181
|
+
goto st5;
|
182
|
+
goto st1;
|
183
|
+
tr47:
|
184
|
+
#line 33 "ext/http11_client/http11_parser.rl"
|
185
|
+
{
|
186
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
187
|
+
}
|
188
|
+
goto st4;
|
189
|
+
tr50:
|
190
|
+
#line 49 "ext/http11_client/http11_parser.rl"
|
191
|
+
{
|
192
|
+
parser->chunk_size(parser->data, PTR_TO(mark), LEN(mark, p));
|
193
|
+
}
|
194
|
+
goto st4;
|
195
|
+
tr56:
|
196
|
+
#line 27 "ext/http11_client/http11_parser.rl"
|
197
|
+
{
|
198
|
+
parser->field_len = LEN(field_start, p);
|
199
|
+
}
|
200
|
+
#line 31 "ext/http11_client/http11_parser.rl"
|
201
|
+
{ MARK(mark, p); }
|
202
|
+
#line 33 "ext/http11_client/http11_parser.rl"
|
203
|
+
{
|
204
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
205
|
+
}
|
206
|
+
goto st4;
|
207
|
+
st4:
|
208
|
+
if ( ++p == pe )
|
209
|
+
goto _out4;
|
210
|
+
case 4:
|
211
|
+
#line 212 "ext/http11_client/http11_parser.c"
|
212
|
+
if ( (*p) == 10 )
|
213
|
+
goto tr35;
|
214
|
+
goto st1;
|
215
|
+
tr17:
|
216
|
+
#line 23 "ext/http11_client/http11_parser.rl"
|
217
|
+
{MARK(mark, p); }
|
218
|
+
goto st5;
|
219
|
+
st5:
|
220
|
+
if ( ++p == pe )
|
221
|
+
goto _out5;
|
222
|
+
case 5:
|
223
|
+
#line 224 "ext/http11_client/http11_parser.c"
|
224
|
+
switch( (*p) ) {
|
225
|
+
case 13: goto tr25;
|
226
|
+
case 59: goto tr27;
|
227
|
+
}
|
228
|
+
if ( (*p) < 65 ) {
|
229
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
230
|
+
goto st5;
|
231
|
+
} else if ( (*p) > 70 ) {
|
232
|
+
if ( 97 <= (*p) && (*p) <= 102 )
|
233
|
+
goto st5;
|
234
|
+
} else
|
235
|
+
goto st5;
|
236
|
+
goto st1;
|
237
|
+
tr22:
|
238
|
+
#line 33 "ext/http11_client/http11_parser.rl"
|
239
|
+
{
|
240
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
241
|
+
}
|
242
|
+
goto st6;
|
243
|
+
tr25:
|
244
|
+
#line 49 "ext/http11_client/http11_parser.rl"
|
245
|
+
{
|
246
|
+
parser->chunk_size(parser->data, PTR_TO(mark), LEN(mark, p));
|
247
|
+
}
|
248
|
+
goto st6;
|
249
|
+
tr28:
|
250
|
+
#line 27 "ext/http11_client/http11_parser.rl"
|
251
|
+
{
|
252
|
+
parser->field_len = LEN(field_start, p);
|
253
|
+
}
|
254
|
+
#line 31 "ext/http11_client/http11_parser.rl"
|
255
|
+
{ MARK(mark, p); }
|
256
|
+
#line 33 "ext/http11_client/http11_parser.rl"
|
257
|
+
{
|
258
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
259
|
+
}
|
260
|
+
goto st6;
|
261
|
+
st6:
|
262
|
+
if ( ++p == pe )
|
263
|
+
goto _out6;
|
264
|
+
case 6:
|
265
|
+
#line 266 "ext/http11_client/http11_parser.c"
|
266
|
+
if ( (*p) == 10 )
|
267
|
+
goto tr33;
|
268
|
+
goto st1;
|
269
|
+
tr24:
|
270
|
+
#line 33 "ext/http11_client/http11_parser.rl"
|
271
|
+
{
|
272
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
273
|
+
}
|
274
|
+
goto st7;
|
275
|
+
tr27:
|
276
|
+
#line 49 "ext/http11_client/http11_parser.rl"
|
277
|
+
{
|
278
|
+
parser->chunk_size(parser->data, PTR_TO(mark), LEN(mark, p));
|
279
|
+
}
|
280
|
+
goto st7;
|
281
|
+
tr30:
|
282
|
+
#line 27 "ext/http11_client/http11_parser.rl"
|
283
|
+
{
|
284
|
+
parser->field_len = LEN(field_start, p);
|
285
|
+
}
|
286
|
+
#line 31 "ext/http11_client/http11_parser.rl"
|
287
|
+
{ MARK(mark, p); }
|
288
|
+
#line 33 "ext/http11_client/http11_parser.rl"
|
289
|
+
{
|
290
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
291
|
+
}
|
292
|
+
goto st7;
|
293
|
+
st7:
|
294
|
+
if ( ++p == pe )
|
295
|
+
goto _out7;
|
296
|
+
case 7:
|
297
|
+
#line 298 "ext/http11_client/http11_parser.c"
|
298
|
+
switch( (*p) ) {
|
299
|
+
case 33: goto tr9;
|
300
|
+
case 124: goto tr9;
|
301
|
+
case 126: goto tr9;
|
302
|
+
}
|
303
|
+
if ( (*p) < 45 ) {
|
304
|
+
if ( (*p) > 39 ) {
|
305
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
306
|
+
goto tr9;
|
307
|
+
} else if ( (*p) >= 35 )
|
308
|
+
goto tr9;
|
309
|
+
} else if ( (*p) > 46 ) {
|
310
|
+
if ( (*p) < 65 ) {
|
311
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
312
|
+
goto tr9;
|
313
|
+
} else if ( (*p) > 90 ) {
|
314
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
315
|
+
goto tr9;
|
316
|
+
} else
|
317
|
+
goto tr9;
|
318
|
+
} else
|
319
|
+
goto tr9;
|
320
|
+
goto st1;
|
321
|
+
tr9:
|
322
|
+
#line 25 "ext/http11_client/http11_parser.rl"
|
323
|
+
{ MARK(field_start, p); }
|
324
|
+
goto st8;
|
325
|
+
st8:
|
326
|
+
if ( ++p == pe )
|
327
|
+
goto _out8;
|
328
|
+
case 8:
|
329
|
+
#line 330 "ext/http11_client/http11_parser.c"
|
330
|
+
switch( (*p) ) {
|
331
|
+
case 13: goto tr28;
|
332
|
+
case 33: goto st8;
|
333
|
+
case 59: goto tr30;
|
334
|
+
case 61: goto tr31;
|
335
|
+
case 124: goto st8;
|
336
|
+
case 126: goto st8;
|
337
|
+
}
|
338
|
+
if ( (*p) < 45 ) {
|
339
|
+
if ( (*p) > 39 ) {
|
340
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
341
|
+
goto st8;
|
342
|
+
} else if ( (*p) >= 35 )
|
343
|
+
goto st8;
|
344
|
+
} else if ( (*p) > 46 ) {
|
345
|
+
if ( (*p) < 65 ) {
|
346
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
347
|
+
goto st8;
|
348
|
+
} else if ( (*p) > 90 ) {
|
349
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
350
|
+
goto st8;
|
351
|
+
} else
|
352
|
+
goto st8;
|
353
|
+
} else
|
354
|
+
goto st8;
|
355
|
+
goto st1;
|
356
|
+
tr31:
|
357
|
+
#line 27 "ext/http11_client/http11_parser.rl"
|
358
|
+
{
|
359
|
+
parser->field_len = LEN(field_start, p);
|
360
|
+
}
|
361
|
+
#line 31 "ext/http11_client/http11_parser.rl"
|
362
|
+
{ MARK(mark, p); }
|
363
|
+
goto st9;
|
364
|
+
st9:
|
365
|
+
if ( ++p == pe )
|
366
|
+
goto _out9;
|
367
|
+
case 9:
|
368
|
+
#line 369 "ext/http11_client/http11_parser.c"
|
369
|
+
switch( (*p) ) {
|
370
|
+
case 33: goto tr10;
|
371
|
+
case 124: goto tr10;
|
372
|
+
case 126: goto tr10;
|
373
|
+
}
|
374
|
+
if ( (*p) < 45 ) {
|
375
|
+
if ( (*p) > 39 ) {
|
376
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
377
|
+
goto tr10;
|
378
|
+
} else if ( (*p) >= 35 )
|
379
|
+
goto tr10;
|
380
|
+
} else if ( (*p) > 46 ) {
|
381
|
+
if ( (*p) < 65 ) {
|
382
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
383
|
+
goto tr10;
|
384
|
+
} else if ( (*p) > 90 ) {
|
385
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
386
|
+
goto tr10;
|
387
|
+
} else
|
388
|
+
goto tr10;
|
389
|
+
} else
|
390
|
+
goto tr10;
|
391
|
+
goto st1;
|
392
|
+
tr10:
|
393
|
+
#line 31 "ext/http11_client/http11_parser.rl"
|
394
|
+
{ MARK(mark, p); }
|
395
|
+
goto st10;
|
396
|
+
st10:
|
397
|
+
if ( ++p == pe )
|
398
|
+
goto _out10;
|
399
|
+
case 10:
|
400
|
+
#line 401 "ext/http11_client/http11_parser.c"
|
401
|
+
switch( (*p) ) {
|
402
|
+
case 13: goto tr22;
|
403
|
+
case 33: goto st10;
|
404
|
+
case 59: goto tr24;
|
405
|
+
case 124: goto st10;
|
406
|
+
case 126: goto st10;
|
407
|
+
}
|
408
|
+
if ( (*p) < 45 ) {
|
409
|
+
if ( (*p) > 39 ) {
|
410
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
411
|
+
goto st10;
|
412
|
+
} else if ( (*p) >= 35 )
|
413
|
+
goto st10;
|
414
|
+
} else if ( (*p) > 46 ) {
|
415
|
+
if ( (*p) < 65 ) {
|
416
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
417
|
+
goto st10;
|
418
|
+
} else if ( (*p) > 90 ) {
|
419
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
420
|
+
goto st10;
|
421
|
+
} else
|
422
|
+
goto st10;
|
423
|
+
} else
|
424
|
+
goto st10;
|
425
|
+
goto st1;
|
426
|
+
tr49:
|
427
|
+
#line 33 "ext/http11_client/http11_parser.rl"
|
428
|
+
{
|
429
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
430
|
+
}
|
431
|
+
goto st11;
|
432
|
+
tr51:
|
433
|
+
#line 49 "ext/http11_client/http11_parser.rl"
|
434
|
+
{
|
435
|
+
parser->chunk_size(parser->data, PTR_TO(mark), LEN(mark, p));
|
436
|
+
}
|
437
|
+
goto st11;
|
438
|
+
tr58:
|
439
|
+
#line 27 "ext/http11_client/http11_parser.rl"
|
440
|
+
{
|
441
|
+
parser->field_len = LEN(field_start, p);
|
442
|
+
}
|
443
|
+
#line 31 "ext/http11_client/http11_parser.rl"
|
444
|
+
{ MARK(mark, p); }
|
445
|
+
#line 33 "ext/http11_client/http11_parser.rl"
|
446
|
+
{
|
447
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
448
|
+
}
|
449
|
+
goto st11;
|
450
|
+
st11:
|
451
|
+
if ( ++p == pe )
|
452
|
+
goto _out11;
|
453
|
+
case 11:
|
454
|
+
#line 455 "ext/http11_client/http11_parser.c"
|
455
|
+
switch( (*p) ) {
|
456
|
+
case 33: goto tr63;
|
457
|
+
case 124: goto tr63;
|
458
|
+
case 126: goto tr63;
|
459
|
+
}
|
460
|
+
if ( (*p) < 45 ) {
|
461
|
+
if ( (*p) > 39 ) {
|
462
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
463
|
+
goto tr63;
|
464
|
+
} else if ( (*p) >= 35 )
|
465
|
+
goto tr63;
|
466
|
+
} else if ( (*p) > 46 ) {
|
467
|
+
if ( (*p) < 65 ) {
|
468
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
469
|
+
goto tr63;
|
470
|
+
} else if ( (*p) > 90 ) {
|
471
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
472
|
+
goto tr63;
|
473
|
+
} else
|
474
|
+
goto tr63;
|
475
|
+
} else
|
476
|
+
goto tr63;
|
477
|
+
goto st1;
|
478
|
+
tr63:
|
479
|
+
#line 25 "ext/http11_client/http11_parser.rl"
|
480
|
+
{ MARK(field_start, p); }
|
481
|
+
goto st12;
|
482
|
+
st12:
|
483
|
+
if ( ++p == pe )
|
484
|
+
goto _out12;
|
485
|
+
case 12:
|
486
|
+
#line 487 "ext/http11_client/http11_parser.c"
|
487
|
+
switch( (*p) ) {
|
488
|
+
case 13: goto tr56;
|
489
|
+
case 33: goto st12;
|
490
|
+
case 59: goto tr58;
|
491
|
+
case 61: goto tr59;
|
492
|
+
case 124: goto st12;
|
493
|
+
case 126: goto st12;
|
494
|
+
}
|
495
|
+
if ( (*p) < 45 ) {
|
496
|
+
if ( (*p) > 39 ) {
|
497
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
498
|
+
goto st12;
|
499
|
+
} else if ( (*p) >= 35 )
|
500
|
+
goto st12;
|
501
|
+
} else if ( (*p) > 46 ) {
|
502
|
+
if ( (*p) < 65 ) {
|
503
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
504
|
+
goto st12;
|
505
|
+
} else if ( (*p) > 90 ) {
|
506
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
507
|
+
goto st12;
|
508
|
+
} else
|
509
|
+
goto st12;
|
510
|
+
} else
|
511
|
+
goto st12;
|
512
|
+
goto st1;
|
513
|
+
tr59:
|
514
|
+
#line 27 "ext/http11_client/http11_parser.rl"
|
515
|
+
{
|
516
|
+
parser->field_len = LEN(field_start, p);
|
517
|
+
}
|
518
|
+
#line 31 "ext/http11_client/http11_parser.rl"
|
519
|
+
{ MARK(mark, p); }
|
520
|
+
goto st13;
|
521
|
+
st13:
|
522
|
+
if ( ++p == pe )
|
523
|
+
goto _out13;
|
524
|
+
case 13:
|
525
|
+
#line 526 "ext/http11_client/http11_parser.c"
|
526
|
+
switch( (*p) ) {
|
527
|
+
case 33: goto tr61;
|
528
|
+
case 124: goto tr61;
|
529
|
+
case 126: goto tr61;
|
530
|
+
}
|
531
|
+
if ( (*p) < 45 ) {
|
532
|
+
if ( (*p) > 39 ) {
|
533
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
534
|
+
goto tr61;
|
535
|
+
} else if ( (*p) >= 35 )
|
536
|
+
goto tr61;
|
537
|
+
} else if ( (*p) > 46 ) {
|
538
|
+
if ( (*p) < 65 ) {
|
539
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
540
|
+
goto tr61;
|
541
|
+
} else if ( (*p) > 90 ) {
|
542
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
543
|
+
goto tr61;
|
544
|
+
} else
|
545
|
+
goto tr61;
|
546
|
+
} else
|
547
|
+
goto tr61;
|
548
|
+
goto st1;
|
549
|
+
tr61:
|
550
|
+
#line 31 "ext/http11_client/http11_parser.rl"
|
551
|
+
{ MARK(mark, p); }
|
552
|
+
goto st14;
|
553
|
+
st14:
|
554
|
+
if ( ++p == pe )
|
555
|
+
goto _out14;
|
556
|
+
case 14:
|
557
|
+
#line 558 "ext/http11_client/http11_parser.c"
|
558
|
+
switch( (*p) ) {
|
559
|
+
case 13: goto tr47;
|
560
|
+
case 33: goto st14;
|
561
|
+
case 59: goto tr49;
|
562
|
+
case 124: goto st14;
|
563
|
+
case 126: goto st14;
|
564
|
+
}
|
565
|
+
if ( (*p) < 45 ) {
|
566
|
+
if ( (*p) > 39 ) {
|
567
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
568
|
+
goto st14;
|
569
|
+
} else if ( (*p) >= 35 )
|
570
|
+
goto st14;
|
571
|
+
} else if ( (*p) > 46 ) {
|
572
|
+
if ( (*p) < 65 ) {
|
573
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
574
|
+
goto st14;
|
575
|
+
} else if ( (*p) > 90 ) {
|
576
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
577
|
+
goto st14;
|
578
|
+
} else
|
579
|
+
goto st14;
|
580
|
+
} else
|
581
|
+
goto st14;
|
582
|
+
goto st1;
|
583
|
+
tr46:
|
584
|
+
#line 33 "ext/http11_client/http11_parser.rl"
|
585
|
+
{
|
586
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
587
|
+
}
|
588
|
+
goto st15;
|
589
|
+
tr54:
|
590
|
+
#line 27 "ext/http11_client/http11_parser.rl"
|
591
|
+
{
|
592
|
+
parser->field_len = LEN(field_start, p);
|
593
|
+
}
|
594
|
+
#line 31 "ext/http11_client/http11_parser.rl"
|
595
|
+
{ MARK(mark, p); }
|
596
|
+
#line 33 "ext/http11_client/http11_parser.rl"
|
597
|
+
{
|
598
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
599
|
+
}
|
600
|
+
goto st15;
|
601
|
+
st15:
|
602
|
+
if ( ++p == pe )
|
603
|
+
goto _out15;
|
604
|
+
case 15:
|
605
|
+
#line 606 "ext/http11_client/http11_parser.c"
|
606
|
+
switch( (*p) ) {
|
607
|
+
case 33: goto tr62;
|
608
|
+
case 124: goto tr62;
|
609
|
+
case 126: goto tr62;
|
610
|
+
}
|
611
|
+
if ( (*p) < 45 ) {
|
612
|
+
if ( (*p) > 39 ) {
|
613
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
614
|
+
goto tr62;
|
615
|
+
} else if ( (*p) >= 35 )
|
616
|
+
goto tr62;
|
617
|
+
} else if ( (*p) > 46 ) {
|
618
|
+
if ( (*p) < 65 ) {
|
619
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
620
|
+
goto tr62;
|
621
|
+
} else if ( (*p) > 90 ) {
|
622
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
623
|
+
goto tr62;
|
624
|
+
} else
|
625
|
+
goto tr62;
|
626
|
+
} else
|
627
|
+
goto tr62;
|
628
|
+
goto st1;
|
629
|
+
tr62:
|
630
|
+
#line 25 "ext/http11_client/http11_parser.rl"
|
631
|
+
{ MARK(field_start, p); }
|
632
|
+
goto st16;
|
633
|
+
st16:
|
634
|
+
if ( ++p == pe )
|
635
|
+
goto _out16;
|
636
|
+
case 16:
|
637
|
+
#line 638 "ext/http11_client/http11_parser.c"
|
638
|
+
switch( (*p) ) {
|
639
|
+
case 13: goto tr52;
|
640
|
+
case 33: goto st16;
|
641
|
+
case 59: goto tr54;
|
642
|
+
case 61: goto tr55;
|
643
|
+
case 124: goto st16;
|
644
|
+
case 126: goto st16;
|
645
|
+
}
|
646
|
+
if ( (*p) < 45 ) {
|
647
|
+
if ( (*p) > 39 ) {
|
648
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
649
|
+
goto st16;
|
650
|
+
} else if ( (*p) >= 35 )
|
651
|
+
goto st16;
|
652
|
+
} else if ( (*p) > 46 ) {
|
653
|
+
if ( (*p) < 65 ) {
|
654
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
655
|
+
goto st16;
|
656
|
+
} else if ( (*p) > 90 ) {
|
657
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
658
|
+
goto st16;
|
659
|
+
} else
|
660
|
+
goto st16;
|
661
|
+
} else
|
662
|
+
goto st16;
|
663
|
+
goto st1;
|
664
|
+
tr55:
|
665
|
+
#line 27 "ext/http11_client/http11_parser.rl"
|
666
|
+
{
|
667
|
+
parser->field_len = LEN(field_start, p);
|
668
|
+
}
|
669
|
+
#line 31 "ext/http11_client/http11_parser.rl"
|
670
|
+
{ MARK(mark, p); }
|
671
|
+
goto st17;
|
672
|
+
st17:
|
673
|
+
if ( ++p == pe )
|
674
|
+
goto _out17;
|
675
|
+
case 17:
|
676
|
+
#line 677 "ext/http11_client/http11_parser.c"
|
677
|
+
switch( (*p) ) {
|
678
|
+
case 33: goto tr60;
|
679
|
+
case 124: goto tr60;
|
680
|
+
case 126: goto tr60;
|
681
|
+
}
|
682
|
+
if ( (*p) < 45 ) {
|
683
|
+
if ( (*p) > 39 ) {
|
684
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
685
|
+
goto tr60;
|
686
|
+
} else if ( (*p) >= 35 )
|
687
|
+
goto tr60;
|
688
|
+
} else if ( (*p) > 46 ) {
|
689
|
+
if ( (*p) < 65 ) {
|
690
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
691
|
+
goto tr60;
|
692
|
+
} else if ( (*p) > 90 ) {
|
693
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
694
|
+
goto tr60;
|
695
|
+
} else
|
696
|
+
goto tr60;
|
697
|
+
} else
|
698
|
+
goto tr60;
|
699
|
+
goto st1;
|
700
|
+
tr60:
|
701
|
+
#line 31 "ext/http11_client/http11_parser.rl"
|
702
|
+
{ MARK(mark, p); }
|
703
|
+
goto st18;
|
704
|
+
st18:
|
705
|
+
if ( ++p == pe )
|
706
|
+
goto _out18;
|
707
|
+
case 18:
|
708
|
+
#line 709 "ext/http11_client/http11_parser.c"
|
709
|
+
switch( (*p) ) {
|
710
|
+
case 13: goto tr44;
|
711
|
+
case 33: goto st18;
|
712
|
+
case 59: goto tr46;
|
713
|
+
case 124: goto st18;
|
714
|
+
case 126: goto st18;
|
715
|
+
}
|
716
|
+
if ( (*p) < 45 ) {
|
717
|
+
if ( (*p) > 39 ) {
|
718
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
719
|
+
goto st18;
|
720
|
+
} else if ( (*p) >= 35 )
|
721
|
+
goto st18;
|
722
|
+
} else if ( (*p) > 46 ) {
|
723
|
+
if ( (*p) < 65 ) {
|
724
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
725
|
+
goto st18;
|
726
|
+
} else if ( (*p) > 90 ) {
|
727
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
728
|
+
goto st18;
|
729
|
+
} else
|
730
|
+
goto st18;
|
731
|
+
} else
|
732
|
+
goto st18;
|
733
|
+
goto st1;
|
734
|
+
tr19:
|
735
|
+
#line 23 "ext/http11_client/http11_parser.rl"
|
736
|
+
{MARK(mark, p); }
|
737
|
+
goto st19;
|
738
|
+
st19:
|
739
|
+
if ( ++p == pe )
|
740
|
+
goto _out19;
|
741
|
+
case 19:
|
742
|
+
#line 743 "ext/http11_client/http11_parser.c"
|
743
|
+
if ( (*p) == 84 )
|
744
|
+
goto st20;
|
745
|
+
goto st1;
|
746
|
+
st20:
|
747
|
+
if ( ++p == pe )
|
748
|
+
goto _out20;
|
749
|
+
case 20:
|
750
|
+
if ( (*p) == 84 )
|
751
|
+
goto st21;
|
752
|
+
goto st1;
|
753
|
+
st21:
|
754
|
+
if ( ++p == pe )
|
755
|
+
goto _out21;
|
756
|
+
case 21:
|
757
|
+
if ( (*p) == 80 )
|
758
|
+
goto st22;
|
759
|
+
goto st1;
|
760
|
+
st22:
|
761
|
+
if ( ++p == pe )
|
762
|
+
goto _out22;
|
763
|
+
case 22:
|
764
|
+
if ( (*p) == 47 )
|
765
|
+
goto st23;
|
766
|
+
goto st1;
|
767
|
+
st23:
|
768
|
+
if ( ++p == pe )
|
769
|
+
goto _out23;
|
770
|
+
case 23:
|
771
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
772
|
+
goto st24;
|
773
|
+
goto st1;
|
774
|
+
st24:
|
775
|
+
if ( ++p == pe )
|
776
|
+
goto _out24;
|
777
|
+
case 24:
|
778
|
+
if ( (*p) == 46 )
|
779
|
+
goto st25;
|
780
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
781
|
+
goto st24;
|
782
|
+
goto st1;
|
783
|
+
st25:
|
784
|
+
if ( ++p == pe )
|
785
|
+
goto _out25;
|
786
|
+
case 25:
|
787
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
788
|
+
goto st26;
|
789
|
+
goto st1;
|
790
|
+
st26:
|
791
|
+
if ( ++p == pe )
|
792
|
+
goto _out26;
|
793
|
+
case 26:
|
794
|
+
if ( (*p) == 32 )
|
795
|
+
goto tr13;
|
796
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
797
|
+
goto st26;
|
798
|
+
goto st1;
|
799
|
+
tr13:
|
800
|
+
#line 45 "ext/http11_client/http11_parser.rl"
|
801
|
+
{
|
802
|
+
parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p));
|
803
|
+
}
|
804
|
+
goto st27;
|
805
|
+
st27:
|
806
|
+
if ( ++p == pe )
|
807
|
+
goto _out27;
|
808
|
+
case 27:
|
809
|
+
#line 810 "ext/http11_client/http11_parser.c"
|
810
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
811
|
+
goto tr4;
|
812
|
+
goto st1;
|
813
|
+
tr4:
|
814
|
+
#line 23 "ext/http11_client/http11_parser.rl"
|
815
|
+
{MARK(mark, p); }
|
816
|
+
goto st28;
|
817
|
+
st28:
|
818
|
+
if ( ++p == pe )
|
819
|
+
goto _out28;
|
820
|
+
case 28:
|
821
|
+
#line 822 "ext/http11_client/http11_parser.c"
|
822
|
+
if ( (*p) == 32 )
|
823
|
+
goto tr11;
|
824
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
825
|
+
goto st28;
|
826
|
+
goto st1;
|
827
|
+
tr11:
|
828
|
+
#line 41 "ext/http11_client/http11_parser.rl"
|
829
|
+
{
|
830
|
+
parser->status_code(parser->data, PTR_TO(mark), LEN(mark, p));
|
831
|
+
}
|
832
|
+
goto st29;
|
833
|
+
st29:
|
834
|
+
if ( ++p == pe )
|
835
|
+
goto _out29;
|
836
|
+
case 29:
|
837
|
+
#line 838 "ext/http11_client/http11_parser.c"
|
838
|
+
goto tr40;
|
839
|
+
tr40:
|
840
|
+
#line 23 "ext/http11_client/http11_parser.rl"
|
841
|
+
{MARK(mark, p); }
|
842
|
+
goto st30;
|
843
|
+
st30:
|
844
|
+
if ( ++p == pe )
|
845
|
+
goto _out30;
|
846
|
+
case 30:
|
847
|
+
#line 848 "ext/http11_client/http11_parser.c"
|
848
|
+
if ( (*p) == 13 )
|
849
|
+
goto tr39;
|
850
|
+
goto st30;
|
851
|
+
tr37:
|
852
|
+
#line 33 "ext/http11_client/http11_parser.rl"
|
853
|
+
{
|
854
|
+
parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
|
855
|
+
}
|
856
|
+
goto st31;
|
857
|
+
tr39:
|
858
|
+
#line 37 "ext/http11_client/http11_parser.rl"
|
859
|
+
{
|
860
|
+
parser->reason_phrase(parser->data, PTR_TO(mark), LEN(mark, p));
|
861
|
+
}
|
862
|
+
goto st31;
|
863
|
+
st31:
|
864
|
+
if ( ++p == pe )
|
865
|
+
goto _out31;
|
866
|
+
case 31:
|
867
|
+
#line 868 "ext/http11_client/http11_parser.c"
|
868
|
+
if ( (*p) == 10 )
|
869
|
+
goto st32;
|
870
|
+
goto st1;
|
871
|
+
st32:
|
872
|
+
if ( ++p == pe )
|
873
|
+
goto _out32;
|
874
|
+
case 32:
|
875
|
+
switch( (*p) ) {
|
876
|
+
case 13: goto st6;
|
877
|
+
case 33: goto tr21;
|
878
|
+
case 124: goto tr21;
|
879
|
+
case 126: goto tr21;
|
880
|
+
}
|
881
|
+
if ( (*p) < 45 ) {
|
882
|
+
if ( (*p) > 39 ) {
|
883
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
884
|
+
goto tr21;
|
885
|
+
} else if ( (*p) >= 35 )
|
886
|
+
goto tr21;
|
887
|
+
} else if ( (*p) > 46 ) {
|
888
|
+
if ( (*p) < 65 ) {
|
889
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
890
|
+
goto tr21;
|
891
|
+
} else if ( (*p) > 90 ) {
|
892
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
893
|
+
goto tr21;
|
894
|
+
} else
|
895
|
+
goto tr21;
|
896
|
+
} else
|
897
|
+
goto tr21;
|
898
|
+
goto st1;
|
899
|
+
tr21:
|
900
|
+
#line 25 "ext/http11_client/http11_parser.rl"
|
901
|
+
{ MARK(field_start, p); }
|
902
|
+
goto st33;
|
903
|
+
st33:
|
904
|
+
if ( ++p == pe )
|
905
|
+
goto _out33;
|
906
|
+
case 33:
|
907
|
+
#line 908 "ext/http11_client/http11_parser.c"
|
908
|
+
switch( (*p) ) {
|
909
|
+
case 33: goto st33;
|
910
|
+
case 58: goto tr8;
|
911
|
+
case 124: goto st33;
|
912
|
+
case 126: goto st33;
|
913
|
+
}
|
914
|
+
if ( (*p) < 45 ) {
|
915
|
+
if ( (*p) > 39 ) {
|
916
|
+
if ( 42 <= (*p) && (*p) <= 43 )
|
917
|
+
goto st33;
|
918
|
+
} else if ( (*p) >= 35 )
|
919
|
+
goto st33;
|
920
|
+
} else if ( (*p) > 46 ) {
|
921
|
+
if ( (*p) < 65 ) {
|
922
|
+
if ( 48 <= (*p) && (*p) <= 57 )
|
923
|
+
goto st33;
|
924
|
+
} else if ( (*p) > 90 ) {
|
925
|
+
if ( 94 <= (*p) && (*p) <= 122 )
|
926
|
+
goto st33;
|
927
|
+
} else
|
928
|
+
goto st33;
|
929
|
+
} else
|
930
|
+
goto st33;
|
931
|
+
goto st1;
|
932
|
+
tr8:
|
933
|
+
#line 27 "ext/http11_client/http11_parser.rl"
|
934
|
+
{
|
935
|
+
parser->field_len = LEN(field_start, p);
|
936
|
+
}
|
937
|
+
goto st34;
|
938
|
+
tr42:
|
939
|
+
#line 31 "ext/http11_client/http11_parser.rl"
|
940
|
+
{ MARK(mark, p); }
|
941
|
+
goto st34;
|
942
|
+
st34:
|
943
|
+
if ( ++p == pe )
|
944
|
+
goto _out34;
|
945
|
+
case 34:
|
946
|
+
#line 947 "ext/http11_client/http11_parser.c"
|
947
|
+
switch( (*p) ) {
|
948
|
+
case 13: goto tr37;
|
949
|
+
case 32: goto tr42;
|
950
|
+
}
|
951
|
+
goto tr41;
|
952
|
+
tr41:
|
953
|
+
#line 31 "ext/http11_client/http11_parser.rl"
|
954
|
+
{ MARK(mark, p); }
|
955
|
+
goto st35;
|
956
|
+
st35:
|
957
|
+
if ( ++p == pe )
|
958
|
+
goto _out35;
|
959
|
+
case 35:
|
960
|
+
#line 961 "ext/http11_client/http11_parser.c"
|
961
|
+
if ( (*p) == 13 )
|
962
|
+
goto tr37;
|
963
|
+
goto st35;
|
964
|
+
}
|
965
|
+
_out1: cs = 1; goto _out;
|
966
|
+
_out2: cs = 2; goto _out;
|
967
|
+
_out36: cs = 36; goto _out;
|
968
|
+
_out3: cs = 3; goto _out;
|
969
|
+
_out4: cs = 4; goto _out;
|
970
|
+
_out5: cs = 5; goto _out;
|
971
|
+
_out6: cs = 6; goto _out;
|
972
|
+
_out7: cs = 7; goto _out;
|
973
|
+
_out8: cs = 8; goto _out;
|
974
|
+
_out9: cs = 9; goto _out;
|
975
|
+
_out10: cs = 10; goto _out;
|
976
|
+
_out11: cs = 11; goto _out;
|
977
|
+
_out12: cs = 12; goto _out;
|
978
|
+
_out13: cs = 13; goto _out;
|
979
|
+
_out14: cs = 14; goto _out;
|
980
|
+
_out15: cs = 15; goto _out;
|
981
|
+
_out16: cs = 16; goto _out;
|
982
|
+
_out17: cs = 17; goto _out;
|
983
|
+
_out18: cs = 18; goto _out;
|
984
|
+
_out19: cs = 19; goto _out;
|
985
|
+
_out20: cs = 20; goto _out;
|
986
|
+
_out21: cs = 21; goto _out;
|
987
|
+
_out22: cs = 22; goto _out;
|
988
|
+
_out23: cs = 23; goto _out;
|
989
|
+
_out24: cs = 24; goto _out;
|
990
|
+
_out25: cs = 25; goto _out;
|
991
|
+
_out26: cs = 26; goto _out;
|
992
|
+
_out27: cs = 27; goto _out;
|
993
|
+
_out28: cs = 28; goto _out;
|
994
|
+
_out29: cs = 29; goto _out;
|
995
|
+
_out30: cs = 30; goto _out;
|
996
|
+
_out31: cs = 31; goto _out;
|
997
|
+
_out32: cs = 32; goto _out;
|
998
|
+
_out33: cs = 33; goto _out;
|
999
|
+
_out34: cs = 34; goto _out;
|
1000
|
+
_out35: cs = 35; goto _out;
|
1001
|
+
|
1002
|
+
_out: {}
|
1003
|
+
}
|
1004
|
+
#line 130 "ext/http11_client/http11_parser.rl"
|
1005
|
+
|
1006
|
+
parser->cs = cs;
|
1007
|
+
parser->nread += p - (buffer + off);
|
1008
|
+
|
1009
|
+
assert(p <= pe && "buffer overflow after parsing execute");
|
1010
|
+
assert(parser->nread <= len && "nread longer than length");
|
1011
|
+
assert(parser->body_start <= len && "body starts after buffer end");
|
1012
|
+
assert(parser->mark < len && "mark is after buffer end");
|
1013
|
+
assert(parser->field_len <= len && "field has length longer than whole buffer");
|
1014
|
+
assert(parser->field_start < len && "field starts after buffer end");
|
1015
|
+
|
1016
|
+
if(parser->body_start) {
|
1017
|
+
/* final \r\n combo encountered so stop right here */
|
1018
|
+
|
1019
|
+
#line 1020 "ext/http11_client/http11_parser.c"
|
1020
|
+
#line 144 "ext/http11_client/http11_parser.rl"
|
1021
|
+
parser->nread++;
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
return(parser->nread);
|
1025
|
+
}
|
1026
|
+
|
1027
|
+
int httpclient_parser_finish(httpclient_parser *parser)
|
1028
|
+
{
|
1029
|
+
int cs = parser->cs;
|
1030
|
+
|
1031
|
+
|
1032
|
+
#line 1033 "ext/http11_client/http11_parser.c"
|
1033
|
+
#line 155 "ext/http11_client/http11_parser.rl"
|
1034
|
+
|
1035
|
+
parser->cs = cs;
|
1036
|
+
|
1037
|
+
if (httpclient_parser_has_error(parser) ) {
|
1038
|
+
return -1;
|
1039
|
+
} else if (httpclient_parser_is_finished(parser) ) {
|
1040
|
+
return 1;
|
1041
|
+
} else {
|
1042
|
+
return 0;
|
1043
|
+
}
|
1044
|
+
}
|
1045
|
+
|
1046
|
+
int httpclient_parser_has_error(httpclient_parser *parser) {
|
1047
|
+
return parser->cs == httpclient_parser_error;
|
1048
|
+
}
|
1049
|
+
|
1050
|
+
int httpclient_parser_is_finished(httpclient_parser *parser) {
|
1051
|
+
return parser->cs == httpclient_parser_first_final;
|
1052
|
+
}
|