-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathchunked_parser.c
1395 lines (1307 loc) · 29.2 KB
/
chunked_parser.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#line 1 "src/chunked_parser.rl"
/* Copyright (C) agentzh */
#ifndef DDEBUG
#define DDEBUG 0
#endif
#include "ddebug.h"
#include "chunked_parser.h"
#include "ngx_http_chunkin_util.h"
#define ngx_chunkin_min(x, y) ((x) < (y) ? (x) : (y))
enum {
PRE_TEXT_LEN = 25,
POST_TEXT_LEN = 25
};
#line 20 "src/chunked_parser.rl"
#line 25 "src/chunked_parser.c"
static const int chunked_start = 1;
static const int chunked_first_final = 43;
static const int chunked_error = 0;
static const int chunked_en_main = 1;
#line 21 "src/chunked_parser.rl"
ngx_int_t
ngx_http_chunkin_init_chunked_parser(ngx_http_request_t *r,
ngx_http_chunkin_ctx_t *ctx)
{
int cs;
#line 43 "src/chunked_parser.c"
{
cs = chunked_start;
}
#line 30 "src/chunked_parser.rl"
ctx->chunks = NULL;
ctx->next_chunk = NULL;
ctx->chunk = NULL;
ctx->chunk_size = 0;
ctx->chunk_size_order = 0;
ctx->chunk_bytes_read = 0;
ctx->chunks_total_size = 0;
ctx->parser_state = cs;
return NGX_OK;
}
ngx_int_t
ngx_http_chunkin_run_chunked_parser(ngx_http_request_t *r,
ngx_http_chunkin_ctx_t *ctx, u_char **pos_addr, u_char *last, char *caller_info)
{
int cs = ctx->parser_state;
ngx_connection_t *c = r->connection;
signed char *pos = (signed char *) *pos_addr;
signed char *p = (signed char *) *pos_addr;
signed char *pe = (signed char *) last;
signed char *eof = NULL;
ngx_buf_t *b;
ngx_flag_t done = 0;
ngx_str_t pre, post;
char* err_ctx = "";
ngx_str_t user_agent = ngx_null_string;
ssize_t rest;
#line 236 "src/chunked_parser.rl"
#line 87 "src/chunked_parser.c"
{
short _widec;
if ( p == pe )
goto _test_eof;
switch ( cs )
{
case 1:
if ( (*p) == 48 )
goto tr0;
if ( (*p) < 65 ) {
if ( 49 <= (*p) && (*p) <= 57 )
goto tr2;
} else if ( (*p) > 70 ) {
if ( 97 <= (*p) && (*p) <= 102 )
goto tr2;
} else
goto tr2;
goto st0;
tr3:
#line 227 "src/chunked_parser.rl"
{ err_ctx = "last_chunk"; }
goto st0;
tr9:
#line 168 "src/chunked_parser.rl"
{ err_ctx = "CRLF"; }
#line 227 "src/chunked_parser.rl"
{ err_ctx = "last_chunk"; }
goto st0;
tr11:
#line 168 "src/chunked_parser.rl"
{ err_ctx = "CRLF"; }
#line 227 "src/chunked_parser.rl"
{ err_ctx = "last_chunk"; }
#line 231 "src/chunked_parser.rl"
{ err_ctx = "parser"; }
goto st0;
tr13:
#line 168 "src/chunked_parser.rl"
{ err_ctx = "CRLF"; }
#line 231 "src/chunked_parser.rl"
{ err_ctx = "parser"; }
goto st0;
tr23:
#line 168 "src/chunked_parser.rl"
{ err_ctx = "CRLF"; }
goto st0;
tr29:
#line 218 "src/chunked_parser.rl"
{ err_ctx = "chunk_size"; }
#line 221 "src/chunked_parser.rl"
{ err_ctx = "chunk_ext"; }
goto st0;
tr33:
#line 168 "src/chunked_parser.rl"
{ err_ctx = "CRLF"; }
#line 221 "src/chunked_parser.rl"
{ err_ctx = "chunk_ext"; }
goto st0;
tr35:
#line 168 "src/chunked_parser.rl"
{ err_ctx = "CRLF"; }
#line 221 "src/chunked_parser.rl"
{ err_ctx = "chunk_ext"; }
#line 177 "src/chunked_parser.rl"
{ err_ctx = "chunk_data"; }
goto st0;
tr37:
#line 177 "src/chunked_parser.rl"
{ err_ctx = "chunk_data"; }
goto st0;
tr40:
#line 181 "src/chunked_parser.rl"
{ err_ctx = "chunk_data_terminator"; }
goto st0;
tr43:
#line 221 "src/chunked_parser.rl"
{ err_ctx = "chunk_ext"; }
goto st0;
#line 166 "src/chunked_parser.c"
st0:
cs = 0;
goto _out;
tr0:
#line 98 "src/chunked_parser.rl"
{
ctx->chunk_bytes_read = 0;
ctx->chunk_size = 0;
ctx->chunk_size_order = 0;
}
#line 104 "src/chunked_parser.rl"
{
ctx->chunk_size <<= 4;
ctx->chunk_size_order++;
if (*p >= 'A' && *p <= 'F') {
ctx->chunk_size |= 10 + *p - 'A';
} else if (*p >= 'a' && *p <= 'f') {
ctx->chunk_size |= 10 + *p - 'a';
} else {
ctx->chunk_size |= *p - '0';
}
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
"chunkin: chunk size: %uz\n", ctx->chunk_size);
}
goto st2;
tr6:
#line 104 "src/chunked_parser.rl"
{
ctx->chunk_size <<= 4;
ctx->chunk_size_order++;
if (*p >= 'A' && *p <= 'F') {
ctx->chunk_size |= 10 + *p - 'A';
} else if (*p >= 'a' && *p <= 'f') {
ctx->chunk_size |= 10 + *p - 'a';
} else {
ctx->chunk_size |= *p - '0';
}
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
"chunkin: chunk size: %uz\n", ctx->chunk_size);
}
goto st2;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
#line 214 "src/chunked_parser.c"
switch( (*p) ) {
case 9: goto st3;
case 13: goto st4;
case 32: goto st3;
case 48: goto tr6;
case 59: goto st7;
}
if ( (*p) < 65 ) {
if ( 49 <= (*p) && (*p) <= 57 )
goto tr7;
} else if ( (*p) > 70 ) {
if ( 97 <= (*p) && (*p) <= 102 )
goto tr7;
} else
goto tr7;
goto tr3;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
switch( (*p) ) {
case 9: goto st3;
case 13: goto st4;
case 32: goto st3;
case 59: goto st7;
}
goto tr3;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
if ( (*p) == 10 )
goto st5;
goto tr9;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
if ( (*p) == 13 )
goto st6;
goto tr11;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
if ( (*p) == 10 )
goto tr14;
goto tr13;
tr14:
#line 66 "src/chunked_parser.rl"
{
done = 1;
}
goto st43;
st43:
if ( ++p == pe )
goto _test_eof43;
case 43:
#line 273 "src/chunked_parser.c"
goto tr13;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
switch( (*p) ) {
case 9: goto st7;
case 32: goto st7;
case 34: goto st0;
case 44: goto st0;
case 47: goto st0;
case 123: goto st0;
case 125: goto st0;
case 127: goto st0;
}
if ( (*p) < 40 ) {
if ( 0 <= (*p) && (*p) <= 31 )
goto st0;
} else if ( (*p) > 41 ) {
if ( (*p) > 64 ) {
if ( 91 <= (*p) && (*p) <= 93 )
goto st0;
} else if ( (*p) >= 58 )
goto st0;
} else
goto st0;
goto st8;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
switch( (*p) ) {
case 9: goto st9;
case 13: goto st4;
case 32: goto st9;
case 34: goto tr3;
case 44: goto tr3;
case 47: goto tr3;
case 59: goto st7;
case 61: goto st10;
case 123: goto tr3;
case 125: goto tr3;
case 127: goto tr3;
}
if ( (*p) < 40 ) {
if ( 0 <= (*p) && (*p) <= 31 )
goto tr3;
} else if ( (*p) > 41 ) {
if ( (*p) > 64 ) {
if ( 91 <= (*p) && (*p) <= 93 )
goto tr3;
} else if ( (*p) >= 58 )
goto tr3;
} else
goto tr3;
goto st8;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
switch( (*p) ) {
case 9: goto st9;
case 13: goto st4;
case 32: goto st9;
case 59: goto st7;
case 61: goto st10;
}
goto tr3;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
switch( (*p) ) {
case 9: goto st10;
case 32: goto st10;
case 34: goto st12;
case 44: goto st0;
case 47: goto st0;
case 123: goto st0;
case 125: goto st0;
case 127: goto st0;
}
if ( (*p) < 40 ) {
if ( 0 <= (*p) && (*p) <= 31 )
goto st0;
} else if ( (*p) > 41 ) {
if ( (*p) > 64 ) {
if ( 91 <= (*p) && (*p) <= 93 )
goto st0;
} else if ( (*p) >= 58 )
goto st0;
} else
goto st0;
goto st11;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
switch( (*p) ) {
case 9: goto st3;
case 13: goto st4;
case 32: goto st3;
case 34: goto tr3;
case 44: goto tr3;
case 47: goto tr3;
case 59: goto st7;
case 123: goto tr3;
case 125: goto tr3;
case 127: goto tr3;
}
if ( (*p) < 40 ) {
if ( 0 <= (*p) && (*p) <= 31 )
goto tr3;
} else if ( (*p) > 41 ) {
if ( (*p) > 64 ) {
if ( 91 <= (*p) && (*p) <= 93 )
goto tr3;
} else if ( (*p) >= 58 )
goto tr3;
} else
goto tr3;
goto st11;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
switch( (*p) ) {
case 34: goto st3;
case 92: goto st13;
case 127: goto st0;
}
if ( (*p) > 8 ) {
if ( 10 <= (*p) && (*p) <= 31 )
goto st0;
} else if ( (*p) >= 0 )
goto st0;
goto st12;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
switch( (*p) ) {
case 13: goto st14;
case 34: goto st15;
case 92: goto st13;
}
goto st12;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
switch( (*p) ) {
case 34: goto st3;
case 92: goto st13;
case 127: goto tr23;
}
if ( (*p) > 8 ) {
if ( 10 <= (*p) && (*p) <= 31 )
goto tr23;
} else if ( (*p) >= 0 )
goto tr23;
goto st12;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
switch( (*p) ) {
case 9: goto st15;
case 13: goto st4;
case 32: goto st15;
case 34: goto st3;
case 59: goto st16;
case 92: goto st13;
case 127: goto tr3;
}
if ( 0 <= (*p) && (*p) <= 31 )
goto tr3;
goto st12;
st16:
if ( ++p == pe )
goto _test_eof16;
case 16:
switch( (*p) ) {
case 9: goto st16;
case 32: goto st16;
case 34: goto st3;
case 44: goto st12;
case 47: goto st12;
case 92: goto st13;
case 123: goto st12;
case 125: goto st12;
case 127: goto st0;
}
if ( (*p) < 40 ) {
if ( 0 <= (*p) && (*p) <= 31 )
goto st0;
} else if ( (*p) > 41 ) {
if ( (*p) > 64 ) {
if ( 91 <= (*p) && (*p) <= 93 )
goto st12;
} else if ( (*p) >= 58 )
goto st12;
} else
goto st12;
goto st17;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
switch( (*p) ) {
case 9: goto st18;
case 13: goto st4;
case 32: goto st18;
case 34: goto st3;
case 44: goto st12;
case 47: goto st12;
case 59: goto st16;
case 61: goto st19;
case 92: goto st13;
case 123: goto st12;
case 125: goto st12;
case 127: goto tr3;
}
if ( (*p) < 40 ) {
if ( 0 <= (*p) && (*p) <= 31 )
goto tr3;
} else if ( (*p) > 41 ) {
if ( (*p) > 64 ) {
if ( 91 <= (*p) && (*p) <= 93 )
goto st12;
} else if ( (*p) >= 58 )
goto st12;
} else
goto st12;
goto st17;
st18:
if ( ++p == pe )
goto _test_eof18;
case 18:
switch( (*p) ) {
case 9: goto st18;
case 13: goto st4;
case 32: goto st18;
case 34: goto st3;
case 59: goto st16;
case 61: goto st19;
case 92: goto st13;
case 127: goto tr3;
}
if ( 0 <= (*p) && (*p) <= 31 )
goto tr3;
goto st12;
st19:
if ( ++p == pe )
goto _test_eof19;
case 19:
switch( (*p) ) {
case 9: goto st19;
case 32: goto st19;
case 34: goto st15;
case 44: goto st12;
case 47: goto st12;
case 92: goto st13;
case 123: goto st12;
case 125: goto st12;
case 127: goto st0;
}
if ( (*p) < 40 ) {
if ( 0 <= (*p) && (*p) <= 31 )
goto st0;
} else if ( (*p) > 41 ) {
if ( (*p) > 64 ) {
if ( 91 <= (*p) && (*p) <= 93 )
goto st12;
} else if ( (*p) >= 58 )
goto st12;
} else
goto st12;
goto st20;
st20:
if ( ++p == pe )
goto _test_eof20;
case 20:
switch( (*p) ) {
case 9: goto st15;
case 13: goto st4;
case 32: goto st15;
case 34: goto st3;
case 44: goto st12;
case 47: goto st12;
case 59: goto st16;
case 92: goto st13;
case 123: goto st12;
case 125: goto st12;
case 127: goto tr3;
}
if ( (*p) < 40 ) {
if ( 0 <= (*p) && (*p) <= 31 )
goto tr3;
} else if ( (*p) > 41 ) {
if ( (*p) > 64 ) {
if ( 91 <= (*p) && (*p) <= 93 )
goto st12;
} else if ( (*p) >= 58 )
goto st12;
} else
goto st12;
goto st20;
tr2:
#line 98 "src/chunked_parser.rl"
{
ctx->chunk_bytes_read = 0;
ctx->chunk_size = 0;
ctx->chunk_size_order = 0;
}
#line 104 "src/chunked_parser.rl"
{
ctx->chunk_size <<= 4;
ctx->chunk_size_order++;
if (*p >= 'A' && *p <= 'F') {
ctx->chunk_size |= 10 + *p - 'A';
} else if (*p >= 'a' && *p <= 'f') {
ctx->chunk_size |= 10 + *p - 'a';
} else {
ctx->chunk_size |= *p - '0';
}
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
"chunkin: chunk size: %uz\n", ctx->chunk_size);
}
goto st21;
tr7:
#line 104 "src/chunked_parser.rl"
{
ctx->chunk_size <<= 4;
ctx->chunk_size_order++;
if (*p >= 'A' && *p <= 'F') {
ctx->chunk_size |= 10 + *p - 'A';
} else if (*p >= 'a' && *p <= 'f') {
ctx->chunk_size |= 10 + *p - 'a';
} else {
ctx->chunk_size |= *p - '0';
}
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
"chunkin: chunk size: %uz\n", ctx->chunk_size);
}
goto st21;
st21:
if ( ++p == pe )
goto _test_eof21;
case 21:
#line 626 "src/chunked_parser.c"
switch( (*p) ) {
case 9: goto st22;
case 13: goto st23;
case 32: goto st22;
case 59: goto st28;
}
if ( (*p) < 65 ) {
if ( 48 <= (*p) && (*p) <= 57 )
goto tr7;
} else if ( (*p) > 70 ) {
if ( 97 <= (*p) && (*p) <= 102 )
goto tr7;
} else
goto tr7;
goto tr29;
st22:
if ( ++p == pe )
goto _test_eof22;
case 22:
switch( (*p) ) {
case 9: goto st22;
case 13: goto st23;
case 32: goto st22;
case 59: goto st28;
}
goto tr29;
st23:
if ( ++p == pe )
goto _test_eof23;
case 23:
if ( (*p) == 10 )
goto st24;
goto tr33;
st24:
if ( ++p == pe )
goto _test_eof24;
case 24:
_widec = (*p);
_widec = (short)(128 + ((*p) - -128));
if (
#line 70 "src/chunked_parser.rl"
ctx->chunk_bytes_read < ctx->chunk_size
) _widec += 256;
if ( 384 <= _widec && _widec <= 639 )
goto tr36;
goto tr35;
tr36:
#line 119 "src/chunked_parser.rl"
{
ctx->chunk = ngx_http_chunkin_get_buf(r->pool, ctx);
ctx->chunks_count++;
if (ctx->chunks) {
*ctx->next_chunk = ctx->chunk;
} else {
ctx->chunks = ctx->chunk;
}
ctx->next_chunk = &ctx->chunk->next;
b = ctx->chunk->buf;
b->last = b->pos = (u_char *) p;
b->memory = 1;
}
#line 74 "src/chunked_parser.rl"
{
/* optimization for buffered chunk data */
rest = ngx_chunkin_min(
(ssize_t)ctx->chunk_size - (ssize_t)ctx->chunk_bytes_read,
(ssize_t)(pe - p));
dd("moving %d, chunk size %d, read %d, rest %d",
(int)rest,
(int)ctx->chunk_size,
(int)ctx->chunk_bytes_read,
(int)rest);
ctx->chunk_bytes_read += rest;
p += rest - 1;
ctx->chunk->buf->last = (u_char *)p + 1;
ctx->chunks_total_size += rest;
/* dd("bytes read: %d (char '%c', bytes read %d, chunk size %d)", ctx->chunk->buf->last - ctx->chunk->buf->pos, *p, ctx->chunk_bytes_read, ctx->chunk_size); */
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
"chunkin: data bytes read: %uz (char: \"%c\")\n",
ctx->chunk_bytes_read, *p);
}
goto st25;
tr39:
#line 74 "src/chunked_parser.rl"
{
/* optimization for buffered chunk data */
rest = ngx_chunkin_min(
(ssize_t)ctx->chunk_size - (ssize_t)ctx->chunk_bytes_read,
(ssize_t)(pe - p));
dd("moving %d, chunk size %d, read %d, rest %d",
(int)rest,
(int)ctx->chunk_size,
(int)ctx->chunk_bytes_read,
(int)rest);
ctx->chunk_bytes_read += rest;
p += rest - 1;
ctx->chunk->buf->last = (u_char *)p + 1;
ctx->chunks_total_size += rest;
/* dd("bytes read: %d (char '%c', bytes read %d, chunk size %d)", ctx->chunk->buf->last - ctx->chunk->buf->pos, *p, ctx->chunk_bytes_read, ctx->chunk_size); */
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
"chunkin: data bytes read: %uz (char: \"%c\")\n",
ctx->chunk_bytes_read, *p);
}
goto st25;
st25:
if ( ++p == pe )
goto _test_eof25;
case 25:
#line 749 "src/chunked_parser.c"
_widec = (*p);
if ( (*p) < 13 ) {
if ( (*p) <= 12 ) {
_widec = (short)(128 + ((*p) - -128));
if (
#line 70 "src/chunked_parser.rl"
ctx->chunk_bytes_read < ctx->chunk_size
) _widec += 256;
}
} else if ( (*p) > 13 ) {
if ( 14 <= (*p) )
{ _widec = (short)(128 + ((*p) - -128));
if (
#line 70 "src/chunked_parser.rl"
ctx->chunk_bytes_read < ctx->chunk_size
) _widec += 256;
}
} else {
_widec = (short)(128 + ((*p) - -128));
if (
#line 70 "src/chunked_parser.rl"
ctx->chunk_bytes_read < ctx->chunk_size
) _widec += 256;
}
if ( _widec == 269 )
goto st26;
if ( 384 <= _widec && _widec <= 639 )
goto tr39;
goto tr37;
st26:
if ( ++p == pe )
goto _test_eof26;
case 26:
if ( (*p) == 10 )
goto tr41;
goto tr40;
tr41:
#line 138 "src/chunked_parser.rl"
{
if (ctx->chunk_bytes_read != ctx->chunk_size) {
ngx_log_error(NGX_LOG_ERR, c->log, 0,
"ERROR: chunk size not met: "
"%uz != %uz\n", ctx->chunk_bytes_read,
ctx->chunk_size);
*pos_addr = (u_char*) p;
ctx->parser_state = chunked_error;
return NGX_ERROR;
}
if (ctx->chunk_size == 0) {
/* remove the current chunk */
ctx->chunk->next = ctx->free_bufs;
ctx->free_bufs = ctx->chunk;
ctx->chunk = ctx->last_complete_chunk;
if (ctx->last_complete_chunk) {
ctx->last_complete_chunk->next = NULL;
} else {
ctx->chunks = NULL;
}
} else {
ctx->last_complete_chunk = ctx->chunk;
}
}
goto st27;
st27:
if ( ++p == pe )
goto _test_eof27;
case 27:
#line 821 "src/chunked_parser.c"
if ( (*p) == 48 )
goto tr0;
if ( (*p) < 65 ) {
if ( 49 <= (*p) && (*p) <= 57 )
goto tr2;
} else if ( (*p) > 70 ) {
if ( 97 <= (*p) && (*p) <= 102 )
goto tr2;
} else
goto tr2;
goto tr40;
st28:
if ( ++p == pe )
goto _test_eof28;
case 28:
switch( (*p) ) {
case 9: goto st28;
case 32: goto st28;
case 34: goto st0;
case 44: goto st0;
case 47: goto st0;
case 123: goto st0;
case 125: goto st0;
case 127: goto st0;
}
if ( (*p) < 40 ) {
if ( 0 <= (*p) && (*p) <= 31 )
goto st0;
} else if ( (*p) > 41 ) {
if ( (*p) > 64 ) {
if ( 91 <= (*p) && (*p) <= 93 )
goto st0;
} else if ( (*p) >= 58 )
goto st0;
} else
goto st0;
goto st29;
st29:
if ( ++p == pe )
goto _test_eof29;
case 29:
switch( (*p) ) {
case 9: goto st30;
case 13: goto st23;
case 32: goto st30;
case 34: goto tr43;
case 44: goto tr43;
case 47: goto tr43;
case 59: goto st28;
case 61: goto st31;
case 123: goto tr43;
case 125: goto tr43;
case 127: goto tr43;
}
if ( (*p) < 40 ) {
if ( 0 <= (*p) && (*p) <= 31 )
goto tr43;
} else if ( (*p) > 41 ) {
if ( (*p) > 64 ) {
if ( 91 <= (*p) && (*p) <= 93 )
goto tr43;
} else if ( (*p) >= 58 )
goto tr43;
} else
goto tr43;
goto st29;
st30:
if ( ++p == pe )
goto _test_eof30;
case 30:
switch( (*p) ) {
case 9: goto st30;
case 13: goto st23;
case 32: goto st30;
case 59: goto st28;
case 61: goto st31;
}
goto tr43;
st31:
if ( ++p == pe )
goto _test_eof31;
case 31:
switch( (*p) ) {
case 9: goto st31;
case 32: goto st31;
case 34: goto st34;
case 44: goto st0;
case 47: goto st0;
case 123: goto st0;
case 125: goto st0;
case 127: goto st0;
}
if ( (*p) < 40 ) {
if ( 0 <= (*p) && (*p) <= 31 )
goto st0;
} else if ( (*p) > 41 ) {
if ( (*p) > 64 ) {
if ( 91 <= (*p) && (*p) <= 93 )
goto st0;
} else if ( (*p) >= 58 )
goto st0;
} else
goto st0;
goto st32;
st32:
if ( ++p == pe )
goto _test_eof32;
case 32:
switch( (*p) ) {
case 9: goto st33;
case 13: goto st23;
case 32: goto st33;
case 34: goto tr43;
case 44: goto tr43;
case 47: goto tr43;
case 59: goto st28;
case 123: goto tr43;
case 125: goto tr43;
case 127: goto tr43;
}
if ( (*p) < 40 ) {
if ( 0 <= (*p) && (*p) <= 31 )
goto tr43;
} else if ( (*p) > 41 ) {
if ( (*p) > 64 ) {
if ( 91 <= (*p) && (*p) <= 93 )
goto tr43;
} else if ( (*p) >= 58 )
goto tr43;
} else
goto tr43;
goto st32;
st33:
if ( ++p == pe )
goto _test_eof33;
case 33:
switch( (*p) ) {
case 9: goto st33;
case 13: goto st23;
case 32: goto st33;
case 59: goto st28;
}
goto tr43;
st34:
if ( ++p == pe )
goto _test_eof34;
case 34:
switch( (*p) ) {
case 34: goto st33;
case 92: goto st35;
case 127: goto st0;
}
if ( (*p) > 8 ) {
if ( 10 <= (*p) && (*p) <= 31 )
goto st0;
} else if ( (*p) >= 0 )
goto st0;
goto st34;
st35:
if ( ++p == pe )
goto _test_eof35;
case 35:
switch( (*p) ) {
case 13: goto st36;
case 34: goto st37;
case 92: goto st35;
}
goto st34;
st36:
if ( ++p == pe )
goto _test_eof36;
case 36:
switch( (*p) ) {
case 34: goto st33;
case 92: goto st35;
case 127: goto tr23;
}
if ( (*p) > 8 ) {
if ( 10 <= (*p) && (*p) <= 31 )
goto tr23;