Tests: relaxed proxy_request_buffering tests to pass on slow hosts. Split DATA frame could be proxied in a single chunk.
diff --git a/h2_proxy_request_buffering.t b/h2_proxy_request_buffering.t index 71cb9e8..8449ff5 100644 --- a/h2_proxy_request_buffering.t +++ b/h2_proxy_request_buffering.t
@@ -156,9 +156,8 @@ $f = get_body('/chunked'); ok($f->{headers}, 'chunked split'); -is($f->{upload}('0123456789', split => [ 14 ]), - '5' . CRLF . '01234' . CRLF . '5' . CRLF . '56789' . CRLF . - '0' . CRLF . CRLF, 'chunked split'); +is(http_content($f->{upload}('0123456789', split => [ 14 ])), + '0123456789', 'chunked split'); is($f->{http_end}(), 200, 'chunked split - response'); # unbuffered request body, chunked transfer-encoding @@ -177,6 +176,19 @@ ############################################################################### +sub http_content { + my ($body) = @_; + my $content = ''; + + while ($body =~ /\G\x0d?\x0a?([0-9a-f]+)\x0d\x0a?/gcmsi) { + my $len = hex($1); + $content .= substr($body, pos($body), $len); + pos($body) += $len; + } + + return $content; +} + sub get_body { my ($url, %extra) = @_; my ($server, $client, $f);
diff --git a/h2_proxy_request_buffering_ssl.t b/h2_proxy_request_buffering_ssl.t index 4ab999b..0800f99 100644 --- a/h2_proxy_request_buffering_ssl.t +++ b/h2_proxy_request_buffering_ssl.t
@@ -175,13 +175,25 @@ $f = get_body('/chunked'); ok($f->{headers}, 'chunked split'); -is($f->{upload}('0123456789', split => [ 14 ]), - '5' . CRLF . '01234' . CRLF . '5' . CRLF . '56789' . CRLF . - '0' . CRLF . CRLF, 'chunked split'); +is(http_content($f->{upload}('0123456789', split => [ 14 ])), + '0123456789', 'chunked split'); is($f->{http_end}(), 200, 'chunked split - response'); ############################################################################### +sub http_content { + my ($body) = @_; + my $content = ''; + + while ($body =~ /\G\x0d?\x0a?([0-9a-f]+)\x0d\x0a?/gcmsi) { + my $len = hex($1); + $content .= substr($body, pos($body), $len); + pos($body) += $len; + } + + return $content; +} + sub get_body { my ($url, %extra) = @_; my ($server, $client, $f);