~cpick/mongrel2/release

« back to all changes in this revision

Viewing changes to src/state.c

  • Committer: Chris Pick
  • Date: 2013-06-30 16:39:57 UTC
  • mfrom: (1106.1.15)
  • Revision ID: git-v1:ec39967acb6bc9867ed9b9dc3774304ca6b9c294
Merge tag 'v1.8.1' into debian

Hotfix for github issue 148

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#define CALL(A, C) TRACE(A,C); if(state->actions && state->actions->A) next = state->actions->A(conn)
45
45
 
46
46
 
47
 
#line 86 "src/state.rl"
 
47
#line 87 "src/state.rl"
48
48
 
49
49
 
50
50
 
51
51
#line 52 "src/state.c"
52
 
static const int StateActions_start = 16;
53
 
static const int StateActions_first_final = 16;
 
52
static const int StateActions_start = 18;
 
53
static const int StateActions_first_final = 18;
54
54
static const int StateActions_error = 0;
55
55
 
56
 
static const int StateActions_en_Proxy = 10;
57
 
static const int StateActions_en_main = 16;
 
56
static const int StateActions_en_Proxy = 12;
 
57
static const int StateActions_en_main = 18;
58
58
static const int StateActions_en_main_Connection_Idle = 5;
59
59
static const int StateActions_en_main_Connection_HTTPRouting = 3;
60
60
 
61
61
 
62
 
#line 89 "src/state.rl"
 
62
#line 90 "src/state.rl"
63
63
 
64
64
int State_init(State *state, StateActions *actions)
65
65
{
71
71
         state->cs = StateActions_start;
72
72
        }
73
73
 
74
 
#line 95 "src/state.rl"
 
74
#line 96 "src/state.rl"
75
75
    return 1;
76
76
}
77
77
 
80
80
    if ( state->cs == 
81
81
#line 82 "src/state.c"
82
82
0
83
 
#line 100 "src/state.rl"
 
83
#line 101 "src/state.rl"
84
84
 ) {
85
85
        return -1;
86
86
    }
87
87
 
88
88
    if ( state->cs >= 
89
89
#line 90 "src/state.c"
90
 
16
91
 
#line 104 "src/state.rl"
 
90
18
 
91
#line 105 "src/state.rl"
92
92
 ) {
93
93
        return 1;
94
94
    }
113
113
                goto _test_eof;
114
114
        switch (  state->cs )
115
115
        {
116
 
case 16:
 
116
case 18:
117
117
        if ( (*p) == 107 )
118
 
                goto tr20;
 
118
                goto tr23;
119
119
        goto st0;
120
120
tr0:
121
121
#line 51 "src/state.rl"
125
125
st0:
126
126
 state->cs = 0;
127
127
        goto _out;
128
 
tr20:
 
128
tr23:
129
129
#line 53 "src/state.rl"
130
130
        { CALL(parse, (*p)); }
131
131
        goto st1;
142
142
tr1:
143
143
#line 52 "src/state.rl"
144
144
        { CALL(close, (*p)); }
145
 
        goto st17;
146
 
st17:
 
145
        goto st19;
 
146
st19:
147
147
        if ( ++p == pe )
148
 
                goto _test_eof17;
149
 
case 17:
 
148
                goto _test_eof19;
 
149
case 19:
150
150
#line 151 "src/state.c"
151
151
        if ( (*p) == 107 )
152
 
                goto tr20;
 
152
                goto tr23;
153
153
        goto tr0;
154
154
tr2:
155
155
#line 54 "src/state.rl"
165
165
                case 105: goto tr3;
166
166
                case 106: goto tr4;
167
167
                case 113: goto tr5;
 
168
                case 115: goto tr6;
168
169
        }
169
170
        goto tr0;
170
171
tr3:
175
176
        if ( ++p == pe )
176
177
                goto _test_eof3;
177
178
case 3:
178
 
#line 179 "src/state.c"
 
