From bd8aaa40c25581d4d08ef5eabf592ab29c13a6ae Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:31:06 +0200 Subject: [PATCH 1/2] Remove `HttpParser.max_header_len` Rainbows is unusable as is with `pitchfork`. One less test to port over --- ext/pitchfork_http/pitchfork_http.c | 428 +++++++++++------------ ext/pitchfork_http/pitchfork_http.rl | 8 - test/integration/t0019-max_header_len.sh | 49 --- test/unit/test_http_parser_ng.rb | 6 - 4 files changed, 210 insertions(+), 281 deletions(-) delete mode 100755 test/integration/t0019-max_header_len.sh diff --git a/ext/pitchfork_http/pitchfork_http.c b/ext/pitchfork_http/pitchfork_http.c index f35b53ab..e58e5071 100644 --- a/ext/pitchfork_http/pitchfork_http.c +++ b/ext/pitchfork_http/pitchfork_http.c @@ -38,12 +38,6 @@ void init_pitchfork_memory_page(VALUE); static unsigned int MAX_HEADER_LEN = 1024 * (80 + 32); /* same as Mongrel */ -/* this is only intended for use with Rainbows! */ -static VALUE set_maxhdrlen(VALUE self, VALUE len) -{ - return UINT2NUM(MAX_HEADER_LEN = NUM2UINT(len)); -} - /* keep this small for other servers (e.g. yahns) since every client has one */ struct http_parser { int cs; /* Ragel internal state */ @@ -315,12 +309,12 @@ static void write_value(VALUE self, struct http_parser *hp, /** Machine **/ -#line 416 "pitchfork_http.rl" +#line 410 "pitchfork_http.rl" /** Data **/ -#line 324 "pitchfork_http.c" +#line 318 "pitchfork_http.c" static const int http_parser_start = 1; static const int http_parser_first_final = 122; static const int http_parser_error = 0; @@ -331,7 +325,7 @@ static const int http_parser_en_Trailers = 114; static const int http_parser_en_main = 1; -#line 420 "pitchfork_http.rl" +#line 414 "pitchfork_http.rl" static void http_parser_init(struct http_parser *hp) { @@ -344,12 +338,12 @@ static void http_parser_init(struct http_parser *hp) hp->len.content = 0; hp->cont = Qfalse; /* zero on MRI, should be optimized away by above */ -#line 348 "pitchfork_http.c" +#line 342 "pitchfork_http.c" { cs = http_parser_start; } -#line 432 "pitchfork_http.rl" +#line 426 "pitchfork_http.rl" hp->cs = cs; } @@ -377,7 +371,7 @@ http_parser_execute(VALUE self, struct http_parser *hp, char *buffer, size_t len goto skip_chunk_data_hack; } -#line 381 "pitchfork_http.c" +#line 375 "pitchfork_http.c" { if ( p == pe ) goto _test_eof; @@ -412,14 +406,14 @@ case 1: cs = 0; goto _out; tr0: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st2; st2: if ( ++p == pe ) goto _test_eof2; case 2: -#line 423 "pitchfork_http.c" +#line 417 "pitchfork_http.c" switch( (*p) ) { case 32: goto tr3; case 33: goto st49; @@ -445,14 +439,14 @@ case 2: goto st49; goto st0; tr3: -#line 327 "pitchfork_http.rl" +#line 321 "pitchfork_http.rl" { request_method(hp, PTR_TO(mark), LEN(mark, p)); } goto st3; st3: if ( ++p == pe ) goto _test_eof3; case 3: -#line 456 "pitchfork_http.c" +#line 450 "pitchfork_http.c" switch( (*p) ) { case 42: goto tr5; case 47: goto tr6; @@ -461,30 +455,30 @@ case 3: } goto st0; tr5: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st4; st4: if ( ++p == pe ) goto _test_eof4; case 4: -#line 472 "pitchfork_http.c" +#line 466 "pitchfork_http.c" switch( (*p) ) { case 32: goto tr8; case 35: goto tr9; } goto st0; tr8: -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } goto st5; tr42: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } -#line 336 "pitchfork_http.rl" +#line 330 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT); VALUE str = rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p)); @@ -496,7 +490,7 @@ case 4: } goto st5; tr45: -#line 336 "pitchfork_http.rl" +#line 330 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT); VALUE str = rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p)); @@ -508,7 +502,7 @@ case 4: } goto st5; tr49: -#line 351 "pitchfork_http.rl" +#line 345 "pitchfork_http.rl" { VALUE val; @@ -519,33 +513,33 @@ case 4: if (!STR_CSTR_EQ(val, "*")) rb_hash_aset(hp->env, g_path_info, val); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } goto st5; tr55: -#line 345 "pitchfork_http.rl" +#line 339 "pitchfork_http.rl" {MARK(start.query, p); } -#line 346 "pitchfork_http.rl" +#line 340 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING); rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p)); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } goto st5; tr59: -#line 346 "pitchfork_http.rl" +#line 340 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING); rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p)); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); @@ -555,19 +549,19 @@ case 4: if ( ++p == pe ) goto _test_eof5; case 5: -#line 559 "pitchfork_http.c" +#line 553 "pitchfork_http.c" if ( (*p) == 72 ) goto tr10; goto st0; tr10: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st6; st6: if ( ++p == pe ) goto _test_eof6; case 6: -#line 571 "pitchfork_http.c" +#line 565 "pitchfork_http.c" if ( (*p) == 84 ) goto st7; goto st0; @@ -627,34 +621,34 @@ case 13: goto st13; goto st0; tr18: -#line 350 "pitchfork_http.rl" +#line 344 "pitchfork_http.rl" { http_version(hp, PTR_TO(mark), LEN(mark, p)); } goto st14; tr26: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } -#line 326 "pitchfork_http.rl" +#line 320 "pitchfork_http.rl" { write_cont_value(hp, buffer, p); } goto st14; tr29: -#line 326 "pitchfork_http.rl" +#line 320 "pitchfork_http.rl" { write_cont_value(hp, buffer, p); } goto st14; tr36: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } -#line 325 "pitchfork_http.rl" +#line 319 "pitchfork_http.rl" { write_value(self, hp, buffer, p); } goto st14; tr39: -#line 325 "pitchfork_http.rl" +#line 319 "pitchfork_http.rl" { write_value(self, hp, buffer, p); } goto st14; st14: if ( ++p == pe ) goto _test_eof14; case 14: -#line 658 "pitchfork_http.c" +#line 652 "pitchfork_http.c" switch( (*p) ) { case 9: goto st15; case 10: goto tr21; @@ -683,14 +677,14 @@ case 14: goto tr23; goto st0; tr25: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } goto st15; st15: if ( ++p == pe ) goto _test_eof15; case 15: -#line 694 "pitchfork_http.c" +#line 688 "pitchfork_http.c" switch( (*p) ) { case 9: goto tr25; case 10: goto tr26; @@ -702,14 +696,14 @@ case 15: goto st0; goto tr24; tr24: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } goto st16; st16: if ( ++p == pe ) goto _test_eof16; case 16: -#line 713 "pitchfork_http.c" +#line 707 "pitchfork_http.c" switch( (*p) ) { case 10: goto tr29; case 13: goto tr30; @@ -722,39 +716,39 @@ case 16: goto st0; goto st16; tr19: -#line 350 "pitchfork_http.rl" +#line 344 "pitchfork_http.rl" { http_version(hp, PTR_TO(mark), LEN(mark, p)); } goto st17; tr27: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } -#line 326 "pitchfork_http.rl" +#line 320 "pitchfork_http.rl" { write_cont_value(hp, buffer, p); } goto st17; tr30: -#line 326 "pitchfork_http.rl" +#line 320 "pitchfork_http.rl" { write_cont_value(hp, buffer, p); } goto st17; tr37: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } -#line 325 "pitchfork_http.rl" +#line 319 "pitchfork_http.rl" { write_value(self, hp, buffer, p); } goto st17; tr40: -#line 325 "pitchfork_http.rl" +#line 319 "pitchfork_http.rl" { write_value(self, hp, buffer, p); } goto st17; st17: if ( ++p == pe ) goto _test_eof17; case 17: -#line 753 "pitchfork_http.c" +#line 747 "pitchfork_http.c" if ( (*p) == 10 ) goto st14; goto st0; tr21: -#line 366 "pitchfork_http.rl" +#line 360 "pitchfork_http.rl" { finalize_header(hp); @@ -775,12 +769,12 @@ case 17: } goto st122; tr104: -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } -#line 366 "pitchfork_http.rl" +#line 360 "pitchfork_http.rl" { finalize_header(hp); @@ -801,9 +795,9 @@ case 17: } goto st122; tr108: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } -#line 336 "pitchfork_http.rl" +#line 330 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT); VALUE str = rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p)); @@ -813,7 +807,7 @@ case 17: rb_hash_aset(hp->env, g_request_path, str); } } -#line 366 "pitchfork_http.rl" +#line 360 "pitchfork_http.rl" { finalize_header(hp); @@ -834,7 +828,7 @@ case 17: } goto st122; tr112: -#line 336 "pitchfork_http.rl" +#line 330 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT); VALUE str = rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p)); @@ -844,7 +838,7 @@ case 17: rb_hash_aset(hp->env, g_request_path, str); } } -#line 366 "pitchfork_http.rl" +#line 360 "pitchfork_http.rl" { finalize_header(hp); @@ -865,7 +859,7 @@ case 17: } goto st122; tr117: -#line 351 "pitchfork_http.rl" +#line 345 "pitchfork_http.rl" { VALUE val; @@ -876,12 +870,12 @@ case 17: if (!STR_CSTR_EQ(val, "*")) rb_hash_aset(hp->env, g_path_info, val); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } -#line 366 "pitchfork_http.rl" +#line 360 "pitchfork_http.rl" { finalize_header(hp); @@ -902,19 +896,19 @@ case 17: } goto st122; tr124: -#line 345 "pitchfork_http.rl" +#line 339 "pitchfork_http.rl" {MARK(start.query, p); } -#line 346 "pitchfork_http.rl" +#line 340 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING); rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p)); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } -#line 366 "pitchfork_http.rl" +#line 360 "pitchfork_http.rl" { finalize_header(hp); @@ -935,17 +929,17 @@ case 17: } goto st122; tr129: -#line 346 "pitchfork_http.rl" +#line 340 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING); rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p)); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } -#line 366 "pitchfork_http.rl" +#line 360 "pitchfork_http.rl" { finalize_header(hp); @@ -969,19 +963,19 @@ case 17: if ( ++p == pe ) goto _test_eof122; case 122: -#line 973 "pitchfork_http.c" +#line 967 "pitchfork_http.c" goto st0; tr105: -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } goto st18; tr109: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } -#line 336 "pitchfork_http.rl" +#line 330 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT); VALUE str = rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p)); @@ -993,7 +987,7 @@ case 122: } goto st18; tr113: -#line 336 "pitchfork_http.rl" +#line 330 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), FRAGMENT); VALUE str = rb_hash_aset(hp->env, g_fragment, STR_NEW(mark, p)); @@ -1005,7 +999,7 @@ case 122: } goto st18; tr118: -#line 351 "pitchfork_http.rl" +#line 345 "pitchfork_http.rl" { VALUE val; @@ -1016,33 +1010,33 @@ case 122: if (!STR_CSTR_EQ(val, "*")) rb_hash_aset(hp->env, g_path_info, val); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } goto st18; tr125: -#line 345 "pitchfork_http.rl" +#line 339 "pitchfork_http.rl" {MARK(start.query, p); } -#line 346 "pitchfork_http.rl" +#line 340 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING); rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p)); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } goto st18; tr130: -#line 346 "pitchfork_http.rl" +#line 340 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING); rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p)); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); @@ -1052,25 +1046,25 @@ case 122: if ( ++p == pe ) goto _test_eof18; case 18: -#line 1056 "pitchfork_http.c" +#line 1050 "pitchfork_http.c" if ( (*p) == 10 ) goto tr21; goto st0; tr23: -#line 320 "pitchfork_http.rl" +#line 314 "pitchfork_http.rl" { MARK(start.field, p); } -#line 321 "pitchfork_http.rl" +#line 315 "pitchfork_http.rl" { snake_upcase_char(deconst(p)); } goto st19; tr32: -#line 321 "pitchfork_http.rl" +#line 315 "pitchfork_http.rl" { snake_upcase_char(deconst(p)); } goto st19; st19: if ( ++p == pe ) goto _test_eof19; case 19: -#line 1074 "pitchfork_http.c" +#line 1068 "pitchfork_http.c" switch( (*p) ) { case 33: goto tr32; case 58: goto tr33; @@ -1096,18 +1090,18 @@ case 19: goto tr32; goto st0; tr35: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } goto st20; tr33: -#line 323 "pitchfork_http.rl" +#line 317 "pitchfork_http.rl" { hp->s.field_len = LEN(start.field, p); } goto st20; st20: if ( ++p == pe ) goto _test_eof20; case 20: -#line 1111 "pitchfork_http.c" +#line 1105 "pitchfork_http.c" switch( (*p) ) { case 9: goto tr35; case 10: goto tr36; @@ -1119,14 +1113,14 @@ case 20: goto st0; goto tr34; tr34: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } goto st21; st21: if ( ++p == pe ) goto _test_eof21; case 21: -#line 1130 "pitchfork_http.c" +#line 1124 "pitchfork_http.c" switch( (*p) ) { case 10: goto tr39; case 13: goto tr40; @@ -1139,14 +1133,14 @@ case 21: goto st0; goto st21; tr9: -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } goto st22; tr50: -#line 351 "pitchfork_http.rl" +#line 345 "pitchfork_http.rl" { VALUE val; @@ -1157,33 +1151,33 @@ case 21: if (!STR_CSTR_EQ(val, "*")) rb_hash_aset(hp->env, g_path_info, val); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } goto st22; tr56: -#line 345 "pitchfork_http.rl" +#line 339 "pitchfork_http.rl" {MARK(start.query, p); } -#line 346 "pitchfork_http.rl" +#line 340 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING); rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p)); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } goto st22; tr60: -#line 346 "pitchfork_http.rl" +#line 340 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING); rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p)); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); @@ -1193,7 +1187,7 @@ case 21: if ( ++p == pe ) goto _test_eof22; case 22: -#line 1197 "pitchfork_http.c" +#line 1191 "pitchfork_http.c" switch( (*p) ) { case 32: goto tr42; case 35: goto st0; @@ -1204,14 +1198,14 @@ case 22: goto st0; goto tr41; tr41: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st23; st23: if ( ++p == pe ) goto _test_eof23; case 23: -#line 1215 "pitchfork_http.c" +#line 1209 "pitchfork_http.c" switch( (*p) ) { case 32: goto tr45; case 35: goto st0; @@ -1222,14 +1216,14 @@ case 23: goto st0; goto st23; tr43: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st24; st24: if ( ++p == pe ) goto _test_eof24; case 24: -#line 1233 "pitchfork_http.c" +#line 1227 "pitchfork_http.c" if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto st25; @@ -1253,20 +1247,20 @@ case 25: goto st23; goto st0; tr6: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st26; tr76: -#line 331 "pitchfork_http.rl" +#line 325 "pitchfork_http.rl" { rb_hash_aset(hp->env, g_http_host, STR_NEW(mark, p)); } -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st26; st26: if ( ++p == pe ) goto _test_eof26; case 26: -#line 1270 "pitchfork_http.c" +#line 1264 "pitchfork_http.c" switch( (*p) ) { case 32: goto tr49; case 35: goto tr50; @@ -1304,7 +1298,7 @@ case 28: goto st26; goto st0; tr52: -#line 351 "pitchfork_http.rl" +#line 345 "pitchfork_http.rl" { VALUE val; @@ -1320,7 +1314,7 @@ case 28: if ( ++p == pe ) goto _test_eof29; case 29: -#line 1324 "pitchfork_http.c" +#line 1318 "pitchfork_http.c" switch( (*p) ) { case 32: goto tr55; case 35: goto tr56; @@ -1331,14 +1325,14 @@ case 29: goto st0; goto tr54; tr54: -#line 345 "pitchfork_http.rl" +#line 339 "pitchfork_http.rl" {MARK(start.query, p); } goto st30; st30: if ( ++p == pe ) goto _test_eof30; case 30: -#line 1342 "pitchfork_http.c" +#line 1336 "pitchfork_http.c" switch( (*p) ) { case 32: goto tr59; case 35: goto tr60; @@ -1349,14 +1343,14 @@ case 30: goto st0; goto st30; tr57: -#line 345 "pitchfork_http.rl" +#line 339 "pitchfork_http.rl" {MARK(start.query, p); } goto st31; st31: if ( ++p == pe ) goto _test_eof31; case 31: -#line 1360 "pitchfork_http.c" +#line 1354 "pitchfork_http.c" if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto st32; @@ -1380,58 +1374,58 @@ case 32: goto st30; goto st0; tr7: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } -#line 322 "pitchfork_http.rl" +#line 316 "pitchfork_http.rl" { downcase_char(deconst(p)); } goto st33; st33: if ( ++p == pe ) goto _test_eof33; case 33: -#line 1393 "pitchfork_http.c" +#line 1387 "pitchfork_http.c" switch( (*p) ) { case 84: goto tr63; case 116: goto tr63; } goto st0; tr63: -#line 322 "pitchfork_http.rl" +#line 316 "pitchfork_http.rl" { downcase_char(deconst(p)); } goto st34; st34: if ( ++p == pe ) goto _test_eof34; case 34: -#line 1407 "pitchfork_http.c" +#line 1401 "pitchfork_http.c" switch( (*p) ) { case 84: goto tr64; case 116: goto tr64; } goto st0; tr64: -#line 322 "pitchfork_http.rl" +#line 316 "pitchfork_http.rl" { downcase_char(deconst(p)); } goto st35; st35: if ( ++p == pe ) goto _test_eof35; case 35: -#line 1421 "pitchfork_http.c" +#line 1415 "pitchfork_http.c" switch( (*p) ) { case 80: goto tr65; case 112: goto tr65; } goto st0; tr65: -#line 322 "pitchfork_http.rl" +#line 316 "pitchfork_http.rl" { downcase_char(deconst(p)); } goto st36; st36: if ( ++p == pe ) goto _test_eof36; case 36: -#line 1435 "pitchfork_http.c" +#line 1429 "pitchfork_http.c" switch( (*p) ) { case 58: goto tr66; case 83: goto tr67; @@ -1439,7 +1433,7 @@ case 36: } goto st0; tr66: -#line 328 "pitchfork_http.rl" +#line 322 "pitchfork_http.rl" { rb_hash_aset(hp->env, g_rack_url_scheme, STR_NEW(mark, p)); } @@ -1448,7 +1442,7 @@ case 36: if ( ++p == pe ) goto _test_eof37; case 37: -#line 1452 "pitchfork_http.c" +#line 1446 "pitchfork_http.c" if ( (*p) == 47 ) goto st38; goto st0; @@ -1536,14 +1530,14 @@ case 42: goto st40; goto st0; tr72: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st43; st43: if ( ++p == pe ) goto _test_eof43; case 43: -#line 1547 "pitchfork_http.c" +#line 1541 "pitchfork_http.c" switch( (*p) ) { case 37: goto st41; case 47: goto tr76; @@ -1595,14 +1589,14 @@ case 44: goto st0; goto st40; tr73: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st45; st45: if ( ++p == pe ) goto _test_eof45; case 45: -#line 1606 "pitchfork_http.c" +#line 1600 "pitchfork_http.c" switch( (*p) ) { case 37: goto st41; case 47: goto st0; @@ -1680,14 +1674,14 @@ case 47: goto st0; goto st40; tr67: -#line 322 "pitchfork_http.rl" +#line 316 "pitchfork_http.rl" { downcase_char(deconst(p)); } goto st48; st48: if ( ++p == pe ) goto _test_eof48; case 48: -#line 1691 "pitchfork_http.c" +#line 1685 "pitchfork_http.c" if ( (*p) == 58 ) goto tr66; goto st0; @@ -2203,14 +2197,14 @@ case 67: goto tr3; goto st0; tr2: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st68; st68: if ( ++p == pe ) goto _test_eof68; case 68: -#line 2214 "pitchfork_http.c" +#line 2208 "pitchfork_http.c" switch( (*p) ) { case 32: goto tr3; case 33: goto st49; @@ -2294,14 +2288,14 @@ case 70: goto st51; goto st0; tr100: -#line 327 "pitchfork_http.rl" +#line 321 "pitchfork_http.rl" { request_method(hp, PTR_TO(mark), LEN(mark, p)); } goto st71; st71: if ( ++p == pe ) goto _test_eof71; case 71: -#line 2305 "pitchfork_http.c" +#line 2299 "pitchfork_http.c" switch( (*p) ) { case 42: goto tr101; case 47: goto tr102; @@ -2310,14 +2304,14 @@ case 71: } goto st0; tr101: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st72; st72: if ( ++p == pe ) goto _test_eof72; case 72: -#line 2321 "pitchfork_http.c" +#line 2315 "pitchfork_http.c" switch( (*p) ) { case 10: goto tr104; case 13: goto tr105; @@ -2326,14 +2320,14 @@ case 72: } goto st0; tr106: -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } goto st73; tr119: -#line 351 "pitchfork_http.rl" +#line 345 "pitchfork_http.rl" { VALUE val; @@ -2344,33 +2338,33 @@ case 72: if (!STR_CSTR_EQ(val, "*")) rb_hash_aset(hp->env, g_path_info, val); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } goto st73; tr126: -#line 345 "pitchfork_http.rl" +#line 339 "pitchfork_http.rl" {MARK(start.query, p); } -#line 346 "pitchfork_http.rl" +#line 340 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING); rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p)); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); } goto st73; tr131: -#line 346 "pitchfork_http.rl" +#line 340 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(start.query, p), QUERY_STRING); rb_hash_aset(hp->env, g_query_string, STR_NEW(start.query, p)); } -#line 332 "pitchfork_http.rl" +#line 326 "pitchfork_http.rl" { VALIDATE_MAX_URI_LENGTH(LEN(mark, p), REQUEST_URI); rb_hash_aset(hp->env, g_request_uri, STR_NEW(mark, p)); @@ -2380,7 +2374,7 @@ case 72: if ( ++p == pe ) goto _test_eof73; case 73: -#line 2384 "pitchfork_http.c" +#line 2378 "pitchfork_http.c" switch( (*p) ) { case 10: goto tr108; case 13: goto tr109; @@ -2393,14 +2387,14 @@ case 73: goto st0; goto tr107; tr107: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st74; st74: if ( ++p == pe ) goto _test_eof74; case 74: -#line 2404 "pitchfork_http.c" +#line 2398 "pitchfork_http.c" switch( (*p) ) { case 10: goto tr112; case 13: goto tr113; @@ -2413,14 +2407,14 @@ case 74: goto st0; goto st74; tr110: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st75; st75: if ( ++p == pe ) goto _test_eof75; case 75: -#line 2424 "pitchfork_http.c" +#line 2418 "pitchfork_http.c" if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto st76; @@ -2444,20 +2438,20 @@ case 76: goto st74; goto st0; tr102: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st77; tr147: -#line 331 "pitchfork_http.rl" +#line 325 "pitchfork_http.rl" { rb_hash_aset(hp->env, g_http_host, STR_NEW(mark, p)); } -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st77; st77: if ( ++p == pe ) goto _test_eof77; case 77: -#line 2461 "pitchfork_http.c" +#line 2455 "pitchfork_http.c" switch( (*p) ) { case 10: goto tr117; case 13: goto tr118; @@ -2497,7 +2491,7 @@ case 79: goto st77; goto st0; tr121: -#line 351 "pitchfork_http.rl" +#line 345 "pitchfork_http.rl" { VALUE val; @@ -2513,7 +2507,7 @@ case 79: if ( ++p == pe ) goto _test_eof80; case 80: -#line 2517 "pitchfork_http.c" +#line 2511 "pitchfork_http.c" switch( (*p) ) { case 10: goto tr124; case 13: goto tr125; @@ -2526,14 +2520,14 @@ case 80: goto st0; goto tr123; tr123: -#line 345 "pitchfork_http.rl" +#line 339 "pitchfork_http.rl" {MARK(start.query, p); } goto st81; st81: if ( ++p == pe ) goto _test_eof81; case 81: -#line 2537 "pitchfork_http.c" +#line 2531 "pitchfork_http.c" switch( (*p) ) { case 10: goto tr129; case 13: goto tr130; @@ -2546,14 +2540,14 @@ case 81: goto st0; goto st81; tr127: -#line 345 "pitchfork_http.rl" +#line 339 "pitchfork_http.rl" {MARK(start.query, p); } goto st82; st82: if ( ++p == pe ) goto _test_eof82; case 82: -#line 2557 "pitchfork_http.c" +#line 2551 "pitchfork_http.c" if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto st83; @@ -2577,58 +2571,58 @@ case 83: goto st81; goto st0; tr103: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } -#line 322 "pitchfork_http.rl" +#line 316 "pitchfork_http.rl" { downcase_char(deconst(p)); } goto st84; st84: if ( ++p == pe ) goto _test_eof84; case 84: -#line 2590 "pitchfork_http.c" +#line 2584 "pitchfork_http.c" switch( (*p) ) { case 84: goto tr134; case 116: goto tr134; } goto st0; tr134: -#line 322 "pitchfork_http.rl" +#line 316 "pitchfork_http.rl" { downcase_char(deconst(p)); } goto st85; st85: if ( ++p == pe ) goto _test_eof85; case 85: -#line 2604 "pitchfork_http.c" +#line 2598 "pitchfork_http.c" switch( (*p) ) { case 84: goto tr135; case 116: goto tr135; } goto st0; tr135: -#line 322 "pitchfork_http.rl" +#line 316 "pitchfork_http.rl" { downcase_char(deconst(p)); } goto st86; st86: if ( ++p == pe ) goto _test_eof86; case 86: -#line 2618 "pitchfork_http.c" +#line 2612 "pitchfork_http.c" switch( (*p) ) { case 80: goto tr136; case 112: goto tr136; } goto st0; tr136: -#line 322 "pitchfork_http.rl" +#line 316 "pitchfork_http.rl" { downcase_char(deconst(p)); } goto st87; st87: if ( ++p == pe ) goto _test_eof87; case 87: -#line 2632 "pitchfork_http.c" +#line 2626 "pitchfork_http.c" switch( (*p) ) { case 58: goto tr137; case 83: goto tr138; @@ -2636,7 +2630,7 @@ case 87: } goto st0; tr137: -#line 328 "pitchfork_http.rl" +#line 322 "pitchfork_http.rl" { rb_hash_aset(hp->env, g_rack_url_scheme, STR_NEW(mark, p)); } @@ -2645,7 +2639,7 @@ case 87: if ( ++p == pe ) goto _test_eof88; case 88: -#line 2649 "pitchfork_http.c" +#line 2643 "pitchfork_http.c" if ( (*p) == 47 ) goto st89; goto st0; @@ -2733,14 +2727,14 @@ case 93: goto st91; goto st0; tr143: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st94; st94: if ( ++p == pe ) goto _test_eof94; case 94: -#line 2744 "pitchfork_http.c" +#line 2738 "pitchfork_http.c" switch( (*p) ) { case 37: goto st92; case 47: goto tr147; @@ -2792,14 +2786,14 @@ case 95: goto st0; goto st91; tr144: -#line 318 "pitchfork_http.rl" +#line 312 "pitchfork_http.rl" {MARK(mark, p); } goto st96; st96: if ( ++p == pe ) goto _test_eof96; case 96: -#line 2803 "pitchfork_http.c" +#line 2797 "pitchfork_http.c" switch( (*p) ) { case 37: goto st92; case 47: goto st0; @@ -2877,14 +2871,14 @@ case 98: goto st0; goto st91; tr138: -#line 322 "pitchfork_http.rl" +#line 316 "pitchfork_http.rl" { downcase_char(deconst(p)); } goto st99; st99: if ( ++p == pe ) goto _test_eof99; case 99: -#line 2888 "pitchfork_http.c" +#line 2882 "pitchfork_http.c" if ( (*p) == 58 ) goto tr137; goto st0; @@ -2904,7 +2898,7 @@ case 100: goto tr152; goto st0; tr151: -#line 361 "pitchfork_http.rl" +#line 355 "pitchfork_http.rl" { hp->len.chunk = step_incr(hp->len.chunk, (*p), 16); if (hp->len.chunk < 0) @@ -2915,7 +2909,7 @@ case 100: if ( ++p == pe ) goto _test_eof101; case 101: -#line 2919 "pitchfork_http.c" +#line 2913 "pitchfork_http.c" switch( (*p) ) { case 10: goto tr153; case 13: goto st102; @@ -2932,7 +2926,7 @@ case 101: goto tr152; goto st0; tr153: -#line 390 "pitchfork_http.rl" +#line 384 "pitchfork_http.rl" { HP_FL_SET(hp, INTRAILER); cs = http_parser_en_Trailers; @@ -2945,7 +2939,7 @@ case 101: if ( ++p == pe ) goto _test_eof123; case 123: -#line 2949 "pitchfork_http.c" +#line 2943 "pitchfork_http.c" goto st0; st102: if ( ++p == pe ) @@ -2955,7 +2949,7 @@ case 102: goto tr153; goto st0; tr152: -#line 361 "pitchfork_http.rl" +#line 355 "pitchfork_http.rl" { hp->len.chunk = step_incr(hp->len.chunk, (*p), 16); if (hp->len.chunk < 0) @@ -2966,7 +2960,7 @@ case 102: if ( ++p == pe ) goto _test_eof103; case 103: -#line 2970 "pitchfork_http.c" +#line 2964 "pitchfork_http.c" switch( (*p) ) { case 10: goto st104; case 13: goto st107; @@ -2987,7 +2981,7 @@ case 103: case 104: goto tr159; tr159: -#line 398 "pitchfork_http.rl" +#line 392 "pitchfork_http.rl" { skip_chunk_data_hack: { size_t nr = MIN((size_t)hp->len.chunk, REMAINING); @@ -3009,7 +3003,7 @@ case 104: if ( ++p == pe ) goto _test_eof105; case 105: -#line 3013 "pitchfork_http.c" +#line 3007 "pitchfork_http.c" switch( (*p) ) { case 10: goto st100; case 13: goto st106; @@ -3216,30 +3210,30 @@ case 113: goto st113; goto st0; tr172: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } -#line 326 "pitchfork_http.rl" +#line 320 "pitchfork_http.rl" { write_cont_value(hp, buffer, p); } goto st114; tr175: -#line 326 "pitchfork_http.rl" +#line 320 "pitchfork_http.rl" { write_cont_value(hp, buffer, p); } goto st114; tr182: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } -#line 325 "pitchfork_http.rl" +#line 319 "pitchfork_http.rl" { write_value(self, hp, buffer, p); } goto st114; tr185: -#line 325 "pitchfork_http.rl" +#line 319 "pitchfork_http.rl" { write_value(self, hp, buffer, p); } goto st114; st114: if ( ++p == pe ) goto _test_eof114; case 114: -#line 3243 "pitchfork_http.c" +#line 3237 "pitchfork_http.c" switch( (*p) ) { case 9: goto st115; case 10: goto tr167; @@ -3268,14 +3262,14 @@ case 114: goto tr169; goto st0; tr171: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } goto st115; st115: if ( ++p == pe ) goto _test_eof115; case 115: -#line 3279 "pitchfork_http.c" +#line 3273 "pitchfork_http.c" switch( (*p) ) { case 9: goto tr171; case 10: goto tr172; @@ -3287,14 +3281,14 @@ case 115: goto st0; goto tr170; tr170: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } goto st116; st116: if ( ++p == pe ) goto _test_eof116; case 116: -#line 3298 "pitchfork_http.c" +#line 3292 "pitchfork_http.c" switch( (*p) ) { case 10: goto tr175; case 13: goto tr176; @@ -3307,35 +3301,35 @@ case 116: goto st0; goto st116; tr173: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } -#line 326 "pitchfork_http.rl" +#line 320 "pitchfork_http.rl" { write_cont_value(hp, buffer, p); } goto st117; tr176: -#line 326 "pitchfork_http.rl" +#line 320 "pitchfork_http.rl" { write_cont_value(hp, buffer, p); } goto st117; tr183: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } -#line 325 "pitchfork_http.rl" +#line 319 "pitchfork_http.rl" { write_value(self, hp, buffer, p); } goto st117; tr186: -#line 325 "pitchfork_http.rl" +#line 319 "pitchfork_http.rl" { write_value(self, hp, buffer, p); } goto st117; st117: if ( ++p == pe ) goto _test_eof117; case 117: -#line 3334 "pitchfork_http.c" +#line 3328 "pitchfork_http.c" if ( (*p) == 10 ) goto st114; goto st0; tr167: -#line 385 "pitchfork_http.rl" +#line 379 "pitchfork_http.rl" { cs = http_parser_first_final; goto post_exec; @@ -3345,7 +3339,7 @@ case 117: if ( ++p == pe ) goto _test_eof124; case 124: -#line 3349 "pitchfork_http.c" +#line 3343 "pitchfork_http.c" goto st0; st118: if ( ++p == pe ) @@ -3355,20 +3349,20 @@ case 118: goto tr167; goto st0; tr169: -#line 320 "pitchfork_http.rl" +#line 314 "pitchfork_http.rl" { MARK(start.field, p); } -#line 321 "pitchfork_http.rl" +#line 315 "pitchfork_http.rl" { snake_upcase_char(deconst(p)); } goto st119; tr178: -#line 321 "pitchfork_http.rl" +#line 315 "pitchfork_http.rl" { snake_upcase_char(deconst(p)); } goto st119; st119: if ( ++p == pe ) goto _test_eof119; case 119: -#line 3372 "pitchfork_http.c" +#line 3366 "pitchfork_http.c" switch( (*p) ) { case 33: goto tr178; case 58: goto tr179; @@ -3394,18 +3388,18 @@ case 119: goto tr178; goto st0; tr181: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } goto st120; tr179: -#line 323 "pitchfork_http.rl" +#line 317 "pitchfork_http.rl" { hp->s.field_len = LEN(start.field, p); } goto st120; st120: if ( ++p == pe ) goto _test_eof120; case 120: -#line 3409 "pitchfork_http.c" +#line 3403 "pitchfork_http.c" switch( (*p) ) { case 9: goto tr181; case 10: goto tr182; @@ -3417,14 +3411,14 @@ case 120: goto st0; goto tr180; tr180: -#line 324 "pitchfork_http.rl" +#line 318 "pitchfork_http.rl" { MARK(mark, p); } goto st121; st121: if ( ++p == pe ) goto _test_eof121; case 121: -#line 3428 "pitchfork_http.c" +#line 3422 "pitchfork_http.c" switch( (*p) ) { case 10: goto tr185; case 13: goto tr186; @@ -3565,7 +3559,7 @@ case 121: _out: {} } -#line 459 "pitchfork_http.rl" +#line 453 "pitchfork_http.rl" post_exec: /* "_out:" also goes here */ if (hp->cs != http_parser_error) hp->cs = cs; @@ -4114,8 +4108,6 @@ RUBY_FUNC_EXPORTED void Init_pitchfork_http(void) */ rb_define_const(cHttpParser, "LENGTH_MAX", OFFT2NUM(UH_OFF_T_MAX)); - rb_define_singleton_method(cHttpParser, "max_header_len=", set_maxhdrlen, 1); - init_common_fields(); SET_GLOBAL(g_http_host, "HOST"); SET_GLOBAL(g_http_trailer, "TRAILER"); diff --git a/ext/pitchfork_http/pitchfork_http.rl b/ext/pitchfork_http/pitchfork_http.rl index 297f679d..d5734a0f 100644 --- a/ext/pitchfork_http/pitchfork_http.rl +++ b/ext/pitchfork_http/pitchfork_http.rl @@ -36,12 +36,6 @@ void init_pitchfork_memory_page(VALUE); static unsigned int MAX_HEADER_LEN = 1024 * (80 + 32); /* same as Mongrel */ -/* this is only intended for use with Rainbows! */ -static VALUE set_maxhdrlen(VALUE self, VALUE len) -{ - return UINT2NUM(MAX_HEADER_LEN = NUM2UINT(len)); -} - /* keep this small for other servers (e.g. yahns) since every client has one */ struct http_parser { int cs; /* Ragel internal state */ @@ -1004,8 +998,6 @@ RUBY_FUNC_EXPORTED void Init_pitchfork_http(void) */ rb_define_const(cHttpParser, "LENGTH_MAX", OFFT2NUM(UH_OFF_T_MAX)); - rb_define_singleton_method(cHttpParser, "max_header_len=", set_maxhdrlen, 1); - init_common_fields(); SET_GLOBAL(g_http_host, "HOST"); SET_GLOBAL(g_http_trailer, "TRAILER"); diff --git a/test/integration/t0019-max_header_len.sh b/test/integration/t0019-max_header_len.sh deleted file mode 100755 index 21a35681..00000000 --- a/test/integration/t0019-max_header_len.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -. ./test-lib.sh -t_plan 5 "max_header_len setting (only intended for Rainbows!)" - -t_begin "setup and start" && { - pitchfork_setup - req='GET / HTTP/1.0\r\n\r\n' - len=$(printf "$req" | count_bytes) - echo Pitchfork::HttpParser.max_header_len = $len >> $pitchfork_config - pitchfork_spawn -c $pitchfork_config env.ru - pitchfork_wait_start -} - -t_begin "minimal request succeeds" && { - rm -f $tmp - ( - cat $fifo > $tmp & - printf "$req" - wait - echo ok > $ok - ) | socat - TCP:$listen > $fifo - test xok = x$(cat $ok) - - fgrep "HTTP/1.1 200 OK" $tmp -} - -t_begin "big request fails" && { - rm -f $tmp - ( - cat $fifo > $tmp & - printf 'GET /xxxxxx HTTP/1.0\r\n\r\n' - wait - echo ok > $ok - ) | socat - TCP:$listen > $fifo - test xok = x$(cat $ok) - fgrep "HTTP/1.1 413" $tmp -} - -dbgcat tmp - -t_begin "killing succeeds" && { - kill $pitchfork_pid -} - -t_begin "check stderr" && { - check_stderr -} - -t_done diff --git a/test/unit/test_http_parser_ng.rb b/test/unit/test_http_parser_ng.rb index 7770d725..f650a248 100644 --- a/test/unit/test_http_parser_ng.rb +++ b/test/unit/test_http_parser_ng.rb @@ -24,12 +24,6 @@ def test_is_chunked end end - def test_parser_max_len - assert_raises(RangeError) do - HttpParser.max_header_len = 0xffffffff + 1 - end - end - def test_next_clear r = "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n" @parser.buf << r From 2d0eade9acdce742c8b9985b85a422f5f3fc0c0e Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:31:25 +0200 Subject: [PATCH 2/2] Ensure that ragel output is up-to-date --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b28603e8..0d1dcc22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,3 +40,6 @@ jobs: - name: Tests Rack ${{ matrix.rack }} ${{ matrix.rubyopt }} run: bundle exec rake + + - name: Ensure ragel output is up-to-date + run: git diff --exit-code