unicorn 4.7.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +0 -1
- data/.gitattributes +5 -0
- data/.gitignore +2 -2
- data/.manifest +14 -21
- data/.olddoc.yml +22 -0
- data/Application_Timeouts +7 -7
- data/DESIGN +2 -4
- data/Documentation/.gitignore +1 -3
- data/Documentation/unicorn.1 +222 -0
- data/Documentation/unicorn_rails.1 +207 -0
- data/FAQ +23 -6
- data/GIT-VERSION-FILE +1 -1
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +139 -92
- data/HACKING +13 -28
- data/ISSUES +82 -19
- data/KNOWN_ISSUES +18 -18
- data/LATEST +22 -44
- data/LICENSE +2 -2
- data/Links +24 -22
- data/NEWS +729 -0
- data/PHILOSOPHY +0 -6
- data/README +50 -48
- data/Rakefile +0 -44
- data/SIGNALS +12 -3
- data/Sandbox +11 -10
- data/TODO +0 -2
- data/TUNING +30 -9
- data/archive/.gitignore +3 -0
- data/archive/slrnpull.conf +4 -0
- data/bin/unicorn +4 -2
- data/bin/unicorn_rails +3 -3
- data/examples/big_app_gc.rb +1 -1
- data/examples/init.sh +36 -8
- data/examples/logrotate.conf +17 -2
- data/examples/nginx.conf +14 -14
- data/examples/unicorn.conf.minimal.rb +2 -2
- data/examples/unicorn.conf.rb +14 -6
- data/examples/unicorn.socket +11 -0
- data/examples/unicorn@.service +40 -0
- data/ext/unicorn_http/common_field_optimization.h +23 -5
- data/ext/unicorn_http/ext_help.h +0 -20
- data/ext/unicorn_http/extconf.rb +37 -1
- data/ext/unicorn_http/global_variables.h +1 -1
- data/ext/unicorn_http/httpdate.c +2 -2
- data/ext/unicorn_http/unicorn_http.c +940 -644
- data/ext/unicorn_http/unicorn_http.rl +167 -170
- data/ext/unicorn_http/unicorn_http_common.rl +1 -1
- data/lib/unicorn/configurator.rb +110 -46
- data/lib/unicorn/const.rb +2 -25
- data/lib/unicorn/http_request.rb +110 -31
- data/lib/unicorn/http_response.rb +17 -31
- data/lib/unicorn/http_server.rb +292 -199
- data/lib/unicorn/launcher.rb +1 -1
- data/lib/unicorn/oob_gc.rb +16 -6
- data/lib/unicorn/socket_helper.rb +58 -78
- data/lib/unicorn/stream_input.rb +9 -11
- data/lib/unicorn/tee_input.rb +16 -11
- data/lib/unicorn/tmpio.rb +10 -6
- data/lib/unicorn/util.rb +5 -4
- data/lib/unicorn/version.rb +1 -1
- data/lib/unicorn/worker.rb +99 -22
- data/lib/unicorn.rb +69 -42
- data/man/man1/unicorn.1 +124 -122
- data/man/man1/unicorn_rails.1 +113 -127
- data/t/.gitignore +0 -1
- data/t/GNUmakefile +3 -80
- data/t/README +4 -4
- data/t/t0002-parser-error.sh +3 -3
- data/t/t0011-active-unix-socket.sh +1 -1
- data/t/t0012-reload-empty-config.sh +2 -1
- data/t/t0300-no-default-middleware.sh +6 -1
- data/t/t0301-no-default-middleware-ignored-in-config.sh +25 -0
- data/t/t0301.ru +13 -0
- data/t/test-lib.sh +2 -2
- data/test/benchmark/README +14 -4
- data/test/benchmark/ddstream.ru +50 -0
- data/test/benchmark/readinput.ru +40 -0
- data/test/benchmark/uconnect.perl +66 -0
- data/test/exec/test_exec.rb +74 -20
- data/test/test_helper.rb +42 -33
- data/test/unit/test_ccc.rb +91 -0
- data/test/unit/test_droplet.rb +1 -1
- data/test/unit/test_http_parser.rb +49 -19
- data/test/unit/test_http_parser_ng.rb +98 -115
- data/test/unit/test_request.rb +11 -11
- data/test/unit/test_response.rb +31 -19
- data/test/unit/test_server.rb +89 -15
- data/test/unit/test_signals.rb +9 -9
- data/test/unit/test_socket_helper.rb +20 -14
- data/test/unit/test_tee_input.rb +10 -0
- data/test/unit/test_upload.rb +10 -15
- data/test/unit/test_util.rb +28 -3
- data/unicorn.gemspec +28 -23
- data/unicorn_1 +1 -0
- data/unicorn_rails_1 +1 -0
- metadata +64 -134
- data/.wrongdoc.yml +0 -10
- data/ChangeLog +0 -4694
- data/Documentation/GNUmakefile +0 -30
- data/Documentation/unicorn.1.txt +0 -178
- data/Documentation/unicorn_rails.1.txt +0 -175
- data/examples/git.ru +0 -13
- data/lib/unicorn/app/exec_cgi.rb +0 -154
- data/lib/unicorn/app/inetd.rb +0 -109
- data/lib/unicorn/ssl_client.rb +0 -11
- data/lib/unicorn/ssl_configurator.rb +0 -104
- data/lib/unicorn/ssl_server.rb +0 -42
- data/local.mk.sample +0 -59
- data/script/isolate_for_tests +0 -32
- data/t/hijack.ru +0 -42
- data/t/sslgen.sh +0 -71
- data/t/t0016-trust-x-forwarded-false.sh +0 -30
- data/t/t0017-trust-x-forwarded-true.sh +0 -30
- data/t/t0200-rack-hijack.sh +0 -27
- data/t/t0600-https-server-basic.sh +0 -48
- data/test/unit/test_http_parser_xftrust.rb +0 -38
- data/test/unit/test_sni_hostnames.rb +0 -47
@@ -27,86 +27,33 @@ void init_unicorn_httpdate(void);
|
|
27
27
|
#define UH_FL_KAVERSION 0x80
|
28
28
|
#define UH_FL_HASHEADER 0x100
|
29
29
|
#define UH_FL_TO_CLEAR 0x200
|
30
|
+
#define UH_FL_RESSTART 0x400 /* for check_client_connection */
|
31
|
+
#define UH_FL_HIJACK 0x800
|
30
32
|
|
31
33
|
/* all of these flags need to be set for keepalive to be supported */
|
32
34
|
#define UH_FL_KEEPALIVE (UH_FL_KAVERSION | UH_FL_REQEOF | UH_FL_HASHEADER)
|
33
35
|
|
34
|
-
/*
|
35
|
-
* whether or not to trust X-Forwarded-Proto and X-Forwarded-SSL when
|
36
|
-
* setting rack.url_scheme
|
37
|
-
*/
|
38
|
-
static VALUE trust_x_forward = Qtrue;
|
39
|
-
|
40
|
-
static unsigned long keepalive_requests = 100; /* same as nginx */
|
41
|
-
|
42
|
-
/*
|
43
|
-
* Returns the maximum number of keepalive requests a client may make
|
44
|
-
* before the parser refuses to continue.
|
45
|
-
*/
|
46
|
-
static VALUE ka_req(VALUE self)
|
47
|
-
{
|
48
|
-
return ULONG2NUM(keepalive_requests);
|
49
|
-
}
|
50
|
-
|
51
|
-
/*
|
52
|
-
* Sets the maximum number of keepalive requests a client may make.
|
53
|
-
* A special value of +nil+ causes this to be the maximum value
|
54
|
-
* possible (this is architecture-dependent).
|
55
|
-
*/
|
56
|
-
static VALUE set_ka_req(VALUE self, VALUE val)
|
57
|
-
{
|
58
|
-
keepalive_requests = NIL_P(val) ? ULONG_MAX : NUM2ULONG(val);
|
59
|
-
|
60
|
-
return ka_req(self);
|
61
|
-
}
|
62
|
-
|
63
|
-
/*
|
64
|
-
* Sets whether or not the parser will trust X-Forwarded-Proto and
|
65
|
-
* X-Forwarded-SSL headers and set "rack.url_scheme" to "https" accordingly.
|
66
|
-
* Rainbows!/Zbatery installations facing untrusted clients directly
|
67
|
-
* should set this to +false+
|
68
|
-
*/
|
69
|
-
static VALUE set_xftrust(VALUE self, VALUE val)
|
70
|
-
{
|
71
|
-
if (Qtrue == val || Qfalse == val)
|
72
|
-
trust_x_forward = val;
|
73
|
-
else
|
74
|
-
rb_raise(rb_eTypeError, "must be true or false");
|
75
|
-
|
76
|
-
return val;
|
77
|
-
}
|
78
|
-
|
79
|
-
/*
|
80
|
-
* returns whether or not the parser will trust X-Forwarded-Proto and
|
81
|
-
* X-Forwarded-SSL headers and set "rack.url_scheme" to "https" accordingly
|
82
|
-
*/
|
83
|
-
static VALUE xftrust(VALUE self)
|
84
|
-
{
|
85
|
-
return trust_x_forward;
|
86
|
-
}
|
87
|
-
|
88
|
-
static size_t MAX_HEADER_LEN = 1024 * (80 + 32); /* same as Mongrel */
|
36
|
+
static unsigned int MAX_HEADER_LEN = 1024 * (80 + 32); /* same as Mongrel */
|
89
37
|
|
90
38
|
/* this is only intended for use with Rainbows! */
|
91
39
|
static VALUE set_maxhdrlen(VALUE self, VALUE len)
|
92
40
|
{
|
93
|
-
return
|
41
|
+
return UINT2NUM(MAX_HEADER_LEN = NUM2UINT(len));
|
94
42
|
}
|
95
43
|
|
96
|
-
/* keep this small for
|
44
|
+
/* keep this small for other servers (e.g. yahns) since every client has one */
|
97
45
|
struct http_parser {
|
98
46
|
int cs; /* Ragel internal state */
|
99
47
|
unsigned int flags;
|
100
|
-
unsigned
|
101
|
-
|
102
|
-
size_t offset;
|
48
|
+
unsigned int mark;
|
49
|
+
unsigned int offset;
|
103
50
|
union { /* these 2 fields don't nest */
|
104
|
-
|
105
|
-
|
51
|
+
unsigned int field;
|
52
|
+
unsigned int query;
|
106
53
|
} start;
|
107
54
|
union {
|
108
|
-
|
109
|
-
|
55
|
+
unsigned int field_len; /* only used during header processing */
|
56
|
+
unsigned int dest_offset; /* only used during body processing */
|
110
57
|
} s;
|
111
58
|
VALUE buf;
|
112
59
|
VALUE env;
|
@@ -117,7 +64,20 @@ struct http_parser {
|
|
117
64
|
} len;
|
118
65
|
};
|
119
66
|
|
120
|
-
static ID
|
67
|
+
static ID id_set_backtrace, id_is_chunked_p;
|
68
|
+
static VALUE cHttpParser;
|
69
|
+
|
70
|
+
#ifdef HAVE_RB_HASH_CLEAR /* Ruby >= 2.0 */
|
71
|
+
# define my_hash_clear(h) (void)rb_hash_clear(h)
|
72
|
+
#else /* !HAVE_RB_HASH_CLEAR - Ruby <= 1.9.3 */
|
73
|
+
|
74
|
+
static ID id_clear;
|
75
|
+
|
76
|
+
static void my_hash_clear(VALUE h)
|
77
|
+
{
|
78
|
+
rb_funcall(h, id_clear, 0);
|
79
|
+
}
|
80
|
+
#endif /* HAVE_RB_HASH_CLEAR */
|
121
81
|
|
122
82
|
static void finalize_header(struct http_parser *hp);
|
123
83
|
|
@@ -126,13 +86,25 @@ static void parser_raise(VALUE klass, const char *msg)
|
|
126
86
|
VALUE exc = rb_exc_new2(klass, msg);
|
127
87
|
VALUE bt = rb_ary_new();
|
128
88
|
|
129
|
-
|
130
|
-
|
89
|
+
rb_funcall(exc, id_set_backtrace, 1, bt);
|
90
|
+
rb_exc_raise(exc);
|
91
|
+
}
|
92
|
+
|
93
|
+
static inline unsigned int ulong2uint(unsigned long n)
|
94
|
+
{
|
95
|
+
unsigned int i = (unsigned int)n;
|
96
|
+
|
97
|
+
if (sizeof(unsigned int) != sizeof(unsigned long)) {
|
98
|
+
if ((unsigned long)i != n) {
|
99
|
+
rb_raise(rb_eRangeError, "too large to be 32-bit uint: %lu", n);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
return i;
|
131
103
|
}
|
132
104
|
|
133
105
|
#define REMAINING (unsigned long)(pe - p)
|
134
|
-
#define LEN(AT, FPC) (FPC - buffer - hp->AT)
|
135
|
-
#define MARK(M,FPC) (hp->M = (FPC) - buffer)
|
106
|
+
#define LEN(AT, FPC) (ulong2uint(FPC - buffer) - hp->AT)
|
107
|
+
#define MARK(M,FPC) (hp->M = ulong2uint((FPC) - buffer))
|
136
108
|
#define PTR_TO(F) (buffer + hp->F)
|
137
109
|
#define STR_NEW(M,FPC) rb_str_new(PTR_TO(M), LEN(M, FPC))
|
138
110
|
#define STRIPPED_STR_NEW(M,FPC) stripped_str_new(PTR_TO(M), LEN(M, FPC))
|
@@ -251,6 +223,19 @@ static void write_cont_value(struct http_parser *hp,
|
|
251
223
|
rb_str_buf_cat(hp->cont, vptr, end + 1);
|
252
224
|
}
|
253
225
|
|
226
|
+
static int is_chunked(VALUE v)
|
227
|
+
{
|
228
|
+
/* common case first */
|
229
|
+
if (STR_CSTR_CASE_EQ(v, "chunked"))
|
230
|
+
return 1;
|
231
|
+
|
232
|
+
/*
|
233
|
+
* call Ruby function in unicorn/http_request.rb to deal with unlikely
|
234
|
+
* comma-delimited case
|
235
|
+
*/
|
236
|
+
return rb_funcall(cHttpParser, id_is_chunked_p, 1, v) != Qfalse;
|
237
|
+
}
|
238
|
+
|
254
239
|
static void write_value(struct http_parser *hp,
|
255
240
|
const char *buffer, const char *p)
|
256
241
|
{
|
@@ -277,7 +262,9 @@ static void write_value(struct http_parser *hp,
|
|
277
262
|
f = uncommon_field(field, flen);
|
278
263
|
} else if (f == g_http_connection) {
|
279
264
|
hp_keepalive_connection(hp, v);
|
280
|
-
} else if (f == g_content_length) {
|
265
|
+
} else if (f == g_content_length && !HP_FL_TEST(hp, CHUNKED)) {
|
266
|
+
if (hp->len.content)
|
267
|
+
parser_raise(eHttpParserError, "Content-Length already set");
|
281
268
|
hp->len.content = parse_length(RSTRING_PTR(v), RSTRING_LEN(v));
|
282
269
|
if (hp->len.content < 0)
|
283
270
|
parser_raise(eHttpParserError, "invalid Content-Length");
|
@@ -285,9 +272,30 @@ static void write_value(struct http_parser *hp,
|
|
285
272
|
HP_FL_SET(hp, HASBODY);
|
286
273
|
hp_invalid_if_trailer(hp);
|
287
274
|
} else if (f == g_http_transfer_encoding) {
|
288
|
-
if (
|
275
|
+
if (is_chunked(v)) {
|
276
|
+
if (HP_FL_TEST(hp, CHUNKED))
|
277
|
+
/*
|
278
|
+
* RFC 7230 3.3.1:
|
279
|
+
* A sender MUST NOT apply chunked more than once to a message body
|
280
|
+
* (i.e., chunking an already chunked message is not allowed).
|
281
|
+
*/
|
282
|
+
parser_raise(eHttpParserError, "Transfer-Encoding double chunked");
|
283
|
+
|
289
284
|
HP_FL_SET(hp, CHUNKED);
|
290
285
|
HP_FL_SET(hp, HASBODY);
|
286
|
+
|
287
|
+
/* RFC 7230 3.3.3, 3: favor chunked if Content-Length exists */
|
288
|
+
hp->len.content = 0;
|
289
|
+
} else if (HP_FL_TEST(hp, CHUNKED)) {
|
290
|
+
/*
|
291
|
+
* RFC 7230 3.3.3, point 3 states:
|
292
|
+
* If a Transfer-Encoding header field is present in a request and
|
293
|
+
* the chunked transfer coding is not the final encoding, the
|
294
|
+
* message body length cannot be determined reliably; the server
|
295
|
+
* MUST respond with the 400 (Bad Request) status code and then
|
296
|
+
* close the connection.
|
297
|
+
*/
|
298
|
+
parser_raise(eHttpParserError, "invalid Transfer-Encoding");
|
291
299
|
}
|
292
300
|
hp_invalid_if_trailer(hp);
|
293
301
|
} else if (f == g_http_trailer) {
|
@@ -316,23 +324,23 @@ static void write_value(struct http_parser *hp,
|
|
316
324
|
/** Machine **/
|
317
325
|
|
318
326
|
|
319
|
-
#line
|
327
|
+
#line 431 "unicorn_http.rl"
|
320
328
|
|
321
329
|
|
322
330
|
/** Data **/
|
323
331
|
|
324
|
-
#line
|
332
|
+
#line 333 "unicorn_http.c"
|
325
333
|
static const int http_parser_start = 1;
|
326
334
|
static const int http_parser_first_final = 122;
|
327
335
|
static const int http_parser_error = 0;
|
328
336
|
|
329
337
|
static const int http_parser_en_ChunkedBody = 100;
|
330
|
-
static const int http_parser_en_ChunkedBody_chunk_chunk_end =
|
338
|
+
static const int http_parser_en_ChunkedBody_chunk_chunk_end = 105;
|
331
339
|
static const int http_parser_en_Trailers = 114;
|
332
340
|
static const int http_parser_en_main = 1;
|
333
341
|
|
334
342
|
|
335
|
-
#line
|
343
|
+
#line 435 "unicorn_http.rl"
|
336
344
|
|
337
345
|
static void http_parser_init(struct http_parser *hp)
|
338
346
|
{
|
@@ -345,12 +353,12 @@ static void http_parser_init(struct http_parser *hp)
|
|
345
353
|
hp->len.content = 0;
|
346
354
|
hp->cont = Qfalse; /* zero on MRI, should be optimized away by above */
|
347
355
|
|
348
|
-
#line
|
356
|
+
#line 357 "unicorn_http.c"
|
349
357
|
{
|
350
358
|
cs = http_parser_start;
|
351
359
|
}
|
352
360
|
|
353
|
-
#line
|
361
|
+
#line 447 "unicorn_http.rl"
|
354
362
|
hp->cs = cs;
|
355
363
|
}
|
356
364
|
|
@@ -378,7 +386,7 @@ http_parser_execute(struct http_parser *hp, char *buffer, size_t len)
|
|
378
386
|
goto skip_chunk_data_hack;
|
379
387
|
}
|
380
388
|
|
381
|
-
#line
|
389
|
+
#line 390 "unicorn_http.c"
|
382
390
|
{
|
383
391
|
if ( p == pe )
|
384
392
|
goto _test_eof;
|
@@ -413,14 +421,14 @@ st0:
|
|
413
421
|
cs = 0;
|
414
422
|
goto _out;
|
415
423
|
tr0:
|
416
|
-
#line
|
424
|
+
#line 327 "unicorn_http.rl"
|
417
425
|
{MARK(mark, p); }
|
418
426
|
goto st2;
|
419
427
|
st2:
|
420
428
|
if ( ++p == pe )
|
421
429
|
goto _test_eof2;
|
422
430
|
case 2:
|
423
|
-
#line
|
431
|
+
#line 432 "unicorn_http.c"
|
424
432
|
switch( (*p) ) {
|
425
433
|
case 32: goto tr3;
|
426
434
|
case 33: goto st49;
|
@@ -446,14 +454,14 @@ case 2:
|
|
446
454
|
goto st49;
|
447
455
|
goto st0;
|
448
456
|
tr3:
|
449
|
-
#line
|
457
|
+
#line 336 "unicorn_http.rl"
|
450
458
|
{ request_method(hp, PTR_TO(mark), LEN(mark, p)); }
|
451
459
|
goto st3;
|
452
460
|
st3:
|
453
461
|
if ( ++p == pe )
|
454
462
|
goto _test_eof3;
|
455
463
|
case 3:
|
456
|
-
#line
|
464
|
+
#line 465 "unicorn_http.c"
|
457
465
|
switch( (*p) ) {
|
458
466
|
case 42: goto tr5;
|
459
467
|
case 47: goto tr6;
|
@@ -462,21 +470,21 @@ case 3:
|
|
462
470
|
}
|
463
471
|
goto st0;
|
464
472
|
tr5:
|
465
|
-
#line
|
473
|
+
#line 327 "unicorn_http.rl"
|
466
474
|
{MARK(mark, p); }
|
467
475
|
goto st4;
|
468
476
|
st4:
|
469
477
|
if ( ++p == pe )
|
470
478
|
goto _test_eof4;
|
471
479
|
case 4:
|
472
|
-
#line
|
480
|
+
#line 481 "unicorn_http.c"
|
473
481
|
switch( (*p) ) {
|
474
482
|
case 32: goto tr8;
|
475
483
|
case 35: goto tr9;
|
476
484
|
}
|
477
485
|
goto st0;
|
478
486
|
tr8:
|
479
|
-
#line
|
487
|
+
#line 341 "unicorn_http.rl"
|
480
488
|
{
|
481
489
|
VALUE str;
|
482
490
|
|
@@ -493,24 +501,24 @@ tr8:
|
|
493
501
|
}
|
494
502
|
}
|
495
503
|
goto st5;
|
496
|
-
|
497
|
-
#line
|
504
|
+
tr42:
|
505
|
+
#line 327 "unicorn_http.rl"
|
498
506
|
{MARK(mark, p); }
|
499
|
-
#line
|
507
|
+
#line 356 "unicorn_http.rl"
|
500
508
|
{
|
501
509
|
VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
|
502
510
|
rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
|
503
511
|
}
|
504
512
|
goto st5;
|
505
|
-
|
506
|
-
#line
|
513
|
+
tr45:
|
514
|
+
#line 356 "unicorn_http.rl"
|
507
515
|
{
|
508
516
|
VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
|
509
517
|
rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
|
510
518
|
}
|
511
519
|
goto st5;
|
512
|
-
|
513
|
-
#line
|
520
|
+
tr49:
|
521
|
+
#line 366 "unicorn_http.rl"
|
514
522
|
{
|
515
523
|
VALUE val;
|
516
524
|
|
@@ -521,7 +529,7 @@ tr44:
|
|
521
529
|
if (!STR_CSTR_EQ(val, "*"))
|
522
530
|
rb_hash_aset(hp->env, g_path_info, val);
|
523
531
|
}
|
524
|
-
#line
|
532
|
+
#line 341 "unicorn_http.rl"
|
525
533
|
{
|
526
534
|
VALUE str;
|
527
535
|
|
@@ -538,15 +546,15 @@ tr44:
|
|
538
546
|
}
|
539
547
|
}
|
540
548
|
goto st5;
|
541
|
-
|
542
|
-
#line
|
549
|
+
tr55:
|
550
|
+
#line 360 "unicorn_http.rl"
|
543
551
|
{MARK(start.query, p); }
|
544
|
-
#line
|
552
|
+
#line 361 "unicorn_http.rl"
|
545
553
|
{
|
546
554
|
VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
|
547
555
|
rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
|
548
556
|
}
|
549
|
-
#line
|
557
|
+
#line 341 "unicorn_http.rl"
|
550
558
|
{
|
551
559
|
VALUE str;
|
552
560
|
|
@@ -563,13 +571,13 @@ tr50:
|
|
563
571
|
}
|
564
572
|
}
|
565
573
|
goto st5;
|
566
|
-
|
567
|
-
#line
|
574
|
+
tr59:
|
575
|
+
#line 361 "unicorn_http.rl"
|
568
576
|
{
|
569
577
|
VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
|
570
578
|
rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
|
571
579
|
}
|
572
|
-
#line
|
580
|
+
#line 341 "unicorn_http.rl"
|
573
581
|
{
|
574
582
|
VALUE str;
|
575
583
|
|
@@ -590,19 +598,19 @@ st5:
|
|
590
598
|
if ( ++p == pe )
|
591
599
|
goto _test_eof5;
|
592
600
|
case 5:
|
593
|
-
#line
|
601
|
+
#line 602 "unicorn_http.c"
|
594
602
|
if ( (*p) == 72 )
|
595
603
|
goto tr10;
|
596
604
|
goto st0;
|
597
605
|
tr10:
|
598
|
-
#line
|
606
|
+
#line 327 "unicorn_http.rl"
|
599
607
|
{MARK(mark, p); }
|
600
608
|
goto st6;
|
601
609
|
st6:
|
602
610
|
if ( ++p == pe )
|
603
611
|
goto _test_eof6;
|
604
612
|
case 6:
|
605
|
-
#line
|
613
|
+
#line 614 "unicorn_http.c"
|
606
614
|
if ( (*p) == 84 )
|
607
615
|
goto st7;
|
608
616
|
goto st0;
|
@@ -654,112 +662,163 @@ st13:
|
|
654
662
|
if ( ++p == pe )
|
655
663
|
goto _test_eof13;
|
656
664
|
case 13:
|
657
|
-
|
658
|
-
goto tr18;
|
665
|
+
switch( (*p) ) {
|
666
|
+
case 10: goto tr18;
|
667
|
+
case 13: goto tr19;
|
668
|
+
}
|
659
669
|
if ( 48 <= (*p) && (*p) <= 57 )
|
660
670
|
goto st13;
|
661
671
|
goto st0;
|
662
672
|
tr18:
|
663
|
-
#line
|
673
|
+
#line 365 "unicorn_http.rl"
|
664
674
|
{ http_version(hp, PTR_TO(mark), LEN(mark, p)); }
|
665
675
|
goto st14;
|
666
|
-
|
667
|
-
#line
|
676
|
+
tr26:
|
677
|
+
#line 333 "unicorn_http.rl"
|
668
678
|
{ MARK(mark, p); }
|
669
|
-
#line
|
679
|
+
#line 335 "unicorn_http.rl"
|
670
680
|
{ write_cont_value(hp, buffer, p); }
|
671
681
|
goto st14;
|
672
|
-
|
673
|
-
#line
|
682
|
+
tr29:
|
683
|
+
#line 335 "unicorn_http.rl"
|
674
684
|
{ write_cont_value(hp, buffer, p); }
|
675
685
|
goto st14;
|
676
|
-
|
677
|
-
#line
|
686
|
+
tr36:
|
687
|
+
#line 333 "unicorn_http.rl"
|
678
688
|
{ MARK(mark, p); }
|
679
|
-
#line
|
689
|
+
#line 334 "unicorn_http.rl"
|
680
690
|
{ write_value(hp, buffer, p); }
|
681
691
|
goto st14;
|
682
|
-
|
683
|
-
#line
|
692
|
+
tr39:
|
693
|
+
#line 334 "unicorn_http.rl"
|
684
694
|
{ write_value(hp, buffer, p); }
|
685
695
|
goto st14;
|
686
696
|
st14:
|
687
697
|
if ( ++p == pe )
|
688
698
|
goto _test_eof14;
|
689
699
|
case 14:
|
690
|
-
#line
|
691
|
-
if ( (*p) == 10 )
|
692
|
-
goto st15;
|
693
|
-
goto st0;
|
694
|
-
st15:
|
695
|
-
if ( ++p == pe )
|
696
|
-
goto _test_eof15;
|
697
|
-
case 15:
|
700
|
+
#line 701 "unicorn_http.c"
|
698
701
|
switch( (*p) ) {
|
699
|
-
case 9: goto
|
702
|
+
case 9: goto st15;
|
703
|
+
case 10: goto tr21;
|
700
704
|
case 13: goto st18;
|
701
|
-
case 32: goto
|
702
|
-
case 33: goto
|
703
|
-
case 124: goto
|
704
|
-
case 126: goto
|
705
|
+
case 32: goto st15;
|
706
|
+
case 33: goto tr23;
|
707
|
+
case 124: goto tr23;
|
708
|
+
case 126: goto tr23;
|
705
709
|
}
|
706
710
|
if ( (*p) < 45 ) {
|
707
711
|
if ( (*p) > 39 ) {
|
708
712
|
if ( 42 <= (*p) && (*p) <= 43 )
|
709
|
-
goto
|
713
|
+
goto tr23;
|
710
714
|
} else if ( (*p) >= 35 )
|
711
|
-
goto
|
715
|
+
goto tr23;
|
712
716
|
} else if ( (*p) > 46 ) {
|
713
717
|
if ( (*p) < 65 ) {
|
714
718
|
if ( 48 <= (*p) && (*p) <= 57 )
|
715
|
-
goto
|
719
|
+
goto tr23;
|
716
720
|
} else if ( (*p) > 90 ) {
|
717
721
|
if ( 94 <= (*p) && (*p) <= 122 )
|
718
|
-
goto
|
722
|
+
goto tr23;
|
719
723
|
} else
|
720
|
-
goto
|
724
|
+
goto tr23;
|
721
725
|
} else
|
722
|
-
goto
|
726
|
+
goto tr23;
|
723
727
|
goto st0;
|
724
|
-
|
725
|
-
#line
|
728
|
+
tr25:
|
729
|
+
#line 333 "unicorn_http.rl"
|
726
730
|
{ MARK(mark, p); }
|
727
|
-
goto
|
728
|
-
|
731
|
+
goto st15;
|
732
|
+
st15:
|
729
733
|
if ( ++p == pe )
|
730
|
-
goto
|
731
|
-
case
|
732
|
-
#line
|
734
|
+
goto _test_eof15;
|
735
|
+
case 15:
|
736
|
+
#line 737 "unicorn_http.c"
|
733
737
|
switch( (*p) ) {
|
734
|
-
case 9: goto
|
735
|
-
case
|
736
|
-
case
|
738
|
+
case 9: goto tr25;
|
739
|
+
case 10: goto tr26;
|
740
|
+
case 13: goto tr27;
|
741
|
+
case 32: goto tr25;
|
737
742
|
case 127: goto st0;
|
738
743
|
}
|
739
744
|
if ( 0 <= (*p) && (*p) <= 31 )
|
740
745
|
goto st0;
|
741
|
-
goto
|
742
|
-
|
743
|
-
#line
|
746
|
+
goto tr24;
|
747
|
+
tr24:
|
748
|
+
#line 333 "unicorn_http.rl"
|
744
749
|
{ MARK(mark, p); }
|
745
|
-
goto
|
746
|
-
|
750
|
+
goto st16;
|
751
|
+
st16:
|
747
752
|
if ( ++p == pe )
|
748
|
-
goto
|
749
|
-
case
|
750
|
-
#line
|
753
|
+
goto _test_eof16;
|
754
|
+
case 16:
|
755
|
+
#line 756 "unicorn_http.c"
|
751
756
|
switch( (*p) ) {
|
752
|
-
case
|
757
|
+
case 10: goto tr29;
|
758
|
+
case 13: goto tr30;
|
753
759
|
case 127: goto st0;
|
754
760
|
}
|
755
761
|
if ( (*p) > 8 ) {
|
756
|
-
if (
|
762
|
+
if ( 11 <= (*p) && (*p) <= 31 )
|
757
763
|
goto st0;
|
758
764
|
} else if ( (*p) >= 0 )
|
759
765
|
goto st0;
|
766
|
+
goto st16;
|
767
|
+
tr19:
|
768
|
+
#line 365 "unicorn_http.rl"
|
769
|
+
{ http_version(hp, PTR_TO(mark), LEN(mark, p)); }
|
770
|
+
goto st17;
|
771
|
+
tr27:
|
772
|
+
#line 333 "unicorn_http.rl"
|
773
|
+
{ MARK(mark, p); }
|
774
|
+
#line 335 "unicorn_http.rl"
|
775
|
+
{ write_cont_value(hp, buffer, p); }
|
776
|
+
goto st17;
|
777
|
+
tr30:
|
778
|
+
#line 335 "unicorn_http.rl"
|
779
|
+
{ write_cont_value(hp, buffer, p); }
|
760
780
|
goto st17;
|
761
|
-
|
781
|
+
tr37:
|
762
782
|
#line 333 "unicorn_http.rl"
|
783
|
+
{ MARK(mark, p); }
|
784
|
+
#line 334 "unicorn_http.rl"
|
785
|
+
{ write_value(hp, buffer, p); }
|
786
|
+
goto st17;
|
787
|
+
tr40:
|
788
|
+
#line 334 "unicorn_http.rl"
|
789
|
+
{ write_value(hp, buffer, p); }
|
790
|
+
goto st17;
|
791
|
+
st17:
|
792
|
+
if ( ++p == pe )
|
793
|
+
goto _test_eof17;
|
794
|
+
case 17:
|
795
|
+
#line 796 "unicorn_http.c"
|
796
|
+
if ( (*p) == 10 )
|
797
|
+
goto st14;
|
798
|
+
goto st0;
|
799
|
+
tr21:
|
800
|
+
#line 381 "unicorn_http.rl"
|
801
|
+
{
|
802
|
+
finalize_header(hp);
|
803
|
+
|
804
|
+
cs = http_parser_first_final;
|
805
|
+
if (HP_FL_TEST(hp, HASBODY)) {
|
806
|
+
HP_FL_SET(hp, INBODY);
|
807
|
+
if (HP_FL_TEST(hp, CHUNKED))
|
808
|
+
cs = http_parser_en_ChunkedBody;
|
809
|
+
} else {
|
810
|
+
HP_FL_SET(hp, REQEOF);
|
811
|
+
assert(!HP_FL_TEST(hp, CHUNKED) && "chunked encoding without body!");
|
812
|
+
}
|
813
|
+
/*
|
814
|
+
* go back to Ruby so we can call the Rack application, we'll reenter
|
815
|
+
* the parser iff the body needs to be processed.
|
816
|
+
*/
|
817
|
+
goto post_exec;
|
818
|
+
}
|
819
|
+
goto st122;
|
820
|
+
tr104:
|
821
|
+
#line 341 "unicorn_http.rl"
|
763
822
|
{
|
764
823
|
VALUE str;
|
765
824
|
|
@@ -775,25 +834,82 @@ tr99:
|
|
775
834
|
rb_hash_aset(hp->env, g_request_path, str);
|
776
835
|
}
|
777
836
|
}
|
778
|
-
|
779
|
-
|
780
|
-
|
837
|
+
#line 381 "unicorn_http.rl"
|
838
|
+
{
|
839
|
+
finalize_header(hp);
|
840
|
+
|
841
|
+
cs = http_parser_first_final;
|
842
|
+
if (HP_FL_TEST(hp, HASBODY)) {
|
843
|
+
HP_FL_SET(hp, INBODY);
|
844
|
+
if (HP_FL_TEST(hp, CHUNKED))
|
845
|
+
cs = http_parser_en_ChunkedBody;
|
846
|
+
} else {
|
847
|
+
HP_FL_SET(hp, REQEOF);
|
848
|
+
assert(!HP_FL_TEST(hp, CHUNKED) && "chunked encoding without body!");
|
849
|
+
}
|
850
|
+
/*
|
851
|
+
* go back to Ruby so we can call the Rack application, we'll reenter
|
852
|
+
* the parser iff the body needs to be processed.
|
853
|
+
*/
|
854
|
+
goto post_exec;
|
855
|
+
}
|
856
|
+
goto st122;
|
857
|
+
tr108:
|
858
|
+
#line 327 "unicorn_http.rl"
|
781
859
|
{MARK(mark, p); }
|
782
|
-
#line
|
860
|
+
#line 356 "unicorn_http.rl"
|
783
861
|
{
|
784
862
|
VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
|
785
863
|
rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
|
786
864
|
}
|
787
|
-
|
788
|
-
|
789
|
-
|
865
|
+
#line 381 "unicorn_http.rl"
|
866
|
+
{
|
867
|
+
finalize_header(hp);
|
868
|
+
|
869
|
+
cs = http_parser_first_final;
|
870
|
+
if (HP_FL_TEST(hp, HASBODY)) {
|
871
|
+
HP_FL_SET(hp, INBODY);
|
872
|
+
if (HP_FL_TEST(hp, CHUNKED))
|
873
|
+
cs = http_parser_en_ChunkedBody;
|
874
|
+
} else {
|
875
|
+
HP_FL_SET(hp, REQEOF);
|
876
|
+
assert(!HP_FL_TEST(hp, CHUNKED) && "chunked encoding without body!");
|
877
|
+
}
|
878
|
+
/*
|
879
|
+
* go back to Ruby so we can call the Rack application, we'll reenter
|
880
|
+
* the parser iff the body needs to be processed.
|
881
|
+
*/
|
882
|
+
goto post_exec;
|
883
|
+
}
|
884
|
+
goto st122;
|
885
|
+
tr112:
|
886
|
+
#line 356 "unicorn_http.rl"
|
790
887
|
{
|
791
888
|
VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
|
792
889
|
rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
|
793
890
|
}
|
794
|
-
|
795
|
-
|
796
|
-
|
891
|
+
#line 381 "unicorn_http.rl"
|
892
|
+
{
|
893
|
+
finalize_header(hp);
|
894
|
+
|
895
|
+
cs = http_parser_first_final;
|
896
|
+
if (HP_FL_TEST(hp, HASBODY)) {
|
897
|
+
HP_FL_SET(hp, INBODY);
|
898
|
+
if (HP_FL_TEST(hp, CHUNKED))
|
899
|
+
cs = http_parser_en_ChunkedBody;
|
900
|
+
} else {
|
901
|
+
HP_FL_SET(hp, REQEOF);
|
902
|
+
assert(!HP_FL_TEST(hp, CHUNKED) && "chunked encoding without body!");
|
903
|
+
}
|
904
|
+
/*
|
905
|
+
* go back to Ruby so we can call the Rack application, we'll reenter
|
906
|
+
* the parser iff the body needs to be processed.
|
907
|
+
*/
|
908
|
+
goto post_exec;
|
909
|
+
}
|
910
|
+
goto st122;
|
911
|
+
tr117:
|
912
|
+
#line 366 "unicorn_http.rl"
|
797
913
|
{
|
798
914
|
VALUE val;
|
799
915
|
|
@@ -804,7 +920,7 @@ tr109:
|
|
804
920
|
if (!STR_CSTR_EQ(val, "*"))
|
805
921
|
rb_hash_aset(hp->env, g_path_info, val);
|
806
922
|
}
|
807
|
-
#line
|
923
|
+
#line 341 "unicorn_http.rl"
|
808
924
|
{
|
809
925
|
VALUE str;
|
810
926
|
|
@@ -820,16 +936,35 @@ tr109:
|
|
820
936
|
rb_hash_aset(hp->env, g_request_path, str);
|
821
937
|
}
|
822
938
|
}
|
823
|
-
|
824
|
-
|
825
|
-
|
939
|
+
#line 381 "unicorn_http.rl"
|
940
|
+
{
|
941
|
+
finalize_header(hp);
|
942
|
+
|
943
|
+
cs = http_parser_first_final;
|
944
|
+
if (HP_FL_TEST(hp, HASBODY)) {
|
945
|
+
HP_FL_SET(hp, INBODY);
|
946
|
+
if (HP_FL_TEST(hp, CHUNKED))
|
947
|
+
cs = http_parser_en_ChunkedBody;
|
948
|
+
} else {
|
949
|
+
HP_FL_SET(hp, REQEOF);
|
950
|
+
assert(!HP_FL_TEST(hp, CHUNKED) && "chunked encoding without body!");
|
951
|
+
}
|
952
|
+
/*
|
953
|
+
* go back to Ruby so we can call the Rack application, we'll reenter
|
954
|
+
* the parser iff the body needs to be processed.
|
955
|
+
*/
|
956
|
+
goto post_exec;
|
957
|
+
}
|
958
|
+
goto st122;
|
959
|
+
tr124:
|
960
|
+
#line 360 "unicorn_http.rl"
|
826
961
|
{MARK(start.query, p); }
|
827
|
-
#line
|
962
|
+
#line 361 "unicorn_http.rl"
|
828
963
|
{
|
829
964
|
VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
|
830
965
|
rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
|
831
966
|
}
|
832
|
-
#line
|
967
|
+
#line 341 "unicorn_http.rl"
|
833
968
|
{
|
834
969
|
VALUE str;
|
835
970
|
|
@@ -845,14 +980,33 @@ tr115:
|
|
845
980
|
rb_hash_aset(hp->env, g_request_path, str);
|
846
981
|
}
|
847
982
|
}
|
848
|
-
|
849
|
-
|
850
|
-
|
983
|
+
#line 381 "unicorn_http.rl"
|
984
|
+
{
|
985
|
+
finalize_header(hp);
|
986
|
+
|
987
|
+
cs = http_parser_first_final;
|
988
|
+
if (HP_FL_TEST(hp, HASBODY)) {
|
989
|
+
HP_FL_SET(hp, INBODY);
|
990
|
+
if (HP_FL_TEST(hp, CHUNKED))
|
991
|
+
cs = http_parser_en_ChunkedBody;
|
992
|
+
} else {
|
993
|
+
HP_FL_SET(hp, REQEOF);
|
994
|
+
assert(!HP_FL_TEST(hp, CHUNKED) && "chunked encoding without body!");
|
995
|
+
}
|
996
|
+
/*
|
997
|
+
* go back to Ruby so we can call the Rack application, we'll reenter
|
998
|
+
* the parser iff the body needs to be processed.
|
999
|
+
*/
|
1000
|
+
goto post_exec;
|
1001
|
+
}
|
1002
|
+
goto st122;
|
1003
|
+
tr129:
|
1004
|
+
#line 361 "unicorn_http.rl"
|
851
1005
|
{
|
852
1006
|
VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
|
853
1007
|
rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
|
854
1008
|
}
|
855
|
-
#line
|
1009
|
+
#line 341 "unicorn_http.rl"
|
856
1010
|
{
|
857
1011
|
VALUE str;
|
858
1012
|
|
@@ -868,17 +1022,7 @@ tr119:
|
|
868
1022
|
rb_hash_aset(hp->env, g_request_path, str);
|
869
1023
|
}
|
870
1024
|
}
|
871
|
-
|
872
|
-
st18:
|
873
|
-
if ( ++p == pe )
|
874
|
-
goto _test_eof18;
|
875
|
-
case 18:
|
876
|
-
#line 877 "unicorn_http.c"
|
877
|
-
if ( (*p) == 10 )
|
878
|
-
goto tr28;
|
879
|
-
goto st0;
|
880
|
-
tr28:
|
881
|
-
#line 373 "unicorn_http.rl"
|
1025
|
+
#line 381 "unicorn_http.rl"
|
882
1026
|
{
|
883
1027
|
finalize_header(hp);
|
884
1028
|
|
@@ -892,100 +1036,221 @@ tr28:
|
|
892
1036
|
assert(!HP_FL_TEST(hp, CHUNKED) && "chunked encoding without body!");
|
893
1037
|
}
|
894
1038
|
/*
|
895
|
-
* go back to Ruby so we can call the Rack application, we'll reenter
|
896
|
-
* the parser iff the body needs to be processed.
|
1039
|
+
* go back to Ruby so we can call the Rack application, we'll reenter
|
1040
|
+
* the parser iff the body needs to be processed.
|
1041
|
+
*/
|
1042
|
+
goto post_exec;
|
1043
|
+
}
|
1044
|
+
goto st122;
|
1045
|
+
st122:
|
1046
|
+
if ( ++p == pe )
|
1047
|
+
goto _test_eof122;
|
1048
|
+
case 122:
|
1049
|
+
#line 1050 "unicorn_http.c"
|
1050
|
+
goto st0;
|
1051
|
+
tr105:
|
1052
|
+
#line 341 "unicorn_http.rl"
|
1053
|
+
{
|
1054
|
+
VALUE str;
|
1055
|
+
|
1056
|
+
VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
|
1057
|
+
str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
|
1058
|
+
/*
|
1059
|
+
* "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
|
1060
|
+
* in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
|
1061
|
+
*/
|
1062
|
+
if (STR_CSTR_EQ(str, "*")) {
|
1063
|
+
str = rb_str_new(NULL, 0);
|
1064
|
+
rb_hash_aset(hp->env, g_path_info, str);
|
1065
|
+
rb_hash_aset(hp->env, g_request_path, str);
|
1066
|
+
}
|
1067
|
+
}
|
1068
|
+
goto st18;
|
1069
|
+
tr109:
|
1070
|
+
#line 327 "unicorn_http.rl"
|
1071
|
+
{MARK(mark, p); }
|
1072
|
+
#line 356 "unicorn_http.rl"
|
1073
|
+
{
|
1074
|
+
VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
|
1075
|
+
rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
|
1076
|
+
}
|
1077
|
+
goto st18;
|
1078
|
+
tr113:
|
1079
|
+
#line 356 "unicorn_http.rl"
|
1080
|
+
{
|
1081
|
+
VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT);
|
1082
|
+
rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p));
|
1083
|
+
}
|
1084
|
+
goto st18;
|
1085
|
+
tr118:
|
1086
|
+
#line 366 "unicorn_http.rl"
|
1087
|
+
{
|
1088
|
+
VALUE val;
|
1089
|
+
|
1090
|
+
VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_PATH);
|
1091
|
+
val = rb_hash_aset(hp->env, g_request_path, STR_NEW(mark, p));
|
1092
|
+
|
1093
|
+
/* rack says PATH_INFO must start with "/" or be empty */
|
1094
|
+
if (!STR_CSTR_EQ(val, "*"))
|
1095
|
+
rb_hash_aset(hp->env, g_path_info, val);
|
1096
|
+
}
|
1097
|
+
#line 341 "unicorn_http.rl"
|
1098
|
+
{
|
1099
|
+
VALUE str;
|
1100
|
+
|
1101
|
+
VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
|
1102
|
+
str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
|
1103
|
+
/*
|
1104
|
+
* "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
|
1105
|
+
* in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
|
1106
|
+
*/
|
1107
|
+
if (STR_CSTR_EQ(str, "*")) {
|
1108
|
+
str = rb_str_new(NULL, 0);
|
1109
|
+
rb_hash_aset(hp->env, g_path_info, str);
|
1110
|
+
rb_hash_aset(hp->env, g_request_path, str);
|
1111
|
+
}
|
1112
|
+
}
|
1113
|
+
goto st18;
|
1114
|
+
tr125:
|
1115
|
+
#line 360 "unicorn_http.rl"
|
1116
|
+
{MARK(start.query, p); }
|
1117
|
+
#line 361 "unicorn_http.rl"
|
1118
|
+
{
|
1119
|
+
VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
|
1120
|
+
rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
|
1121
|
+
}
|
1122
|
+
#line 341 "unicorn_http.rl"
|
1123
|
+
{
|
1124
|
+
VALUE str;
|
1125
|
+
|
1126
|
+
VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
|
1127
|
+
str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
|
1128
|
+
/*
|
1129
|
+
* "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
|
1130
|
+
* in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
|
1131
|
+
*/
|
1132
|
+
if (STR_CSTR_EQ(str, "*")) {
|
1133
|
+
str = rb_str_new(NULL, 0);
|
1134
|
+
rb_hash_aset(hp->env, g_path_info, str);
|
1135
|
+
rb_hash_aset(hp->env, g_request_path, str);
|
1136
|
+
}
|
1137
|
+
}
|
1138
|
+
goto st18;
|
1139
|
+
tr130:
|
1140
|
+
#line 361 "unicorn_http.rl"
|
1141
|
+
{
|
1142
|
+
VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
|
1143
|
+
rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
|
1144
|
+
}
|
1145
|
+
#line 341 "unicorn_http.rl"
|
1146
|
+
{
|
1147
|
+
VALUE str;
|
1148
|
+
|
1149
|
+
VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI);
|
1150
|
+
str = rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p));
|
1151
|
+
/*
|
1152
|
+
* "OPTIONS * HTTP/1.1\r\n" is a valid request, but we can't have '*'
|
1153
|
+
* in REQUEST_PATH or PATH_INFO or else Rack::Lint will complain
|
897
1154
|
*/
|
898
|
-
|
1155
|
+
if (STR_CSTR_EQ(str, "*")) {
|
1156
|
+
str = rb_str_new(NULL, 0);
|
1157
|
+
rb_hash_aset(hp->env, g_path_info, str);
|
1158
|
+
rb_hash_aset(hp->env, g_request_path, str);
|
1159
|
+
}
|
899
1160
|
}
|
900
|
-
goto
|
901
|
-
|
1161
|
+
goto st18;
|
1162
|
+
st18:
|
902
1163
|
if ( ++p == pe )
|
903
|
-
goto
|
904
|
-
case
|
905
|
-
#line
|
1164
|
+
goto _test_eof18;
|
1165
|
+
case 18:
|
1166
|
+
#line 1167 "unicorn_http.c"
|
1167
|
+
if ( (*p) == 10 )
|
1168
|
+
goto tr21;
|
906
1169
|
goto st0;
|
907
|
-
|
908
|
-
#line
|
1170
|
+
tr23:
|
1171
|
+
#line 329 "unicorn_http.rl"
|
909
1172
|
{ MARK(start.field, p); }
|
910
|
-
#line
|
1173
|
+
#line 330 "unicorn_http.rl"
|
911
1174
|
{ snake_upcase_char(deconst(p)); }
|
912
1175
|
goto st19;
|
913
|
-
|
914
|
-
#line
|
1176
|
+
tr32:
|
1177
|
+
#line 330 "unicorn_http.rl"
|
915
1178
|
{ snake_upcase_char(deconst(p)); }
|
916
1179
|
goto st19;
|
917
1180
|
st19:
|
918
1181
|
if ( ++p == pe )
|
919
1182
|
goto _test_eof19;
|
920
1183
|
case 19:
|
921
|
-
#line
|
1184
|
+
#line 1185 "unicorn_http.c"
|
922
1185
|
switch( (*p) ) {
|
923
|
-
case 33: goto
|
924
|
-
case 58: goto
|
925
|
-
case 124: goto
|
926
|
-
case 126: goto
|
1186
|
+
case 33: goto tr32;
|
1187
|
+
case 58: goto tr33;
|
1188
|
+
case 124: goto tr32;
|
1189
|
+
case 126: goto tr32;
|
927
1190
|
}
|
928
1191
|
if ( (*p) < 45 ) {
|
929
1192
|
if ( (*p) > 39 ) {
|
930
1193
|
if ( 42 <= (*p) && (*p) <= 43 )
|
931
|
-
goto
|
1194
|
+
goto tr32;
|
932
1195
|
} else if ( (*p) >= 35 )
|
933
|
-
goto
|
1196
|
+
goto tr32;
|
934
1197
|
} else if ( (*p) > 46 ) {
|
935
1198
|
if ( (*p) < 65 ) {
|
936
1199
|
if ( 48 <= (*p) && (*p) <= 57 )
|
937
|
-
goto
|
1200
|
+
goto tr32;
|
938
1201
|
} else if ( (*p) > 90 ) {
|
939
1202
|
if ( 94 <= (*p) && (*p) <= 122 )
|
940
|
-
goto
|
1203
|
+
goto tr32;
|
941
1204
|
} else
|
942
|
-
goto
|
1205
|
+
goto tr32;
|
943
1206
|
} else
|
944
|
-
goto
|
1207
|
+
goto tr32;
|
945
1208
|
goto st0;
|
946
|
-
|
947
|
-
#line
|
1209
|
+
tr35:
|
1210
|
+
#line 333 "unicorn_http.rl"
|
948
1211
|
{ MARK(mark, p); }
|
949
1212
|
goto st20;
|
950
|
-
|
951
|
-
#line
|
1213
|
+
tr33:
|
1214
|
+
#line 332 "unicorn_http.rl"
|
952
1215
|
{ hp->s.field_len = LEN(start.field, p); }
|
953
1216
|
goto st20;
|
954
1217
|
st20:
|
955
1218
|
if ( ++p == pe )
|
956
1219
|
goto _test_eof20;
|
957
1220
|
case 20:
|
958
|
-
#line
|
1221
|
+
#line 1222 "unicorn_http.c"
|
959
1222
|
switch( (*p) ) {
|
960
|
-
case 9: goto
|
961
|
-
case
|
962
|
-
case
|
1223
|
+
case 9: goto tr35;
|
1224
|
+
case 10: goto tr36;
|
1225
|
+
case 13: goto tr37;
|
1226
|
+
case 32: goto tr35;
|
963
1227
|
case 127: goto st0;
|
964
1228
|
}
|
965
1229
|
if ( 0 <= (*p) && (*p) <= 31 )
|
966
1230
|
goto st0;
|
967
|
-
goto
|
968
|
-
|
969
|
-
#line
|
1231
|
+
goto tr34;
|
1232
|
+
tr34:
|
1233
|
+
#line 333 "unicorn_http.rl"
|
970
1234
|
{ MARK(mark, p); }
|
971
1235
|
goto st21;
|
972
1236
|
st21:
|
973
1237
|
if ( ++p == pe )
|
974
1238
|
goto _test_eof21;
|
975
1239
|
case 21:
|
976
|
-
#line
|
1240
|
+
#line 1241 "unicorn_http.c"
|
977
1241
|
switch( (*p) ) {
|
978
|
-
case
|
1242
|
+
case 10: goto tr39;
|
1243
|
+
case 13: goto tr40;
|
979
1244
|
case 127: goto st0;
|
980
1245
|
}
|
981
1246
|
if ( (*p) > 8 ) {
|
982
|
-
if (
|
1247
|
+
if ( 11 <= (*p) && (*p) <= 31 )
|
983
1248
|
goto st0;
|
984
1249
|
} else if ( (*p) >= 0 )
|
985
1250
|
goto st0;
|
986
1251
|
goto st21;
|
987
1252
|
tr9:
|
988
|
-
#line
|
1253
|
+
#line 341 "unicorn_http.rl"
|
989
1254
|
{
|
990
1255
|
VALUE str;
|
991
1256
|
|
@@ -1002,8 +1267,8 @@ tr9:
|
|
1002
1267
|
}
|
1003
1268
|
}
|
1004
1269
|
goto st22;
|
1005
|
-
|
1006
|
-
#line
|
1270
|
+
tr50:
|
1271
|
+
#line 366 "unicorn_http.rl"
|
1007
1272
|
{
|
1008
1273
|
VALUE val;
|
1009
1274
|
|
@@ -1014,7 +1279,7 @@ tr45:
|
|
1014
1279
|
if (!STR_CSTR_EQ(val, "*"))
|
1015
1280
|
rb_hash_aset(hp->env, g_path_info, val);
|
1016
1281
|
}
|
1017
|
-
#line
|
1282
|
+
#line 341 "unicorn_http.rl"
|
1018
1283
|
{
|
1019
1284
|
VALUE str;
|
1020
1285
|
|
@@ -1031,15 +1296,15 @@ tr45:
|
|
1031
1296
|
}
|
1032
1297
|
}
|
1033
1298
|
goto st22;
|
1034
|
-
|
1035
|
-
#line
|
1299
|
+
tr56:
|
1300
|
+
#line 360 "unicorn_http.rl"
|
1036
1301
|
{MARK(start.query, p); }
|
1037
|
-
#line
|
1302
|
+
#line 361 "unicorn_http.rl"
|
1038
1303
|
{
|
1039
1304
|
VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
|
1040
1305
|
rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
|
1041
1306
|
}
|
1042
|
-
#line
|
1307
|
+
#line 341 "unicorn_http.rl"
|
1043
1308
|
{
|
1044
1309
|
VALUE str;
|
1045
1310
|
|
@@ -1056,13 +1321,13 @@ tr51:
|
|
1056
1321
|
}
|
1057
1322
|
}
|
1058
1323
|
goto st22;
|
1059
|
-
|
1060
|
-
#line
|
1324
|
+
tr60:
|
1325
|
+
#line 361 "unicorn_http.rl"
|
1061
1326
|
{
|
1062
1327
|
VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
|
1063
1328
|
rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
|
1064
1329
|
}
|
1065
|
-
#line
|
1330
|
+
#line 341 "unicorn_http.rl"
|
1066
1331
|
{
|
1067
1332
|
VALUE str;
|
1068
1333
|
|
@@ -1083,27 +1348,27 @@ st22:
|
|
1083
1348
|
if ( ++p == pe )
|
1084
1349
|
goto _test_eof22;
|
1085
1350
|
case 22:
|
1086
|
-
#line
|
1351
|
+
#line 1352 "unicorn_http.c"
|
1087
1352
|
switch( (*p) ) {
|
1088
|
-
case 32: goto
|
1353
|
+
case 32: goto tr42;
|
1089
1354
|
case 35: goto st0;
|
1090
|
-
case 37: goto
|
1355
|
+
case 37: goto tr43;
|
1091
1356
|
case 127: goto st0;
|
1092
1357
|
}
|
1093
1358
|
if ( 0 <= (*p) && (*p) <= 31 )
|
1094
1359
|
goto st0;
|
1095
|
-
goto
|
1096
|
-
|
1097
|
-
#line
|
1360
|
+
goto tr41;
|
1361
|
+
tr41:
|
1362
|
+
#line 327 "unicorn_http.rl"
|
1098
1363
|
{MARK(mark, p); }
|
1099
1364
|
goto st23;
|
1100
1365
|
st23:
|
1101
1366
|
if ( ++p == pe )
|
1102
1367
|
goto _test_eof23;
|
1103
1368
|
case 23:
|
1104
|
-
#line
|
1369
|
+
#line 1370 "unicorn_http.c"
|
1105
1370
|
switch( (*p) ) {
|
1106
|
-
case 32: goto
|
1371
|
+
case 32: goto tr45;
|
1107
1372
|
case 35: goto st0;
|
1108
1373
|
case 37: goto st24;
|
1109
1374
|
case 127: goto st0;
|
@@ -1111,15 +1376,15 @@ case 23:
|
|
1111
1376
|
if ( 0 <= (*p) && (*p) <= 31 )
|
1112
1377
|
goto st0;
|
1113
1378
|
goto st23;
|
1114
|
-
|
1115
|
-
#line
|
1379
|
+
tr43:
|
1380
|
+
#line 327 "unicorn_http.rl"
|
1116
1381
|
{MARK(mark, p); }
|
1117
1382
|
goto st24;
|
1118
1383
|
st24:
|
1119
1384
|
if ( ++p == pe )
|
1120
1385
|
goto _test_eof24;
|
1121
1386
|
case 24:
|
1122
|
-
#line
|
1387
|
+
#line 1388 "unicorn_http.c"
|
1123
1388
|
if ( (*p) < 65 ) {
|
1124
1389
|
if ( 48 <= (*p) && (*p) <= 57 )
|
1125
1390
|
goto st25;
|
@@ -1143,25 +1408,25 @@ case 25:
|
|
1143
1408
|
goto st23;
|
1144
1409
|
goto st0;
|
1145
1410
|
tr6:
|
1146
|
-
#line
|
1411
|
+
#line 327 "unicorn_http.rl"
|
1147
1412
|
{MARK(mark, p); }
|
1148
1413
|
goto st26;
|
1149
|
-
|
1150
|
-
#line
|
1414
|
+
tr76:
|
1415
|
+
#line 340 "unicorn_http.rl"
|
1151
1416
|
{ rb_hash_aset(hp->env, g_http_host, STR_NEW(mark, p)); }
|
1152
|
-
#line
|
1417
|
+
#line 327 "unicorn_http.rl"
|
1153
1418
|
{MARK(mark, p); }
|
1154
1419
|
goto st26;
|
1155
1420
|
st26:
|
1156
1421
|
if ( ++p == pe )
|
1157
1422
|
goto _test_eof26;
|
1158
1423
|
case 26:
|
1159
|
-
#line
|
1424
|
+
#line 1425 "unicorn_http.c"
|
1160
1425
|
switch( (*p) ) {
|
1161
|
-
case 32: goto
|
1162
|
-
case 35: goto
|
1426
|
+
case 32: goto tr49;
|
1427
|
+
case 35: goto tr50;
|
1163
1428
|
case 37: goto st27;
|
1164
|
-
case 63: goto
|
1429
|
+
case 63: goto tr52;
|
1165
1430
|
case 127: goto st0;
|
1166
1431
|
}
|
1167
1432
|
if ( 0 <= (*p) && (*p) <= 31 )
|
@@ -1193,8 +1458,8 @@ case 28:
|
|
1193
1458
|
} else
|
1194
1459
|
goto st26;
|
1195
1460
|
goto st0;
|
1196
|
-
|
1197
|
-
#line
|
1461
|
+
tr52:
|
1462
|
+
#line 366 "unicorn_http.rl"
|
1198
1463
|
{
|
1199
1464
|
VALUE val;
|
1200
1465
|
|
@@ -1210,43 +1475,43 @@ st29:
|
|
1210
1475
|
if ( ++p == pe )
|
1211
1476
|
goto _test_eof29;
|
1212
1477
|
case 29:
|
1213
|
-
#line
|
1478
|
+
#line 1479 "unicorn_http.c"
|
1214
1479
|
switch( (*p) ) {
|
1215
|
-
case 32: goto
|
1216
|
-
case 35: goto
|
1217
|
-
case 37: goto
|
1480
|
+
case 32: goto tr55;
|
1481
|
+
case 35: goto tr56;
|
1482
|
+
case 37: goto tr57;
|
1218
1483
|
case 127: goto st0;
|
1219
1484
|
}
|
1220
1485
|
if ( 0 <= (*p) && (*p) <= 31 )
|
1221
1486
|
goto st0;
|
1222
|
-
goto
|
1223
|
-
|
1224
|
-
#line
|
1487
|
+
goto tr54;
|
1488
|
+
tr54:
|
1489
|
+
#line 360 "unicorn_http.rl"
|
1225
1490
|
{MARK(start.query, p); }
|
1226
1491
|
goto st30;
|
1227
1492
|
st30:
|
1228
1493
|
if ( ++p == pe )
|
1229
1494
|
goto _test_eof30;
|
1230
1495
|
case 30:
|
1231
|
-
#line
|
1496
|
+
#line 1497 "unicorn_http.c"
|
1232
1497
|
switch( (*p) ) {
|
1233
|
-
case 32: goto
|
1234
|
-
case 35: goto
|
1498
|
+
case 32: goto tr59;
|
1499
|
+
case 35: goto tr60;
|
1235
1500
|
case 37: goto st31;
|
1236
1501
|
case 127: goto st0;
|
1237
1502
|
}
|
1238
1503
|
if ( 0 <= (*p) && (*p) <= 31 )
|
1239
1504
|
goto st0;
|
1240
1505
|
goto st30;
|
1241
|
-
|
1242
|
-
#line
|
1506
|
+
tr57:
|
1507
|
+
#line 360 "unicorn_http.rl"
|
1243
1508
|
{MARK(start.query, p); }
|
1244
1509
|
goto st31;
|
1245
1510
|
st31:
|
1246
1511
|
if ( ++p == pe )
|
1247
1512
|
goto _test_eof31;
|
1248
1513
|
case 31:
|
1249
|
-
#line
|
1514
|
+
#line 1515 "unicorn_http.c"
|
1250
1515
|
if ( (*p) < 65 ) {
|
1251
1516
|
if ( 48 <= (*p) && (*p) <= 57 )
|
1252
1517
|
goto st32;
|
@@ -1270,66 +1535,66 @@ case 32:
|
|
1270
1535
|
goto st30;
|
1271
1536
|
goto st0;
|
1272
1537
|
tr7:
|
1273
|
-
#line
|
1538
|
+
#line 327 "unicorn_http.rl"
|
1274
1539
|
{MARK(mark, p); }
|
1275
|
-
#line
|
1540
|
+
#line 331 "unicorn_http.rl"
|
1276
1541
|
{ downcase_char(deconst(p)); }
|
1277
1542
|
goto st33;
|
1278
1543
|
st33:
|
1279
1544
|
if ( ++p == pe )
|
1280
1545
|
goto _test_eof33;
|
1281
1546
|
case 33:
|
1282
|
-
#line
|
1547
|
+
#line 1548 "unicorn_http.c"
|
1283
1548
|
switch( (*p) ) {
|
1284
|
-
case 84: goto
|
1285
|
-
case 116: goto
|
1549
|
+
case 84: goto tr63;
|
1550
|
+
case 116: goto tr63;
|
1286
1551
|
}
|
1287
1552
|
goto st0;
|
1288
|
-
|
1289
|
-
#line
|
1553
|
+
tr63:
|
1554
|
+
#line 331 "unicorn_http.rl"
|
1290
1555
|
{ downcase_char(deconst(p)); }
|
1291
1556
|
goto st34;
|
1292
1557
|
st34:
|
1293
1558
|
if ( ++p == pe )
|
1294
1559
|
goto _test_eof34;
|
1295
1560
|
case 34:
|
1296
|
-
#line
|
1561
|
+
#line 1562 "unicorn_http.c"
|
1297
1562
|
switch( (*p) ) {
|
1298
|
-
case 84: goto
|
1299
|
-
case 116: goto
|
1563
|
+
case 84: goto tr64;
|
1564
|
+
case 116: goto tr64;
|
1300
1565
|
}
|
1301
1566
|
goto st0;
|
1302
|
-
|
1303
|
-
#line
|
1567
|
+
tr64:
|
1568
|
+
#line 331 "unicorn_http.rl"
|
1304
1569
|
{ downcase_char(deconst(p)); }
|
1305
1570
|
goto st35;
|
1306
1571
|
st35:
|
1307
1572
|
if ( ++p == pe )
|
1308
1573
|
goto _test_eof35;
|
1309
1574
|
case 35:
|
1310
|
-
#line
|
1575
|
+
#line 1576 "unicorn_http.c"
|
1311
1576
|
switch( (*p) ) {
|
1312
|
-
case 80: goto
|
1313
|
-
case 112: goto
|
1577
|
+
case 80: goto tr65;
|
1578
|
+
case 112: goto tr65;
|
1314
1579
|
}
|
1315
1580
|
goto st0;
|
1316
|
-
|
1317
|
-
#line
|
1581
|
+
tr65:
|
1582
|
+
#line 331 "unicorn_http.rl"
|
1318
1583
|
{ downcase_char(deconst(p)); }
|
1319
1584
|
goto st36;
|
1320
1585
|
st36:
|
1321
1586
|
if ( ++p == pe )
|
1322
1587
|
goto _test_eof36;
|
1323
1588
|
case 36:
|
1324
|
-
#line
|
1589
|
+
#line 1590 "unicorn_http.c"
|
1325
1590
|
switch( (*p) ) {
|
1326
|
-
case 58: goto
|
1327
|
-
case 83: goto
|
1328
|
-
case 115: goto
|
1591
|
+
case 58: goto tr66;
|
1592
|
+
case 83: goto tr67;
|
1593
|
+
case 115: goto tr67;
|
1329
1594
|
}
|
1330
1595
|
goto st0;
|
1331
|
-
|
1332
|
-
#line
|
1596
|
+
tr66:
|
1597
|
+
#line 337 "unicorn_http.rl"
|
1333
1598
|
{
|
1334
1599
|
rb_hash_aset(hp->env, g_rack_url_scheme, STR_NEW(mark, p));
|
1335
1600
|
}
|
@@ -1338,7 +1603,7 @@ st37:
|
|
1338
1603
|
if ( ++p == pe )
|
1339
1604
|
goto _test_eof37;
|
1340
1605
|
case 37:
|
1341
|
-
#line
|
1606
|
+
#line 1607 "unicorn_http.c"
|
1342
1607
|
if ( (*p) == 47 )
|
1343
1608
|
goto st38;
|
1344
1609
|
goto st0;
|
@@ -1357,8 +1622,8 @@ case 39:
|
|
1357
1622
|
case 37: goto st41;
|
1358
1623
|
case 47: goto st0;
|
1359
1624
|
case 60: goto st0;
|
1360
|
-
case 91: goto
|
1361
|
-
case 95: goto
|
1625
|
+
case 91: goto tr73;
|
1626
|
+
case 95: goto tr72;
|
1362
1627
|
case 127: goto st0;
|
1363
1628
|
}
|
1364
1629
|
if ( (*p) < 45 ) {
|
@@ -1373,11 +1638,11 @@ case 39:
|
|
1373
1638
|
goto st0;
|
1374
1639
|
} else if ( (*p) > 90 ) {
|
1375
1640
|
if ( 97 <= (*p) && (*p) <= 122 )
|
1376
|
-
goto
|
1641
|
+
goto tr72;
|
1377
1642
|
} else
|
1378
|
-
goto
|
1643
|
+
goto tr72;
|
1379
1644
|
} else
|
1380
|
-
goto
|
1645
|
+
goto tr72;
|
1381
1646
|
goto st40;
|
1382
1647
|
st40:
|
1383
1648
|
if ( ++p == pe )
|
@@ -1425,18 +1690,18 @@ case 42:
|
|
1425
1690
|
} else
|
1426
1691
|
goto st40;
|
1427
1692
|
goto st0;
|
1428
|
-
|
1429
|
-
#line
|
1693
|
+
tr72:
|
1694
|
+
#line 327 "unicorn_http.rl"
|
1430
1695
|
{MARK(mark, p); }
|
1431
1696
|
goto st43;
|
1432
1697
|
st43:
|
1433
1698
|
if ( ++p == pe )
|
1434
1699
|
goto _test_eof43;
|
1435
1700
|
case 43:
|
1436
|
-
#line
|
1701
|
+
#line 1702 "unicorn_http.c"
|
1437
1702
|
switch( (*p) ) {
|
1438
1703
|
case 37: goto st41;
|
1439
|
-
case 47: goto
|
1704
|
+
case 47: goto tr76;
|
1440
1705
|
case 58: goto st44;
|
1441
1706
|
case 60: goto st0;
|
1442
1707
|
case 64: goto st39;
|
@@ -1467,7 +1732,7 @@ st44:
|
|
1467
1732
|
case 44:
|
1468
1733
|
switch( (*p) ) {
|
1469
1734
|
case 37: goto st41;
|
1470
|
-
case 47: goto
|
1735
|
+
case 47: goto tr76;
|
1471
1736
|
case 60: goto st0;
|
1472
1737
|
case 64: goto st39;
|
1473
1738
|
case 127: goto st0;
|
@@ -1484,15 +1749,15 @@ case 44:
|
|
1484
1749
|
} else
|
1485
1750
|
goto st0;
|
1486
1751
|
goto st40;
|
1487
|
-
|
1488
|
-
#line
|
1752
|
+
tr73:
|
1753
|
+
#line 327 "unicorn_http.rl"
|
1489
1754
|
{MARK(mark, p); }
|
1490
1755
|
goto st45;
|
1491
1756
|
st45:
|
1492
1757
|
if ( ++p == pe )
|
1493
1758
|
goto _test_eof45;
|
1494
1759
|
case 45:
|
1495
|
-
#line
|
1760
|
+
#line 1761 "unicorn_http.c"
|
1496
1761
|
switch( (*p) ) {
|
1497
1762
|
case 37: goto st41;
|
1498
1763
|
case 47: goto st0;
|
@@ -1554,7 +1819,7 @@ st47:
|
|
1554
1819
|
case 47:
|
1555
1820
|
switch( (*p) ) {
|
1556
1821
|
case 37: goto st41;
|
1557
|
-
case 47: goto
|
1822
|
+
case 47: goto tr76;
|
1558
1823
|
case 58: goto st44;
|
1559
1824
|
case 60: goto st0;
|
1560
1825
|
case 64: goto st39;
|
@@ -1569,17 +1834,17 @@ case 47:
|
|
1569
1834
|
} else
|
1570
1835
|
goto st0;
|
1571
1836
|
goto st40;
|
1572
|
-
|
1573
|
-
#line
|
1837
|
+
tr67:
|
1838
|
+
#line 331 "unicorn_http.rl"
|
1574
1839
|
{ downcase_char(deconst(p)); }
|
1575
1840
|
goto st48;
|
1576
1841
|
st48:
|
1577
1842
|
if ( ++p == pe )
|
1578
1843
|
goto _test_eof48;
|
1579
1844
|
case 48:
|
1580
|
-
#line
|
1845
|
+
#line 1846 "unicorn_http.c"
|
1581
1846
|
if ( (*p) == 58 )
|
1582
|
-
goto
|
1847
|
+
goto tr66;
|
1583
1848
|
goto st0;
|
1584
1849
|
st49:
|
1585
1850
|
if ( ++p == pe )
|
@@ -2093,14 +2358,14 @@ case 67:
|
|
2093
2358
|
goto tr3;
|
2094
2359
|
goto st0;
|
2095
2360
|
tr2:
|
2096
|
-
#line
|
2361
|
+
#line 327 "unicorn_http.rl"
|
2097
2362
|
{MARK(mark, p); }
|
2098
2363
|
goto st68;
|
2099
2364
|
st68:
|
2100
2365
|
if ( ++p == pe )
|
2101
2366
|
goto _test_eof68;
|
2102
2367
|
case 68:
|
2103
|
-
#line
|
2368
|
+
#line 2369 "unicorn_http.c"
|
2104
2369
|
switch( (*p) ) {
|
2105
2370
|
case 32: goto tr3;
|
2106
2371
|
case 33: goto st49;
|
@@ -2160,7 +2425,7 @@ st70:
|
|
2160
2425
|
goto _test_eof70;
|
2161
2426
|
case 70:
|
2162
2427
|
switch( (*p) ) {
|
2163
|
-
case 32: goto
|
2428
|
+
case 32: goto tr100;
|
2164
2429
|
case 33: goto st51;
|
2165
2430
|
case 124: goto st51;
|
2166
2431
|
case 126: goto st51;
|
@@ -2183,39 +2448,40 @@ case 70:
|
|
2183
2448
|
} else
|
2184
2449
|
goto st51;
|
2185
2450
|
goto st0;
|
2186
|
-
|
2187
|
-
#line
|
2451
|
+
tr100:
|
2452
|
+
#line 336 "unicorn_http.rl"
|
2188
2453
|
{ request_method(hp, PTR_TO(mark), LEN(mark, p)); }
|
2189
2454
|
goto st71;
|
2190
2455
|
st71:
|
2191
2456
|
if ( ++p == pe )
|
2192
2457
|
goto _test_eof71;
|
2193
2458
|
case 71:
|
2194
|
-
#line
|
2459
|
+
#line 2460 "unicorn_http.c"
|
2195
2460
|
switch( (*p) ) {
|
2196
|
-
case 42: goto
|
2197
|
-
case 47: goto
|
2198
|
-
case 72: goto
|
2199
|
-
case 104: goto
|
2461
|
+
case 42: goto tr101;
|
2462
|
+
case 47: goto tr102;
|
2463
|
+
case 72: goto tr103;
|
2464
|
+
case 104: goto tr103;
|
2200
2465
|
}
|
2201
2466
|
goto st0;
|
2202
|
-
|
2203
|
-
#line
|
2467
|
+
tr101:
|
2468
|
+
#line 327 "unicorn_http.rl"
|
2204
2469
|
{MARK(mark, p); }
|
2205
2470
|
goto st72;
|
2206
2471
|
st72:
|
2207
2472
|
if ( ++p == pe )
|
2208
2473
|
goto _test_eof72;
|
2209
2474
|
case 72:
|
2210
|
-
#line
|
2475
|
+
#line 2476 "unicorn_http.c"
|
2211
2476
|
switch( (*p) ) {
|
2212
|
-
case
|
2477
|
+
case 10: goto tr104;
|
2478
|
+
case 13: goto tr105;
|
2213
2479
|
case 32: goto tr8;
|
2214
|
-
case 35: goto
|
2480
|
+
case 35: goto tr106;
|
2215
2481
|
}
|
2216
2482
|
goto st0;
|
2217
|
-
|
2218
|
-
#line
|
2483
|
+
tr106:
|
2484
|
+
#line 341 "unicorn_http.rl"
|
2219
2485
|
{
|
2220
2486
|
VALUE str;
|
2221
2487
|
|
@@ -2232,8 +2498,8 @@ tr100:
|
|
2232
2498
|
}
|
2233
2499
|
}
|
2234
2500
|
goto st73;
|
2235
|
-
|
2236
|
-
#line
|
2501
|
+
tr119:
|
2502
|
+
#line 366 "unicorn_http.rl"
|
2237
2503
|
{
|
2238
2504
|
VALUE val;
|
2239
2505
|
|
@@ -2244,7 +2510,7 @@ tr110:
|
|
2244
2510
|
if (!STR_CSTR_EQ(val, "*"))
|
2245
2511
|
rb_hash_aset(hp->env, g_path_info, val);
|
2246
2512
|
}
|
2247
|
-
#line
|
2513
|
+
#line 341 "unicorn_http.rl"
|
2248
2514
|
{
|
2249
2515
|
VALUE str;
|
2250
2516
|
|
@@ -2261,15 +2527,15 @@ tr110:
|
|
2261
2527
|
}
|
2262
2528
|
}
|
2263
2529
|
goto st73;
|
2264
|
-
|
2265
|
-
#line
|
2530
|
+
tr126:
|
2531
|
+
#line 360 "unicorn_http.rl"
|
2266
2532
|
{MARK(start.query, p); }
|
2267
|
-
#line
|
2533
|
+
#line 361 "unicorn_http.rl"
|
2268
2534
|
{
|
2269
2535
|
VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
|
2270
2536
|
rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
|
2271
2537
|
}
|
2272
|
-
#line
|
2538
|
+
#line 341 "unicorn_http.rl"
|
2273
2539
|
{
|
2274
2540
|
VALUE str;
|
2275
2541
|
|
@@ -2286,13 +2552,13 @@ tr116:
|
|
2286
2552
|
}
|
2287
2553
|
}
|
2288
2554
|
goto st73;
|
2289
|
-
|
2290
|
-
#line
|
2555
|
+
tr131:
|
2556
|
+
#line 361 "unicorn_http.rl"
|
2291
2557
|
{
|
2292
2558
|
VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING);
|
2293
2559
|
rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p));
|
2294
2560
|
}
|
2295
|
-
#line
|
2561
|
+
#line 341 "unicorn_http.rl"
|
2296
2562
|
{
|
2297
2563
|
VALUE str;
|
2298
2564
|
|
@@ -2313,29 +2579,31 @@ st73:
|
|
2313
2579
|
if ( ++p == pe )
|
2314
2580
|
goto _test_eof73;
|
2315
2581
|
case 73:
|
2316
|
-
#line
|
2582
|
+
#line 2583 "unicorn_http.c"
|
2317
2583
|
switch( (*p) ) {
|
2318
|
-
case
|
2319
|
-
case
|
2584
|
+
case 10: goto tr108;
|
2585
|
+
case 13: goto tr109;
|
2586
|
+
case 32: goto tr42;
|
2320
2587
|
case 35: goto st0;
|
2321
|
-
case 37: goto
|
2588
|
+
case 37: goto tr110;
|
2322
2589
|
case 127: goto st0;
|
2323
2590
|
}
|
2324
2591
|
if ( 0 <= (*p) && (*p) <= 31 )
|
2325
2592
|
goto st0;
|
2326
|
-
goto
|
2327
|
-
|
2328
|
-
#line
|
2593
|
+
goto tr107;
|
2594
|
+
tr107:
|
2595
|
+
#line 327 "unicorn_http.rl"
|
2329
2596
|
{MARK(mark, p); }
|
2330
2597
|
goto st74;
|
2331
2598
|
st74:
|
2332
2599
|
if ( ++p == pe )
|
2333
2600
|
goto _test_eof74;
|
2334
2601
|
case 74:
|
2335
|
-
#line
|
2602
|
+
#line 2603 "unicorn_http.c"
|
2336
2603
|
switch( (*p) ) {
|
2337
|
-
case
|
2338
|
-
case
|
2604
|
+
case 10: goto tr112;
|
2605
|
+
case 13: goto tr113;
|
2606
|
+
case 32: goto tr45;
|
2339
2607
|
case 35: goto st0;
|
2340
2608
|
case 37: goto st75;
|
2341
2609
|
case 127: goto st0;
|
@@ -2343,15 +2611,15 @@ case 74:
|
|
2343
2611
|
if ( 0 <= (*p) && (*p) <= 31 )
|
2344
2612
|
goto st0;
|
2345
2613
|
goto st74;
|
2346
|
-
|
2347
|
-
#line
|
2614
|
+
tr110:
|
2615
|
+
#line 327 "unicorn_http.rl"
|
2348
2616
|
{MARK(mark, p); }
|
2349
2617
|
goto st75;
|
2350
2618
|
st75:
|
2351
2619
|
if ( ++p == pe )
|
2352
2620
|
goto _test_eof75;
|
2353
2621
|
case 75:
|
2354
|
-
#line
|
2622
|
+
#line 2623 "unicorn_http.c"
|
2355
2623
|
if ( (*p) < 65 ) {
|
2356
2624
|
if ( 48 <= (*p) && (*p) <= 57 )
|
2357
2625
|
goto st76;
|
@@ -2374,27 +2642,28 @@ case 76:
|
|
2374
2642
|
} else
|
2375
2643
|
goto st74;
|
2376
2644
|
goto st0;
|
2377
|
-
|
2378
|
-
#line
|
2645
|
+
tr102:
|
2646
|
+
#line 327 "unicorn_http.rl"
|
2379
2647
|
{MARK(mark, p); }
|
2380
2648
|
goto st77;
|
2381
|
-
|
2382
|
-
#line
|
2649
|
+
tr147:
|
2650
|
+
#line 340 "unicorn_http.rl"
|
2383
2651
|
{ rb_hash_aset(hp->env, g_http_host, STR_NEW(mark, p)); }
|
2384
|
-
#line
|
2652
|
+
#line 327 "unicorn_http.rl"
|
2385
2653
|
{MARK(mark, p); }
|
2386
2654
|
goto st77;
|
2387
2655
|
st77:
|
2388
2656
|
if ( ++p == pe )
|
2389
2657
|
goto _test_eof77;
|
2390
2658
|
case 77:
|
2391
|
-
#line
|
2659
|
+
#line 2660 "unicorn_http.c"
|
2392
2660
|
switch( (*p) ) {
|
2393
|
-
case
|
2394
|
-
case
|
2395
|
-
case
|
2661
|
+
case 10: goto tr117;
|
2662
|
+
case 13: goto tr118;
|
2663
|
+
case 32: goto tr49;
|
2664
|
+
case 35: goto tr119;
|
2396
2665
|
case 37: goto st78;
|
2397
|
-
case 63: goto
|
2666
|
+
case 63: goto tr121;
|
2398
2667
|
case 127: goto st0;
|
2399
2668
|
}
|
2400
2669
|
if ( 0 <= (*p) && (*p) <= 31 )
|
@@ -2426,8 +2695,8 @@ case 79:
|
|
2426
2695
|
} else
|
2427
2696
|
goto st77;
|
2428
2697
|
goto st0;
|
2429
|
-
|
2430
|
-
#line
|
2698
|
+
tr121:
|
2699
|
+
#line 366 "unicorn_http.rl"
|
2431
2700
|
{
|
2432
2701
|
VALUE val;
|
2433
2702
|
|
@@ -2443,45 +2712,47 @@ st80:
|
|
2443
2712
|
if ( ++p == pe )
|
2444
2713
|
goto _test_eof80;
|
2445
2714
|
case 80:
|
2446
|
-
#line
|
2715
|
+
#line 2716 "unicorn_http.c"
|
2447
2716
|
switch( (*p) ) {
|
2448
|
-
case
|
2449
|
-
case
|
2450
|
-
case
|
2451
|
-
case
|
2717
|
+
case 10: goto tr124;
|
2718
|
+
case 13: goto tr125;
|
2719
|
+
case 32: goto tr55;
|
2720
|
+
case 35: goto tr126;
|
2721
|
+
case 37: goto tr127;
|
2452
2722
|
case 127: goto st0;
|
2453
2723
|
}
|
2454
2724
|
if ( 0 <= (*p) && (*p) <= 31 )
|
2455
2725
|
goto st0;
|
2456
|
-
goto
|
2457
|
-
|
2458
|
-
#line
|
2726
|
+
goto tr123;
|
2727
|
+
tr123:
|
2728
|
+
#line 360 "unicorn_http.rl"
|
2459
2729
|
{MARK(start.query, p); }
|
2460
2730
|
goto st81;
|
2461
2731
|
st81:
|
2462
2732
|
if ( ++p == pe )
|
2463
2733
|
goto _test_eof81;
|
2464
2734
|
case 81:
|
2465
|
-
#line
|
2735
|
+
#line 2736 "unicorn_http.c"
|
2466
2736
|
switch( (*p) ) {
|
2467
|
-
case
|
2468
|
-
case
|
2469
|
-
case
|
2737
|
+
case 10: goto tr129;
|
2738
|
+
case 13: goto tr130;
|
2739
|
+
case 32: goto tr59;
|
2740
|
+
case 35: goto tr131;
|
2470
2741
|
case 37: goto st82;
|
2471
2742
|
case 127: goto st0;
|
2472
2743
|
}
|
2473
2744
|
if ( 0 <= (*p) && (*p) <= 31 )
|
2474
2745
|
goto st0;
|
2475
2746
|
goto st81;
|
2476
|
-
|
2477
|
-
#line
|
2747
|
+
tr127:
|
2748
|
+
#line 360 "unicorn_http.rl"
|
2478
2749
|
{MARK(start.query, p); }
|
2479
2750
|
goto st82;
|
2480
2751
|
st82:
|
2481
2752
|
if ( ++p == pe )
|
2482
2753
|
goto _test_eof82;
|
2483
2754
|
case 82:
|
2484
|
-
#line
|
2755
|
+
#line 2756 "unicorn_http.c"
|
2485
2756
|
if ( (*p) < 65 ) {
|
2486
2757
|
if ( 48 <= (*p) && (*p) <= 57 )
|
2487
2758
|
goto st83;
|
@@ -2504,67 +2775,67 @@ case 83:
|
|
2504
2775
|
} else
|
2505
2776
|
goto st81;
|
2506
2777
|
goto st0;
|
2507
|
-
|
2508
|
-
#line
|
2778
|
+
tr103:
|
2779
|
+
#line 327 "unicorn_http.rl"
|
2509
2780
|
{MARK(mark, p); }
|
2510
|
-
#line
|
2781
|
+
#line 331 "unicorn_http.rl"
|
2511
2782
|
{ downcase_char(deconst(p)); }
|
2512
2783
|
goto st84;
|
2513
2784
|
st84:
|
2514
2785
|
if ( ++p == pe )
|
2515
2786
|
goto _test_eof84;
|
2516
2787
|
case 84:
|
2517
|
-
#line
|
2788
|
+
#line 2789 "unicorn_http.c"
|
2518
2789
|
switch( (*p) ) {
|
2519
|
-
case 84: goto
|
2520
|
-
case 116: goto
|
2790
|
+
case 84: goto tr134;
|
2791
|
+
case 116: goto tr134;
|
2521
2792
|
}
|
2522
2793
|
goto st0;
|
2523
|
-
|
2524
|
-
#line
|
2794
|
+
tr134:
|
2795
|
+
#line 331 "unicorn_http.rl"
|
2525
2796
|
{ downcase_char(deconst(p)); }
|
2526
2797
|
goto st85;
|
2527
2798
|
st85:
|
2528
2799
|
if ( ++p == pe )
|
2529
2800
|
goto _test_eof85;
|
2530
2801
|
case 85:
|
2531
|
-
#line
|
2802
|
+
#line 2803 "unicorn_http.c"
|
2532
2803
|
switch( (*p) ) {
|
2533
|
-
case 84: goto
|
2534
|
-
case 116: goto
|
2804
|
+
case 84: goto tr135;
|
2805
|
+
case 116: goto tr135;
|
2535
2806
|
}
|
2536
2807
|
goto st0;
|
2537
|
-
|
2538
|
-
#line
|
2808
|
+
tr135:
|
2809
|
+
#line 331 "unicorn_http.rl"
|
2539
2810
|
{ downcase_char(deconst(p)); }
|
2540
2811
|
goto st86;
|
2541
2812
|
st86:
|
2542
2813
|
if ( ++p == pe )
|
2543
2814
|
goto _test_eof86;
|
2544
2815
|
case 86:
|
2545
|
-
#line
|
2816
|
+
#line 2817 "unicorn_http.c"
|
2546
2817
|
switch( (*p) ) {
|
2547
|
-
case 80: goto
|
2548
|
-
case 112: goto
|
2818
|
+
case 80: goto tr136;
|
2819
|
+
case 112: goto tr136;
|
2549
2820
|
}
|
2550
2821
|
goto st0;
|
2551
|
-
|
2552
|
-
#line
|
2822
|
+
tr136:
|
2823
|
+
#line 331 "unicorn_http.rl"
|
2553
2824
|
{ downcase_char(deconst(p)); }
|
2554
2825
|
goto st87;
|
2555
2826
|
st87:
|
2556
2827
|
if ( ++p == pe )
|
2557
2828
|
goto _test_eof87;
|
2558
2829
|
case 87:
|
2559
|
-
#line
|
2830
|
+
#line 2831 "unicorn_http.c"
|
2560
2831
|
switch( (*p) ) {
|
2561
|
-
case 58: goto
|
2562
|
-
case 83: goto
|
2563
|
-
case 115: goto
|
2832
|
+
case 58: goto tr137;
|
2833
|
+
case 83: goto tr138;
|
2834
|
+
case 115: goto tr138;
|
2564
2835
|
}
|
2565
2836
|
goto st0;
|
2566
|
-
|
2567
|
-
#line
|
2837
|
+
tr137:
|
2838
|
+
#line 337 "unicorn_http.rl"
|
2568
2839
|
{
|
2569
2840
|
rb_hash_aset(hp->env, g_rack_url_scheme, STR_NEW(mark, p));
|
2570
2841
|
}
|
@@ -2573,7 +2844,7 @@ st88:
|
|
2573
2844
|
if ( ++p == pe )
|
2574
2845
|
goto _test_eof88;
|
2575
2846
|
case 88:
|
2576
|
-
#line
|
2847
|
+
#line 2848 "unicorn_http.c"
|
2577
2848
|
if ( (*p) == 47 )
|
2578
2849
|
goto st89;
|
2579
2850
|
goto st0;
|
@@ -2592,8 +2863,8 @@ case 90:
|
|
2592
2863
|
case 37: goto st92;
|
2593
2864
|
case 47: goto st0;
|
2594
2865
|
case 60: goto st0;
|
2595
|
-
case 91: goto
|
2596
|
-
case 95: goto
|
2866
|
+
case 91: goto tr144;
|
2867
|
+
case 95: goto tr143;
|
2597
2868
|
case 127: goto st0;
|
2598
2869
|
}
|
2599
2870
|
if ( (*p) < 45 ) {
|
@@ -2608,11 +2879,11 @@ case 90:
|
|
2608
2879
|
goto st0;
|
2609
2880
|
} else if ( (*p) > 90 ) {
|
2610
2881
|
if ( 97 <= (*p) && (*p) <= 122 )
|
2611
|
-
goto
|
2882
|
+
goto tr143;
|
2612
2883
|
} else
|
2613
|
-
goto
|
2884
|
+
goto tr143;
|
2614
2885
|
} else
|
2615
|
-
goto
|
2886
|
+
goto tr143;
|
2616
2887
|
goto st91;
|
2617
2888
|
st91:
|
2618
2889
|
if ( ++p == pe )
|
@@ -2660,18 +2931,18 @@ case 93:
|
|
2660
2931
|
} else
|
2661
2932
|
goto st91;
|
2662
2933
|
goto st0;
|
2663
|
-
|
2664
|
-
#line
|
2934
|
+
tr143:
|
2935
|
+
#line 327 "unicorn_http.rl"
|
2665
2936
|
{MARK(mark, p); }
|
2666
2937
|
goto st94;
|
2667
2938
|
st94:
|
2668
2939
|
if ( ++p == pe )
|
2669
2940
|
goto _test_eof94;
|
2670
2941
|
case 94:
|
2671
|
-
#line
|
2942
|
+
#line 2943 "unicorn_http.c"
|
2672
2943
|
switch( (*p) ) {
|
2673
2944
|
case 37: goto st92;
|
2674
|
-
case 47: goto
|
2945
|
+
case 47: goto tr147;
|
2675
2946
|
case 58: goto st95;
|
2676
2947
|
case 60: goto st0;
|
2677
2948
|
case 64: goto st90;
|
@@ -2702,7 +2973,7 @@ st95:
|
|
2702
2973
|
case 95:
|
2703
2974
|
switch( (*p) ) {
|
2704
2975
|
case 37: goto st92;
|
2705
|
-
case 47: goto
|
2976
|
+
case 47: goto tr147;
|
2706
2977
|
case 60: goto st0;
|
2707
2978
|
case 64: goto st90;
|
2708
2979
|
case 127: goto st0;
|
@@ -2719,15 +2990,15 @@ case 95:
|
|
2719
2990
|
} else
|
2720
2991
|
goto st0;
|
2721
2992
|
goto st91;
|
2722
|
-
|
2723
|
-
#line
|
2993
|
+
tr144:
|
2994
|
+
#line 327 "unicorn_http.rl"
|
2724
2995
|
{MARK(mark, p); }
|
2725
2996
|
goto st96;
|
2726
2997
|
st96:
|
2727
2998
|
if ( ++p == pe )
|
2728
2999
|
goto _test_eof96;
|
2729
3000
|
case 96:
|
2730
|
-
#line
|
3001
|
+
#line 3002 "unicorn_http.c"
|
2731
3002
|
switch( (*p) ) {
|
2732
3003
|
case 37: goto st92;
|
2733
3004
|
case 47: goto st0;
|
@@ -2789,7 +3060,7 @@ st98:
|
|
2789
3060
|
case 98:
|
2790
3061
|
switch( (*p) ) {
|
2791
3062
|
case 37: goto st92;
|
2792
|
-
case 47: goto
|
3063
|
+
case 47: goto tr147;
|
2793
3064
|
case 58: goto st95;
|
2794
3065
|
case 60: goto st0;
|
2795
3066
|
case 64: goto st90;
|
@@ -2804,35 +3075,35 @@ case 98:
|
|
2804
3075
|
} else
|
2805
3076
|
goto st0;
|
2806
3077
|
goto st91;
|
2807
|
-
|
2808
|
-
#line
|
3078
|
+
tr138:
|
3079
|
+
#line 331 "unicorn_http.rl"
|
2809
3080
|
{ downcase_char(deconst(p)); }
|
2810
3081
|
goto st99;
|
2811
3082
|
st99:
|
2812
3083
|
if ( ++p == pe )
|
2813
3084
|
goto _test_eof99;
|
2814
3085
|
case 99:
|
2815
|
-
#line
|
3086
|
+
#line 3087 "unicorn_http.c"
|
2816
3087
|
if ( (*p) == 58 )
|
2817
|
-
goto
|
3088
|
+
goto tr137;
|
2818
3089
|
goto st0;
|
2819
3090
|
st100:
|
2820
3091
|
if ( ++p == pe )
|
2821
3092
|
goto _test_eof100;
|
2822
3093
|
case 100:
|
2823
3094
|
if ( (*p) == 48 )
|
2824
|
-
goto
|
3095
|
+
goto tr151;
|
2825
3096
|
if ( (*p) < 65 ) {
|
2826
3097
|
if ( 49 <= (*p) && (*p) <= 57 )
|
2827
|
-
goto
|
3098
|
+
goto tr152;
|
2828
3099
|
} else if ( (*p) > 70 ) {
|
2829
3100
|
if ( 97 <= (*p) && (*p) <= 102 )
|
2830
|
-
goto
|
3101
|
+
goto tr152;
|
2831
3102
|
} else
|
2832
|
-
goto
|
3103
|
+
goto tr152;
|
2833
3104
|
goto st0;
|
2834
|
-
|
2835
|
-
#line
|
3105
|
+
tr151:
|
3106
|
+
#line 376 "unicorn_http.rl"
|
2836
3107
|
{
|
2837
3108
|
hp->len.chunk = step_incr(hp->len.chunk, (*p), 16);
|
2838
3109
|
if (hp->len.chunk < 0)
|
@@ -2843,30 +3114,24 @@ st101:
|
|
2843
3114
|
if ( ++p == pe )
|
2844
3115
|
goto _test_eof101;
|
2845
3116
|
case 101:
|
2846
|
-
#line
|
3117
|
+
#line 3118 "unicorn_http.c"
|
2847
3118
|
switch( (*p) ) {
|
3119
|
+
case 10: goto tr153;
|
2848
3120
|
case 13: goto st102;
|
2849
|
-
case 48: goto
|
3121
|
+
case 48: goto tr151;
|
2850
3122
|
case 59: goto st111;
|
2851
3123
|
}
|
2852
3124
|
if ( (*p) < 65 ) {
|
2853
3125
|
if ( 49 <= (*p) && (*p) <= 57 )
|
2854
|
-
goto
|
3126
|
+
goto tr152;
|
2855
3127
|
} else if ( (*p) > 70 ) {
|
2856
3128
|
if ( 97 <= (*p) && (*p) <= 102 )
|
2857
|
-
goto
|
3129
|
+
goto tr152;
|
2858
3130
|
} else
|
2859
|
-
goto
|
2860
|
-
goto st0;
|
2861
|
-
st102:
|
2862
|
-
if ( ++p == pe )
|
2863
|
-
goto _test_eof102;
|
2864
|
-
case 102:
|
2865
|
-
if ( (*p) == 10 )
|
2866
|
-
goto tr144;
|
3131
|
+
goto tr152;
|
2867
3132
|
goto st0;
|
2868
|
-
|
2869
|
-
#line
|
3133
|
+
tr153:
|
3134
|
+
#line 405 "unicorn_http.rl"
|
2870
3135
|
{
|
2871
3136
|
HP_FL_SET(hp, INTRAILER);
|
2872
3137
|
cs = http_parser_en_Trailers;
|
@@ -2879,10 +3144,17 @@ st123:
|
|
2879
3144
|
if ( ++p == pe )
|
2880
3145
|
goto _test_eof123;
|
2881
3146
|
case 123:
|
2882
|
-
#line
|
3147
|
+
#line 3148 "unicorn_http.c"
|
3148
|
+
goto st0;
|
3149
|
+
st102:
|
3150
|
+
if ( ++p == pe )
|
3151
|
+
goto _test_eof102;
|
3152
|
+
case 102:
|
3153
|
+
if ( (*p) == 10 )
|
3154
|
+
goto tr153;
|
2883
3155
|
goto st0;
|
2884
|
-
|
2885
|
-
#line
|
3156
|
+
tr152:
|
3157
|
+
#line 376 "unicorn_http.rl"
|
2886
3158
|
{
|
2887
3159
|
hp->len.chunk = step_incr(hp->len.chunk, (*p), 16);
|
2888
3160
|
if (hp->len.chunk < 0)
|
@@ -2893,34 +3165,28 @@ st103:
|
|
2893
3165
|
if ( ++p == pe )
|
2894
3166
|
goto _test_eof103;
|
2895
3167
|
case 103:
|
2896
|
-
#line
|
3168
|
+
#line 3169 "unicorn_http.c"
|
2897
3169
|
switch( (*p) ) {
|
2898
|
-
case
|
3170
|
+
case 10: goto st104;
|
3171
|
+
case 13: goto st107;
|
2899
3172
|
case 59: goto st108;
|
2900
3173
|
}
|
2901
3174
|
if ( (*p) < 65 ) {
|
2902
3175
|
if ( 48 <= (*p) && (*p) <= 57 )
|
2903
|
-
goto
|
3176
|
+
goto tr152;
|
2904
3177
|
} else if ( (*p) > 70 ) {
|
2905
3178
|
if ( 97 <= (*p) && (*p) <= 102 )
|
2906
|
-
goto
|
3179
|
+
goto tr152;
|
2907
3180
|
} else
|
2908
|
-
goto
|
3181
|
+
goto tr152;
|
2909
3182
|
goto st0;
|
2910
3183
|
st104:
|
2911
3184
|
if ( ++p == pe )
|
2912
3185
|
goto _test_eof104;
|
2913
3186
|
case 104:
|
2914
|
-
|
2915
|
-
|
2916
|
-
|
2917
|
-
st105:
|
2918
|
-
if ( ++p == pe )
|
2919
|
-
goto _test_eof105;
|
2920
|
-
case 105:
|
2921
|
-
goto tr148;
|
2922
|
-
tr148:
|
2923
|
-
#line 405 "unicorn_http.rl"
|
3187
|
+
goto tr159;
|
3188
|
+
tr159:
|
3189
|
+
#line 413 "unicorn_http.rl"
|
2924
3190
|
{
|
2925
3191
|
skip_chunk_data_hack: {
|
2926
3192
|
size_t nr = MIN((size_t)hp->len.chunk, REMAINING);
|
@@ -2934,31 +3200,41 @@ tr148:
|
|
2934
3200
|
goto post_exec;
|
2935
3201
|
} else {
|
2936
3202
|
p--;
|
2937
|
-
{goto
|
3203
|
+
{goto st105;}
|
2938
3204
|
}
|
2939
3205
|
}}
|
2940
|
-
goto
|
3206
|
+
goto st105;
|
3207
|
+
st105:
|
3208
|
+
if ( ++p == pe )
|
3209
|
+
goto _test_eof105;
|
3210
|
+
case 105:
|
3211
|
+
#line 3212 "unicorn_http.c"
|
3212
|
+
switch( (*p) ) {
|
3213
|
+
case 10: goto st100;
|
3214
|
+
case 13: goto st106;
|
3215
|
+
}
|
3216
|
+
goto st0;
|
2941
3217
|
st106:
|
2942
3218
|
if ( ++p == pe )
|
2943
3219
|
goto _test_eof106;
|
2944
3220
|
case 106:
|
2945
|
-
|
2946
|
-
|
2947
|
-
goto st107;
|
3221
|
+
if ( (*p) == 10 )
|
3222
|
+
goto st100;
|
2948
3223
|
goto st0;
|
2949
3224
|
st107:
|
2950
3225
|
if ( ++p == pe )
|
2951
3226
|
goto _test_eof107;
|
2952
3227
|
case 107:
|
2953
3228
|
if ( (*p) == 10 )
|
2954
|
-
goto
|
3229
|
+
goto st104;
|
2955
3230
|
goto st0;
|
2956
3231
|
st108:
|
2957
3232
|
if ( ++p == pe )
|
2958
3233
|
goto _test_eof108;
|
2959
3234
|
case 108:
|
2960
3235
|
switch( (*p) ) {
|
2961
|
-
case
|
3236
|
+
case 10: goto st104;
|
3237
|
+
case 13: goto st107;
|
2962
3238
|
case 32: goto st108;
|
2963
3239
|
case 33: goto st109;
|
2964
3240
|
case 59: goto st108;
|
@@ -2989,7 +3265,8 @@ st109:
|
|
2989
3265
|
goto _test_eof109;
|
2990
3266
|
case 109:
|
2991
3267
|
switch( (*p) ) {
|
2992
|
-
case
|
3268
|
+
case 10: goto st104;
|
3269
|
+
case 13: goto st107;
|
2993
3270
|
case 33: goto st109;
|
2994
3271
|
case 59: goto st108;
|
2995
3272
|
case 61: goto st110;
|
@@ -3019,7 +3296,8 @@ st110:
|
|
3019
3296
|
goto _test_eof110;
|
3020
3297
|
case 110:
|
3021
3298
|
switch( (*p) ) {
|
3022
|
-
case
|
3299
|
+
case 10: goto st104;
|
3300
|
+
case 13: goto st107;
|
3023
3301
|
case 33: goto st110;
|
3024
3302
|
case 59: goto st108;
|
3025
3303
|
case 124: goto st110;
|
@@ -3048,6 +3326,7 @@ st111:
|
|
3048
3326
|
goto _test_eof111;
|
3049
3327
|
case 111:
|
3050
3328
|
switch( (*p) ) {
|
3329
|
+
case 10: goto tr153;
|
3051
3330
|
case 13: goto st102;
|
3052
3331
|
case 32: goto st111;
|
3053
3332
|
case 33: goto st112;
|
@@ -3079,6 +3358,7 @@ st112:
|
|
3079
3358
|
goto _test_eof112;
|
3080
3359
|
case 112:
|
3081
3360
|
switch( (*p) ) {
|
3361
|
+
case 10: goto tr153;
|
3082
3362
|
case 13: goto st102;
|
3083
3363
|
case 33: goto st112;
|
3084
3364
|
case 59: goto st111;
|
@@ -3109,6 +3389,7 @@ st113:
|
|
3109
3389
|
goto _test_eof113;
|
3110
3390
|
case 113:
|
3111
3391
|
switch( (*p) ) {
|
3392
|
+
case 10: goto tr153;
|
3112
3393
|
case 13: goto st102;
|
3113
3394
|
case 33: goto st113;
|
3114
3395
|
case 59: goto st111;
|
@@ -3133,110 +3414,127 @@ case 113:
|
|
3133
3414
|
} else
|
3134
3415
|
goto st113;
|
3135
3416
|
goto st0;
|
3417
|
+
tr172:
|
3418
|
+
#line 333 "unicorn_http.rl"
|
3419
|
+
{ MARK(mark, p); }
|
3420
|
+
#line 335 "unicorn_http.rl"
|
3421
|
+
{ write_cont_value(hp, buffer, p); }
|
3422
|
+
goto st114;
|
3423
|
+
tr175:
|
3424
|
+
#line 335 "unicorn_http.rl"
|
3425
|
+
{ write_cont_value(hp, buffer, p); }
|
3426
|
+
goto st114;
|
3427
|
+
tr182:
|
3428
|
+
#line 333 "unicorn_http.rl"
|
3429
|
+
{ MARK(mark, p); }
|
3430
|
+
#line 334 "unicorn_http.rl"
|
3431
|
+
{ write_value(hp, buffer, p); }
|
3432
|
+
goto st114;
|
3433
|
+
tr185:
|
3434
|
+
#line 334 "unicorn_http.rl"
|
3435
|
+
{ write_value(hp, buffer, p); }
|
3436
|
+
goto st114;
|
3136
3437
|
st114:
|
3137
3438
|
if ( ++p == pe )
|
3138
3439
|
goto _test_eof114;
|
3139
3440
|
case 114:
|
3441
|
+
#line 3442 "unicorn_http.c"
|
3140
3442
|
switch( (*p) ) {
|
3141
3443
|
case 9: goto st115;
|
3444
|
+
case 10: goto tr167;
|
3142
3445
|
case 13: goto st118;
|
3143
3446
|
case 32: goto st115;
|
3144
|
-
case 33: goto
|
3145
|
-
case 124: goto
|
3146
|
-
case 126: goto
|
3447
|
+
case 33: goto tr169;
|
3448
|
+
case 124: goto tr169;
|
3449
|
+
case 126: goto tr169;
|
3147
3450
|
}
|
3148
3451
|
if ( (*p) < 45 ) {
|
3149
3452
|
if ( (*p) > 39 ) {
|
3150
3453
|
if ( 42 <= (*p) && (*p) <= 43 )
|
3151
|
-
goto
|
3454
|
+
goto tr169;
|
3152
3455
|
} else if ( (*p) >= 35 )
|
3153
|
-
goto
|
3456
|
+
goto tr169;
|
3154
3457
|
} else if ( (*p) > 46 ) {
|
3155
3458
|
if ( (*p) < 65 ) {
|
3156
3459
|
if ( 48 <= (*p) && (*p) <= 57 )
|
3157
|
-
goto
|
3460
|
+
goto tr169;
|
3158
3461
|
} else if ( (*p) > 90 ) {
|
3159
3462
|
if ( 94 <= (*p) && (*p) <= 122 )
|
3160
|
-
goto
|
3463
|
+
goto tr169;
|
3161
3464
|
} else
|
3162
|
-
goto
|
3465
|
+
goto tr169;
|
3163
3466
|
} else
|
3164
|
-
goto
|
3467
|
+
goto tr169;
|
3165
3468
|
goto st0;
|
3166
|
-
|
3167
|
-
#line
|
3469
|
+
tr171:
|
3470
|
+
#line 333 "unicorn_http.rl"
|
3168
3471
|
{ MARK(mark, p); }
|
3169
3472
|
goto st115;
|
3170
3473
|
st115:
|
3171
3474
|
if ( ++p == pe )
|
3172
3475
|
goto _test_eof115;
|
3173
3476
|
case 115:
|
3174
|
-
#line
|
3477
|
+
#line 3478 "unicorn_http.c"
|
3175
3478
|
switch( (*p) ) {
|
3176
|
-
case 9: goto
|
3177
|
-
case
|
3178
|
-
case
|
3479
|
+
case 9: goto tr171;
|
3480
|
+
case 10: goto tr172;
|
3481
|
+
case 13: goto tr173;
|
3482
|
+
case 32: goto tr171;
|
3179
3483
|
case 127: goto st0;
|
3180
3484
|
}
|
3181
3485
|
if ( 0 <= (*p) && (*p) <= 31 )
|
3182
3486
|
goto st0;
|
3183
|
-
goto
|
3184
|
-
|
3185
|
-
#line
|
3487
|
+
goto tr170;
|
3488
|
+
tr170:
|
3489
|
+
#line 333 "unicorn_http.rl"
|
3186
3490
|
{ MARK(mark, p); }
|
3187
3491
|
goto st116;
|
3188
3492
|
st116:
|
3189
3493
|
if ( ++p == pe )
|
3190
3494
|
goto _test_eof116;
|
3191
3495
|
case 116:
|
3192
|
-
#line
|
3496
|
+
#line 3497 "unicorn_http.c"
|
3193
3497
|
switch( (*p) ) {
|
3194
|
-
case
|
3498
|
+
case 10: goto tr175;
|
3499
|
+
case 13: goto tr176;
|
3195
3500
|
case 127: goto st0;
|
3196
3501
|
}
|
3197
3502
|
if ( (*p) > 8 ) {
|
3198
|
-
if (
|
3503
|
+
if ( 11 <= (*p) && (*p) <= 31 )
|
3199
3504
|
goto st0;
|
3200
3505
|
} else if ( (*p) >= 0 )
|
3201
3506
|
goto st0;
|
3202
3507
|
goto st116;
|
3203
|
-
|
3204
|
-
#line
|
3508
|
+
tr173:
|
3509
|
+
#line 333 "unicorn_http.rl"
|
3205
3510
|
{ MARK(mark, p); }
|
3206
|
-
#line
|
3511
|
+
#line 335 "unicorn_http.rl"
|
3207
3512
|
{ write_cont_value(hp, buffer, p); }
|
3208
3513
|
goto st117;
|
3209
|
-
|
3210
|
-
#line
|
3514
|
+
tr176:
|
3515
|
+
#line 335 "unicorn_http.rl"
|
3211
3516
|
{ write_cont_value(hp, buffer, p); }
|
3212
3517
|
goto st117;
|
3213
|
-
|
3214
|
-
#line
|
3518
|
+
tr183:
|
3519
|
+
#line 333 "unicorn_http.rl"
|
3215
3520
|
{ MARK(mark, p); }
|
3216
|
-
#line
|
3521
|
+
#line 334 "unicorn_http.rl"
|
3217
3522
|
{ write_value(hp, buffer, p); }
|
3218
3523
|
goto st117;
|
3219
|
-
|
3220
|
-
#line
|
3524
|
+
tr186:
|
3525
|
+
#line 334 "unicorn_http.rl"
|
3221
3526
|
{ write_value(hp, buffer, p); }
|
3222
3527
|
goto st117;
|
3223
3528
|
st117:
|
3224
3529
|
if ( ++p == pe )
|
3225
3530
|
goto _test_eof117;
|
3226
3531
|
case 117:
|
3227
|
-
#line
|
3532
|
+
#line 3533 "unicorn_http.c"
|
3228
3533
|
if ( (*p) == 10 )
|
3229
3534
|
goto st114;
|
3230
3535
|
goto st0;
|
3231
|
-
|
3232
|
-
|
3233
|
-
goto _test_eof118;
|
3234
|
-
case 118:
|
3235
|
-
if ( (*p) == 10 )
|
3236
|
-
goto tr164;
|
3237
|
-
goto st0;
|
3238
|
-
tr164:
|
3239
|
-
#line 392 "unicorn_http.rl"
|
3536
|
+
tr167:
|
3537
|
+
#line 400 "unicorn_http.rl"
|
3240
3538
|
{
|
3241
3539
|
cs = http_parser_first_final;
|
3242
3540
|
goto post_exec;
|
@@ -3246,84 +3544,93 @@ st124:
|
|
3246
3544
|
if ( ++p == pe )
|
3247
3545
|
goto _test_eof124;
|
3248
3546
|
case 124:
|
3249
|
-
#line
|
3547
|
+
#line 3548 "unicorn_http.c"
|
3548
|
+
goto st0;
|
3549
|
+
st118:
|
3550
|
+
if ( ++p == pe )
|
3551
|
+
goto _test_eof118;
|
3552
|
+
case 118:
|
3553
|
+
if ( (*p) == 10 )
|
3554
|
+
goto tr167;
|
3250
3555
|
goto st0;
|
3251
|
-
|
3252
|
-
#line
|
3556
|
+
tr169:
|
3557
|
+
#line 329 "unicorn_http.rl"
|
3253
3558
|
{ MARK(start.field, p); }
|
3254
|
-
#line
|
3559
|
+
#line 330 "unicorn_http.rl"
|
3255
3560
|
{ snake_upcase_char(deconst(p)); }
|
3256
3561
|
goto st119;
|
3257
|
-
|
3258
|
-
#line
|
3562
|
+
tr178:
|
3563
|
+
#line 330 "unicorn_http.rl"
|
3259
3564
|
{ snake_upcase_char(deconst(p)); }
|
3260
3565
|
goto st119;
|
3261
3566
|
st119:
|
3262
3567
|
if ( ++p == pe )
|
3263
3568
|
goto _test_eof119;
|
3264
3569
|
case 119:
|
3265
|
-
#line
|
3570
|
+
#line 3571 "unicorn_http.c"
|
3266
3571
|
switch( (*p) ) {
|
3267
|
-
case 33: goto
|
3268
|
-
case 58: goto
|
3269
|
-
case 124: goto
|
3270
|
-
case 126: goto
|
3572
|
+
case 33: goto tr178;
|
3573
|
+
case 58: goto tr179;
|
3574
|
+
case 124: goto tr178;
|
3575
|
+
case 126: goto tr178;
|
3271
3576
|
}
|
3272
3577
|
if ( (*p) < 45 ) {
|
3273
3578
|
if ( (*p) > 39 ) {
|
3274
3579
|
if ( 42 <= (*p) && (*p) <= 43 )
|
3275
|
-
goto
|
3580
|
+
goto tr178;
|
3276
3581
|
} else if ( (*p) >= 35 )
|
3277
|
-
goto
|
3582
|
+
goto tr178;
|
3278
3583
|
} else if ( (*p) > 46 ) {
|
3279
3584
|
if ( (*p) < 65 ) {
|
3280
3585
|
if ( 48 <= (*p) && (*p) <= 57 )
|
3281
|
-
goto
|
3586
|
+
goto tr178;
|
3282
3587
|
} else if ( (*p) > 90 ) {
|
3283
3588
|
if ( 94 <= (*p) && (*p) <= 122 )
|
3284
|
-
goto
|
3589
|
+
goto tr178;
|
3285
3590
|
} else
|
3286
|
-
goto
|
3591
|
+
goto tr178;
|
3287
3592
|
} else
|
3288
|
-
goto
|
3593
|
+
goto tr178;
|
3289
3594
|
goto st0;
|
3290
|
-
|
3291
|
-
#line
|
3595
|
+
tr181:
|
3596
|
+
#line 333 "unicorn_http.rl"
|
3292
3597
|
{ MARK(mark, p); }
|
3293
3598
|
goto st120;
|
3294
|
-
|
3295
|
-
#line
|
3599
|
+
tr179:
|
3600
|
+
#line 332 "unicorn_http.rl"
|
3296
3601
|
{ hp->s.field_len = LEN(start.field, p); }
|
3297
3602
|
goto st120;
|
3298
3603
|
st120:
|
3299
3604
|
if ( ++p == pe )
|
3300
3605
|
goto _test_eof120;
|
3301
3606
|
case 120:
|
3302
|
-
#line
|
3607
|
+
#line 3608 "unicorn_http.c"
|
3303
3608
|
switch( (*p) ) {
|
3304
|
-
case 9: goto
|
3305
|
-
case
|
3306
|
-
case
|
3609
|
+
case 9: goto tr181;
|
3610
|
+
case 10: goto tr182;
|
3611
|
+
case 13: goto tr183;
|
3612
|
+
case 32: goto tr181;
|
3307
3613
|
case 127: goto st0;
|
3308
3614
|
}
|
3309
3615
|
if ( 0 <= (*p) && (*p) <= 31 )
|
3310
3616
|
goto st0;
|
3311
|
-
goto
|
3312
|
-
|
3313
|
-
#line
|
3617
|
+
goto tr180;
|
3618
|
+
tr180:
|
3619
|
+
#line 333 "unicorn_http.rl"
|
3314
3620
|
{ MARK(mark, p); }
|
3315
3621
|
goto st121;
|
3316
3622
|
st121:
|
3317
3623
|
if ( ++p == pe )
|
3318
3624
|
goto _test_eof121;
|
3319
3625
|
case 121:
|
3320
|
-
#line
|
3626
|
+
#line 3627 "unicorn_http.c"
|
3321
3627
|
switch( (*p) ) {
|
3322
|
-
case
|
3628
|
+
case 10: goto tr185;
|
3629
|
+
case 13: goto tr186;
|
3323
3630
|
case 127: goto st0;
|
3324
3631
|
}
|
3325
3632
|
if ( (*p) > 8 ) {
|
3326
|
-
if (
|
3633
|
+
if ( 11 <= (*p) && (*p) <= 31 )
|
3327
3634
|
goto st0;
|
3328
3635
|
} else if ( (*p) >= 0 )
|
3329
3636
|
goto st0;
|
@@ -3345,8 +3652,8 @@ case 121:
|
|
3345
3652
|
_test_eof15: cs = 15; goto _test_eof;
|
3346
3653
|
_test_eof16: cs = 16; goto _test_eof;
|
3347
3654
|
_test_eof17: cs = 17; goto _test_eof;
|
3348
|
-
_test_eof18: cs = 18; goto _test_eof;
|
3349
3655
|
_test_eof122: cs = 122; goto _test_eof;
|
3656
|
+
_test_eof18: cs = 18; goto _test_eof;
|
3350
3657
|
_test_eof19: cs = 19; goto _test_eof;
|
3351
3658
|
_test_eof20: cs = 20; goto _test_eof;
|
3352
3659
|
_test_eof21: cs = 21; goto _test_eof;
|
@@ -3430,8 +3737,8 @@ case 121:
|
|
3430
3737
|
_test_eof99: cs = 99; goto _test_eof;
|
3431
3738
|
_test_eof100: cs = 100; goto _test_eof;
|
3432
3739
|
_test_eof101: cs = 101; goto _test_eof;
|
3433
|
-
_test_eof102: cs = 102; goto _test_eof;
|
3434
3740
|
_test_eof123: cs = 123; goto _test_eof;
|
3741
|
+
_test_eof102: cs = 102; goto _test_eof;
|
3435
3742
|
_test_eof103: cs = 103; goto _test_eof;
|
3436
3743
|
_test_eof104: cs = 104; goto _test_eof;
|
3437
3744
|
_test_eof105: cs = 105; goto _test_eof;
|
@@ -3447,8 +3754,8 @@ case 121:
|
|
3447
3754
|
_test_eof115: cs = 115; goto _test_eof;
|
3448
3755
|
_test_eof116: cs = 116; goto _test_eof;
|
3449
3756
|
_test_eof117: cs = 117; goto _test_eof;
|
3450
|
-
_test_eof118: cs = 118; goto _test_eof;
|
3451
3757
|
_test_eof124: cs = 124; goto _test_eof;
|
3758
|
+
_test_eof118: cs = 118; goto _test_eof;
|
3452
3759
|
_test_eof119: cs = 119; goto _test_eof;
|
3453
3760
|
_test_eof120: cs = 120; goto _test_eof;
|
3454
3761
|
_test_eof121: cs = 121; goto _test_eof;
|
@@ -3457,21 +3764,41 @@ case 121:
|
|
3457
3764
|
_out: {}
|
3458
3765
|
}
|
3459
3766
|
|
3460
|
-
#line
|
3767
|
+
#line 474 "unicorn_http.rl"
|
3461
3768
|
post_exec: /* "_out:" also goes here */
|
3462
3769
|
if (hp->cs != http_parser_error)
|
3463
3770
|
hp->cs = cs;
|
3464
|
-
hp->offset = p - buffer;
|
3771
|
+
hp->offset = ulong2uint(p - buffer);
|
3465
3772
|
|
3466
3773
|
assert(p <= pe && "buffer overflow after parsing execute");
|
3467
3774
|
assert(hp->offset <= len && "offset longer than length");
|
3468
3775
|
}
|
3469
3776
|
|
3777
|
+
static void hp_mark(void *ptr)
|
3778
|
+
{
|
3779
|
+
struct http_parser *hp = ptr;
|
3780
|
+
|
3781
|
+
rb_gc_mark(hp->buf);
|
3782
|
+
rb_gc_mark(hp->env);
|
3783
|
+
rb_gc_mark(hp->cont);
|
3784
|
+
}
|
3785
|
+
|
3786
|
+
static size_t hp_memsize(const void *ptr)
|
3787
|
+
{
|
3788
|
+
return sizeof(struct http_parser);
|
3789
|
+
}
|
3790
|
+
|
3791
|
+
static const rb_data_type_t hp_type = {
|
3792
|
+
"unicorn_http",
|
3793
|
+
{ hp_mark, RUBY_TYPED_DEFAULT_FREE, hp_memsize, /* reserved */ },
|
3794
|
+
/* parent, data, [ flags ] */
|
3795
|
+
};
|
3796
|
+
|
3470
3797
|
static struct http_parser *data_get(VALUE self)
|
3471
3798
|
{
|
3472
3799
|
struct http_parser *hp;
|
3473
3800
|
|
3474
|
-
|
3801
|
+
TypedData_Get_Struct(self, struct http_parser, &hp_type, hp);
|
3475
3802
|
assert(hp && "failed to extract http_parser struct");
|
3476
3803
|
return hp;
|
3477
3804
|
}
|
@@ -3486,26 +3813,29 @@ static void set_url_scheme(VALUE env, VALUE *server_port)
|
|
3486
3813
|
VALUE scheme = rb_hash_aref(env, g_rack_url_scheme);
|
3487
3814
|
|
3488
3815
|
if (NIL_P(scheme)) {
|
3489
|
-
|
3490
|
-
|
3816
|
+
/*
|
3817
|
+
* would anybody be horribly opposed to removing the X-Forwarded-SSL
|
3818
|
+
* and X-Forwarded-Proto handling from this parser? We've had it
|
3819
|
+
* forever and nobody has said anything against it, either.
|
3820
|
+
* Anyways, please send comments to our public mailing list:
|
3821
|
+
* unicorn-public@yhbt.net (no HTML mail, no subscription necessary)
|
3822
|
+
*/
|
3823
|
+
scheme = rb_hash_aref(env, g_http_x_forwarded_ssl);
|
3824
|
+
if (!NIL_P(scheme) && STR_CSTR_EQ(scheme, "on")) {
|
3825
|
+
*server_port = g_port_443;
|
3826
|
+
scheme = g_https;
|
3491
3827
|
} else {
|
3492
|
-
scheme = rb_hash_aref(env,
|
3493
|
-
if (
|
3494
|
-
|
3495
|
-
scheme = g_https;
|
3828
|
+
scheme = rb_hash_aref(env, g_http_x_forwarded_proto);
|
3829
|
+
if (NIL_P(scheme)) {
|
3830
|
+
scheme = g_http;
|
3496
3831
|
} else {
|
3497
|
-
|
3498
|
-
if (
|
3499
|
-
|
3832
|
+
long len = RSTRING_LEN(scheme);
|
3833
|
+
if (len >= 5 && !memcmp(RSTRING_PTR(scheme), "https", 5)) {
|
3834
|
+
if (len != 5)
|
3835
|
+
scheme = g_https;
|
3836
|
+
*server_port = g_port_443;
|
3500
3837
|
} else {
|
3501
|
-
|
3502
|
-
if (len >= 5 && !memcmp(RSTRING_PTR(scheme), "https", 5)) {
|
3503
|
-
if (len != 5)
|
3504
|
-
scheme = g_https;
|
3505
|
-
*server_port = g_port_443;
|
3506
|
-
} else {
|
3507
|
-
scheme = g_http;
|
3508
|
-
}
|
3838
|
+
scheme = g_http;
|
3509
3839
|
}
|
3510
3840
|
}
|
3511
3841
|
}
|
@@ -3574,21 +3904,12 @@ static void finalize_header(struct http_parser *hp)
|
|
3574
3904
|
rb_hash_aset(hp->env, g_query_string, rb_str_new(NULL, 0));
|
3575
3905
|
}
|
3576
3906
|
|
3577
|
-
static void hp_mark(void *ptr)
|
3578
|
-
{
|
3579
|
-
struct http_parser *hp = ptr;
|
3580
|
-
|
3581
|
-
rb_gc_mark(hp->buf);
|
3582
|
-
rb_gc_mark(hp->env);
|
3583
|
-
rb_gc_mark(hp->cont);
|
3584
|
-
}
|
3585
|
-
|
3586
3907
|
static VALUE HttpParser_alloc(VALUE klass)
|
3587
3908
|
{
|
3588
3909
|
struct http_parser *hp;
|
3589
|
-
return Data_Make_Struct(klass, struct http_parser, hp_mark, -1, hp);
|
3590
|
-
}
|
3591
3910
|
|
3911
|
+
return TypedData_Make_Struct(klass, struct http_parser, &hp_type, hp);
|
3912
|
+
}
|
3592
3913
|
|
3593
3914
|
/**
|
3594
3915
|
* call-seq:
|
@@ -3603,7 +3924,6 @@ static VALUE HttpParser_init(VALUE self)
|
|
3603
3924
|
http_parser_init(hp);
|
3604
3925
|
hp->buf = rb_str_new(NULL, 0);
|
3605
3926
|
hp->env = rb_hash_new();
|
3606
|
-
hp->nr_requests = keepalive_requests;
|
3607
3927
|
|
3608
3928
|
return self;
|
3609
3929
|
}
|
@@ -3619,62 +3939,16 @@ static VALUE HttpParser_clear(VALUE self)
|
|
3619
3939
|
{
|
3620
3940
|
struct http_parser *hp = data_get(self);
|
3621
3941
|
|
3622
|
-
|
3623
|
-
|
3624
|
-
|
3625
|
-
|
3626
|
-
return self;
|
3627
|
-
}
|
3628
|
-
|
3629
|
-
/**
|
3630
|
-
* call-seq:
|
3631
|
-
* parser.dechunk! => parser
|
3632
|
-
*
|
3633
|
-
* Resets the parser to a state suitable for dechunking response bodies
|
3634
|
-
*
|
3635
|
-
*/
|
3636
|
-
static VALUE HttpParser_dechunk_bang(VALUE self)
|
3637
|
-
{
|
3638
|
-
struct http_parser *hp = data_get(self);
|
3942
|
+
/* we can't safely reuse .buf and .env if hijacked */
|
3943
|
+
if (HP_FL_TEST(hp, HIJACK))
|
3944
|
+
return HttpParser_init(self);
|
3639
3945
|
|
3640
3946
|
http_parser_init(hp);
|
3641
|
-
|
3642
|
-
/*
|
3643
|
-
* we don't care about trailers in dechunk-only mode,
|
3644
|
-
* but if we did we'd set UH_FL_HASTRAILER and clear hp->env
|
3645
|
-
*/
|
3646
|
-
if (0) {
|
3647
|
-
rb_funcall(hp->env, id_clear, 0);
|
3648
|
-
hp->flags = UH_FL_HASTRAILER;
|
3649
|
-
}
|
3650
|
-
|
3651
|
-
hp->flags |= UH_FL_HASBODY | UH_FL_INBODY | UH_FL_CHUNKED;
|
3652
|
-
hp->cs = http_parser_en_ChunkedBody;
|
3947
|
+
my_hash_clear(hp->env);
|
3653
3948
|
|
3654
3949
|
return self;
|
3655
3950
|
}
|
3656
3951
|
|
3657
|
-
/**
|
3658
|
-
* call-seq:
|
3659
|
-
* parser.reset => nil
|
3660
|
-
*
|
3661
|
-
* Resets the parser to it's initial state so that you can reuse it
|
3662
|
-
* rather than making new ones.
|
3663
|
-
*
|
3664
|
-
* This method is deprecated and to be removed in Unicorn 4.x
|
3665
|
-
*/
|
3666
|
-
static VALUE HttpParser_reset(VALUE self)
|
3667
|
-
{
|
3668
|
-
static int warned;
|
3669
|
-
|
3670
|
-
if (!warned) {
|
3671
|
-
rb_warn("Unicorn::HttpParser#reset is deprecated; "
|
3672
|
-
"use Unicorn::HttpParser#clear instead");
|
3673
|
-
}
|
3674
|
-
HttpParser_clear(self);
|
3675
|
-
return Qnil;
|
3676
|
-
}
|
3677
|
-
|
3678
3952
|
static void advance_str(VALUE str, off_t nr)
|
3679
3953
|
{
|
3680
3954
|
long len = RSTRING_LEN(str);
|
@@ -3837,15 +4111,13 @@ static VALUE HttpParser_keepalive(VALUE self)
|
|
3837
4111
|
* parser.next? => true or false
|
3838
4112
|
*
|
3839
4113
|
* Exactly like HttpParser#keepalive?, except it will reset the internal
|
3840
|
-
* parser state on next parse if it returns true.
|
3841
|
-
* the maximum *keepalive_requests* value and return false if that is
|
3842
|
-
* reached.
|
4114
|
+
* parser state on next parse if it returns true.
|
3843
4115
|
*/
|
3844
4116
|
static VALUE HttpParser_next(VALUE self)
|
3845
4117
|
{
|
3846
4118
|
struct http_parser *hp = data_get(self);
|
3847
4119
|
|
3848
|
-
if (
|
4120
|
+
if (HP_FL_ALL(hp, KEEPALIVE)) {
|
3849
4121
|
HP_FL_SET(hp, TO_CLEAR);
|
3850
4122
|
return Qtrue;
|
3851
4123
|
}
|
@@ -3877,6 +4149,15 @@ static VALUE HttpParser_env(VALUE self)
|
|
3877
4149
|
return data_get(self)->env;
|
3878
4150
|
}
|
3879
4151
|
|
4152
|
+
static VALUE HttpParser_hijacked_bang(VALUE self)
|
4153
|
+
{
|
4154
|
+
struct http_parser *hp = data_get(self);
|
4155
|
+
|
4156
|
+
HP_FL_SET(hp, HIJACK);
|
4157
|
+
|
4158
|
+
return self;
|
4159
|
+
}
|
4160
|
+
|
3880
4161
|
/**
|
3881
4162
|
* call-seq:
|
3882
4163
|
* parser.filter_body(dst, src) => nil/src
|
@@ -3955,6 +4236,25 @@ static VALUE HttpParser_filter_body(VALUE self, VALUE dst, VALUE src)
|
|
3955
4236
|
return src;
|
3956
4237
|
}
|
3957
4238
|
|
4239
|
+
static VALUE HttpParser_rssset(VALUE self, VALUE boolean)
|
4240
|
+
{
|
4241
|
+
struct http_parser *hp = data_get(self);
|
4242
|
+
|
4243
|
+
if (RTEST(boolean))
|
4244
|
+
HP_FL_SET(hp, RESSTART);
|
4245
|
+
else
|
4246
|
+
HP_FL_UNSET(hp, RESSTART);
|
4247
|
+
|
4248
|
+
return boolean; /* ignored by Ruby anyways */
|
4249
|
+
}
|
4250
|
+
|
4251
|
+
static VALUE HttpParser_rssget(VALUE self)
|
4252
|
+
{
|
4253
|
+
struct http_parser *hp = data_get(self);
|
4254
|
+
|
4255
|
+
return HP_FL_TEST(hp, RESSTART) ? Qtrue : Qfalse;
|
4256
|
+
}
|
4257
|
+
|
3958
4258
|
#define SET_GLOBAL(var,str) do { \
|
3959
4259
|
var = find_common_field(str, sizeof(str) - 1); \
|
3960
4260
|
assert(!NIL_P(var) && "missed global field"); \
|
@@ -3962,9 +4262,9 @@ static VALUE HttpParser_filter_body(VALUE self, VALUE dst, VALUE src)
|
|
3962
4262
|
|
3963
4263
|
void Init_unicorn_http(void)
|
3964
4264
|
{
|
3965
|
-
VALUE mUnicorn
|
4265
|
+
VALUE mUnicorn;
|
3966
4266
|
|
3967
|
-
mUnicorn =
|
4267
|
+
mUnicorn = rb_define_module("Unicorn");
|
3968
4268
|
cHttpParser = rb_define_class_under(mUnicorn, "HttpParser", rb_cObject);
|
3969
4269
|
eHttpParserError =
|
3970
4270
|
rb_define_class_under(mUnicorn, "HttpParserError", rb_eIOError);
|
@@ -3977,8 +4277,6 @@ void Init_unicorn_http(void)
|
|
3977
4277
|
rb_define_alloc_func(cHttpParser, HttpParser_alloc);
|
3978
4278
|
rb_define_method(cHttpParser, "initialize", HttpParser_init, 0);
|
3979
4279
|
rb_define_method(cHttpParser, "clear", HttpParser_clear, 0);
|
3980
|
-
rb_define_method(cHttpParser, "reset", HttpParser_reset, 0);
|
3981
|
-
rb_define_method(cHttpParser, "dechunk!", HttpParser_dechunk_bang, 0);
|
3982
4280
|
rb_define_method(cHttpParser, "parse", HttpParser_parse, 0);
|
3983
4281
|
rb_define_method(cHttpParser, "add_parse", HttpParser_add_parse, 1);
|
3984
4282
|
rb_define_method(cHttpParser, "headers", HttpParser_headers, 2);
|
@@ -3991,6 +4289,9 @@ void Init_unicorn_http(void)
|
|
3991
4289
|
rb_define_method(cHttpParser, "next?", HttpParser_next, 0);
|
3992
4290
|
rb_define_method(cHttpParser, "buf", HttpParser_buf, 0);
|
3993
4291
|
rb_define_method(cHttpParser, "env", HttpParser_env, 0);
|
4292
|
+
rb_define_method(cHttpParser, "hijacked!", HttpParser_hijacked_bang, 0);
|
4293
|
+
rb_define_method(cHttpParser, "response_start_sent=", HttpParser_rssset, 1);
|
4294
|
+
rb_define_method(cHttpParser, "response_start_sent", HttpParser_rssget, 0);
|
3994
4295
|
|
3995
4296
|
/*
|
3996
4297
|
* The maximum size a single chunk when using chunked transfer encoding.
|
@@ -4007,14 +4308,6 @@ void Init_unicorn_http(void)
|
|
4007
4308
|
*/
|
4008
4309
|
rb_define_const(cHttpParser, "LENGTH_MAX", OFFT2NUM(UH_OFF_T_MAX));
|
4009
4310
|
|
4010
|
-
/* default value for keepalive_requests */
|
4011
|
-
rb_define_const(cHttpParser, "KEEPALIVE_REQUESTS_DEFAULT",
|
4012
|
-
ULONG2NUM(keepalive_requests));
|
4013
|
-
|
4014
|
-
rb_define_singleton_method(cHttpParser, "keepalive_requests", ka_req, 0);
|
4015
|
-
rb_define_singleton_method(cHttpParser, "keepalive_requests=", set_ka_req, 1);
|
4016
|
-
rb_define_singleton_method(cHttpParser, "trust_x_forwarded=", set_xftrust, 1);
|
4017
|
-
rb_define_singleton_method(cHttpParser, "trust_x_forwarded?", xftrust, 0);
|
4018
4311
|
rb_define_singleton_method(cHttpParser, "max_header_len=", set_maxhdrlen, 1);
|
4019
4312
|
|
4020
4313
|
init_common_fields();
|
@@ -4023,9 +4316,12 @@ void Init_unicorn_http(void)
|
|
4023
4316
|
SET_GLOBAL(g_http_transfer_encoding, "TRANSFER_ENCODING");
|
4024
4317
|
SET_GLOBAL(g_content_length, "CONTENT_LENGTH");
|
4025
4318
|
SET_GLOBAL(g_http_connection, "CONNECTION");
|
4026
|
-
id_clear = rb_intern("clear");
|
4027
4319
|
id_set_backtrace = rb_intern("set_backtrace");
|
4028
|
-
id_response_start_sent = rb_intern("@response_start_sent");
|
4029
4320
|
init_unicorn_httpdate();
|
4321
|
+
|
4322
|
+
#ifndef HAVE_RB_HASH_CLEAR
|
4323
|
+
id_clear = rb_intern("clear");
|
4324
|
+
#endif
|
4325
|
+
id_is_chunked_p = rb_intern("is_chunked?");
|
4030
4326
|
}
|
4031
4327
|
#undef SET_GLOBAL
|