179
#line 180 "src/state.c"
179
180
        switch( (*p) ) {
180
181
                case 100: goto tr1;
181
 
                case 102: goto tr6;
182
 
                case 104: goto tr7;
183
 
                case 108: goto tr8;
 
182
                case 102: goto tr7;
 
183
                case 104: goto tr8;
 
184
                case 108: goto tr9;
184
185
        }
185
186
        goto tr0;
186
187
tr5:
187
188
#line 56 "src/state.rl"
188
189
        { CALL(send_socket_response, (*p)); }
189
190
        goto st4;
190
 
tr6:
191
 
#line 62 "src/state.rl"
 
191
tr7:
 
192
#line 63 "src/state.rl"
192
193
        { CALL(http_to_directory, (*p)); }
193
194
        goto st4;
194
195
st4:
195
196
        if ( ++p == pe )
196
197
                goto _test_eof4;
197
198
case 4:
198
 
#line 199 "src/state.c"
 
199
#line 200 "src/state.c"
199
200
        switch( (*p) ) {
200
201
                case 100: goto tr1;
201
 
                case 112: goto tr9;
 
202
                case 112: goto tr10;
202
203
        }
203
204
        goto tr0;
204
 
tr9:
 
205
tr10:
205
206
#line 53 "src/state.rl"
206
207
        { CALL(parse, (*p)); }
207
208
        goto st5;
209
210
        if ( ++p == pe )
210
211
                goto _test_eof5;
211
212
case 5:
212
 
#line 213 "src/state.c"
 
213
#line 214 "src/state.c"
213
214
        switch( (*p) ) {
214
215
                case 100: goto tr1;
215
 
                case 110: goto tr10;
 
216
                case 110: goto tr11;
216
217
        }
217
218
        goto tr0;
218
 
tr10:
 
219
tr11:
219
220
#line 55 "src/state.rl"
220
221
        { CALL(identify_request, (*p)); }
221
222
        goto st6;
223
224
        if ( ++p == pe )
224
225
                goto _test_eof6;
225
226
case 6:
226
 
#line 227 "src/state.c"
 
