Changeset 1226:124322e9accd in nginx-tests


Ignore:
Timestamp:
09/18/17 22:45:05 (3 years ago)
Author:
Sergey Kandaurov <pluknet@…>
Branch:
default
Phase:
public
Message:

Tests: HTTP/2 request body sync buffer test added (ticket #1384).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • h2_request_body.t

    r1091 r1226  
    2424select STDOUT; $| = 1;
    2525
    26 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy/)->plan(43);
     26my $t = Test::Nginx->new()->has(qw/http http_v2 proxy/)->plan(44);
    2727
    2828$t->write_file_expand('nginx.conf', <<'EOF');
     
    4646            add_header X-Length $http_content_length;
    4747        }
     48        location /slow {
     49            limit_rate 100;
     50        }
    4851        location /off/ {
    4952            proxy_pass http://127.0.0.1:8081/;
     53            add_header X-Body $request_body;
    5054            add_header X-Body-File $request_body_file;
    5155        }
     
    7175$t->write_file('index.html', '');
    7276$t->write_file('t.html', 'SEE-THIS');
     77$t->write_file('slow.html', 'SEE-THIS');
    7378$t->run();
    7479
     
    436441($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
    437442is($frame->{headers}->{'x-body-file'}, undef, 'no request body in file');
     443
     444# ticket #1384, request body corruption in recv_buffer
     445
     446TODO: {
     447local $TODO = 'not yet' unless $t->has_version('1.13.6');
     448
     449$s = Test::Nginx::HTTP2->new();
     450$sid = $s->new_stream({ path => '/off/slow.html', body_more => 1 });
     451select undef, undef, undef, 0.1;
     452
     453# for simplicity, DATA frame is received on its own for a known offset
     454
     455$s->h2_body('TEST');
     456select undef, undef, undef, 0.1;
     457
     458# overwrite recv_buffer; since upstream response arrival is delayed,
     459# this would make $request_body point to the overridden buffer space
     460
     461$s->h2_ping('xxxx');
     462
     463$frames = $s->read(all => [{ sid => $sid, fin => 1 }]);
     464($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
     465isnt($frame->{headers}->{'x-body'}, 'xxxx', 'sync buffer');
     466
     467}
    438468
    439469###############################################################################
Note: See TracChangeset for help on using the changeset viewer.