227
#line 228 "src/state.c"
227
228
        switch( (*p) ) {
228
229
                case 105: goto tr3;
229
230
                case 106: goto tr4;
238
239
        if ( ++p == pe )
239
240
                goto _test_eof7;
240
241
case 7:
241
 
#line 242 "src/state.c"
 
242
#line 243 "src/state.c"
242
243
        if ( (*p) == 104 )
243
 
                goto tr11;
 
244
                goto tr12;
244
245
        goto tr0;
245
 
tr7:
 
246
tr8:
246
247
#line 60 "src/state.rl"
247
248
        { CALL(http_to_handler, (*p)); }
248
249
        goto st8;
249
 
tr11:
 
250
tr12:
250
251
#line 58 "src/state.rl"
251
252
        { CALL(msg_to_handler, (*p)); }
252
253
        goto st8;
254
255
        if ( ++p == pe )
255
256
                goto _test_eof8;
256
257
case 8:
257
 
#line 258 "src/state.c"
 
258
#line 259 "src/state.c"
258
259
        if ( (*p) == 111 )
259
 
                goto tr9;
 
260
                goto tr10;
260
261
        goto tr0;
261
 
tr8:
262
 
#line 61 "src/state.rl"
263
 
        { CALL(http_to_proxy, (*p)); {goto st10;} }
 
262
tr9:
 
263
#line 62 "src/state.rl"
 
264
        { CALL(http_to_proxy, (*p)); {goto st12;} }
264
265
        goto st9;
265
266
st9:
266
267
        if ( ++p == pe )
267
268
                goto _test_eof9;
268
269
case 9:
269
 
#line 270 "src/state.c"
 
270
#line 271 "src/state.c"
270
271
        goto tr0;
 
272
tr6:
 
273
#line 57 "src/state.rl"
 
274
        { CALL(route_request, (*p)); }
 
275
        goto st10;
271
276
st10:
272
277
        if ( ++p == pe )
273
278
                goto _test_eof10;
274
279
case 10:
275
 
        switch( (*p) ) {
276
 
                case 101: goto tr12;
277
 
                case 103: goto tr14;
278
 
        }
279
 
        goto st0;
280
 
tr12:
281
 
#line 65 "src/state.rl"
282
 
        { CALL(proxy_deliver, (*p)); }
 
280
#line 281 "src/state.c"
 
281
        if ( (*p) == 104 )
 
282
                goto tr13;
 
283
        goto tr0;
 
284
tr13:
 
285
#line 60 "src/state.rl"
 
286
        { CALL(http_to_handler, (*p)); }
 
287
        goto st11;
 
288
tr14:
 
289
#line 61 "src/state.rl"
 
290
        { CALL(websocket_established, (*p)); }
283
291
        goto st11;
284
292
st11:
285
293
        if ( ++p == pe )
286
294
                goto _test_eof11;
287
295
case 11:
288
 
#line 289 "src/state.c"
 
296
#line 297 "src/state.c"
289
297
        switch( (*p) ) {
290
 
                case 109: goto tr15;
291
 
                case 111: goto tr16;
 
298
                case 100: goto tr1;
 
299
                case 111: goto tr14;
292
300
        }
293
301
        goto tr0;
294
 
tr14:
295
 
#line 66 "src/state.rl"
296
 
        { CALL(proxy_failed, (*p)); }
297
 
        goto st12;
298
 
tr15:
299
 
#line 71 "src/state.rl"
300
 
        { CALL(proxy_close, (*p)); }
301
 
        goto st12;
302
302
st12:
303
303
        if ( ++p == pe )
304
304
                goto _test_eof12;
305
305
case 12:
306
 
#line 307 "src/state.c"
307
 
        if ( (*p) == 100 )
308
 
                goto tr17;
309
 
        goto tr0;
310
 
tr17:
311
 
#line 75 "src/state.rl"
312
 
        {
313
 
        p--;
314
 
        {goto st5;} 
315
 
    }
316
 
        goto st13;
317
 
tr19:
318
 
#line 79 "src/state.rl"
319
 
        {
320
 
        CALL(proxy_close, (*p));
321
 
        p--;
322
 
        {goto st3;} 
323
 
    }
 
306
        switch( (*p) ) {
 
307
                case 101: goto tr15;
 
308
                case 103: goto tr17;
 
309
        }
 
310
        goto st0;
 
311
tr15:
 
312
#line 66 "src/state.rl"
 
313
        { CALL(proxy_deliver, (*p)); }
324
314
        goto st13;
325
315
st13:
326
316
        if ( ++p == pe )
327
317
                goto _test_eof13;
328
318
case 13:
329
 
#line 330 "src/state.c"
 
319
#line 320 "src/state.c"
 
320
        switch( (*p) ) {
 
321
                case 109: goto tr18;
 
322
                case 111: goto tr19;
 
323
        }
330
324
        goto tr0;
331
 
tr16:
332
 
#line 69 "src/state.rl"
333
 
        { CALL(proxy_reply_parse, (*p)); }
 
325
tr17:
 
326
#line 67 "src/state.rl"
 
327
        { CALL(proxy_failed, (*p)); }
 
328
        goto st14;
 
329
tr18:
 
330
#line 72 "src/state.rl"
 
331
        { CALL(proxy_close, (*p)); }
334
332
        goto st14;
335
333
st14:
336
334
        if ( ++p == pe )
337
335
                goto _test_eof14;
338
336
case 14:
339
 
#line 340 "src/state.c"
340
 
        switch( (*p) ) {
341
 
                case 109: goto tr15;
342
 
                case 110: goto tr18;
343
 
        }
 
337
#line 338 "src/state.c"
 
338
        if ( (*p) == 100 )
 
339
                goto tr20;
344
340
        goto tr0;
345
 
tr18:
346
 
#line 70 "src/state.rl"
347
 
        { CALL(proxy_req_parse, (*p)); }
 
341
tr20:
 
342
#line 76 "src/state.rl"
 
343
        {
 
344
        p--;
 
345
        {goto st5;} 
 
346
    }
 
347
        goto st15;
 
348
tr22:
 
349
#line 80 "src/state.rl"
 
350
        {
 
351
        CALL(proxy_close, (*p));
 
352
        p--;
 
353
        {goto st3;} 
 
354
    }
348
355
        goto st15;
349
356
st15:
350
357
        if ( ++p == pe )
351
358
                goto _test_eof15;
352
359
case 15:
353
 
#line 354 "src/state.c"
354
 
        switch( (*p) ) {
355
 
                case 102: goto tr19;
356
 
                case 104: goto tr19;
357
 
                case 105: goto tr12;
358
 
                case 108: goto tr19;
359
 
                case 109: goto tr15;
 
360
#line 361 "src/state.c"
 
361
        goto tr0;
 
362
tr19:
 
363
#line 70 "src/state.rl"
 
364
        { CALL(proxy_reply_parse, (*p)); }
 
365
        goto st16;
 
366
st16:
 
367
        if ( ++p == pe )
 
368
                goto _test_eof16;
 
369
case 16:
 
370
#line 371 "src/state.c"
 
371
        switch( (*p) ) {
 
372
                case 109: goto tr18;
 
373
                case 110: goto tr21;
 
374
        }
 
375
        goto tr0;
 
376
tr21:
 
377
#line 71 "src/state.rl"
 
378
        { CALL(proxy_req_parse, (*p)); }
 
379
        goto st17;
 
380
st17:
 
381
        if ( ++p == pe )
 
382
                goto _test_eof17;
 
383
case 17:
 
384
#line 385 "src/state.c"
 
385
        switch( (*p) ) {
 
386
                case 102: goto tr22;
 
387
                case 104: goto tr22;
 
388
                case 105: goto tr15;
 
389
                case 108: goto tr22;
 
390
                case 109: goto tr18;
360
391
        }
361
392
        goto tr0;
362
393
        }
363
394
        _test_eof1:  state->cs = 1; goto _test_eof; 
364
 
        _test_eof17:  state->cs = 17; goto _test_eof; 
 
395
        _test_eof19:  state->cs = 19; goto _test_eof; 
365
396
        _test_eof2:  state->cs = 2; goto _test_eof; 
366
397
        _test_eof3:  state->cs = 3; goto _test_eof; 
367
398
        _test_eof4:  state->cs = 4; goto _test_eof; 
376
407
        _test_eof13:  state->cs = 13; goto _test_eof; 
377
408
        _test_eof14:  state->cs = 14; goto _test_eof; 
378
409
        _test_eof15:  state->cs = 15; goto _test_eof; 
 
410
        _test_eof16:  state->cs = 16; goto _test_eof; 
 
411
        _test_eof17:  state->cs = 17; goto _test_eof; 
379
412
 
380
413
        _test_eof: {}
381
414
        if ( p == eof )
390
423
        case 7: 
391
424
        case 8: 
392
425
        case 9: 
 
426
        case 10: 
393
427
        case 11: 
394
 
        case 12: 
395
428
        case 13: 
396
429
        case 14: 
397
430
        case 15: 
 
431
        case 16: 
 
432
        case 17: 
398
433
#line 51 "src/state.rl"
399
434
        { CALL(error, (*p)); }
400
435
        break;
401
 
#line 402 "src/state.c"
 
436
#line 437 "src/state.c"
402
437
        }
403
438
        }
404
439
 
405
440
        _out: {}
406
441
        }
407
442
 
408
 
#line 122 "src/state.rl"
 
443
#line 123 "src/state.rl"
409
444
 
410
445
    return next;
411
446
}
427
462
    "REQ_SENT",
428
463
    "RESP_SENT",
429
464
    "SOCKET_REQ",
430
 
    "TIMEOUT"};
 
465
    "TIMEOUT",
 
466
    "WS_REQ"};
431
467
 
432
468
const char *State_event_name(int event)
433
469
{