Mercurial > hg > nginx-tests
comparison h2.t @ 692:a16d4a768197
Tests: removed HTTP/2 TODOs for now passing GOAWAY tests.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 14 Sep 2015 13:26:33 +0300 |
parents | 3f4a132c6463 |
children | 3eba6e1b8313 |
comparison
equal
deleted
inserted
replaced
691:3f4a132c6463 | 692:a16d4a768197 |
---|---|
519 | 519 |
520 # 5.4.1. Connection Error Handling | 520 # 5.4.1. Connection Error Handling |
521 # An endpoint that encounters a connection error SHOULD first send a | 521 # An endpoint that encounters a connection error SHOULD first send a |
522 # GOAWAY frame <..> | 522 # GOAWAY frame <..> |
523 | 523 |
524 TODO: { | |
525 local $TODO = 'not yet'; | |
526 | |
527 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | 524 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
528 ok($frame, 'invalid index - GOAWAY'); | 525 ok($frame, 'invalid index - GOAWAY'); |
529 | 526 |
530 # RFC 7541, 2.3.3. Index Address Space | 527 # RFC 7541, 2.3.3. Index Address Space |
531 # Indices strictly greater than the sum of the lengths of both tables | 528 # Indices strictly greater than the sum of the lengths of both tables |
535 # A decoding error in a header block MUST be treated | 532 # A decoding error in a header block MUST be treated |
536 # as a connection error of type COMPRESSION_ERROR. | 533 # as a connection error of type COMPRESSION_ERROR. |
537 | 534 |
538 is($frame->{last_sid}, $sid, 'invalid index - GOAWAY last stream'); | 535 is($frame->{last_sid}, $sid, 'invalid index - GOAWAY last stream'); |
539 is($frame->{code}, 9, 'invalid index - GOAWAY COMPRESSION_ERROR'); | 536 is($frame->{code}, 9, 'invalid index - GOAWAY COMPRESSION_ERROR'); |
540 | |
541 } | |
542 | 537 |
543 h2_ping($sess, 'SEE-THIS'); | 538 h2_ping($sess, 'SEE-THIS'); |
544 is(@{h2_read($sess, all => [{ type => 'PING' }])}, 0, 'invalid index - PING'); | 539 is(@{h2_read($sess, all => [{ type => 'PING' }])}, 0, 'invalid index - PING'); |
545 is($sess->{socket}->connected, undef, 'invalid index - connection close'); | 540 is($sess->{socket}->connected, undef, 'invalid index - connection close'); |
546 | 541 |
1601 is($frame->{flags}, 0, 'newline in request header - RST_STREAM flags'); | 1596 is($frame->{flags}, 0, 'newline in request header - RST_STREAM flags'); |
1602 is($frame->{code}, 1, 'newline in request header - RST_STREAM code'); | 1597 is($frame->{code}, 1, 'newline in request header - RST_STREAM code'); |
1603 | 1598 |
1604 # GOAWAY on SYN_STREAM with even StreamID | 1599 # GOAWAY on SYN_STREAM with even StreamID |
1605 | 1600 |
1606 TODO: { | |
1607 local $TODO = 'not yet'; | |
1608 | |
1609 $sess = new_session(); | 1601 $sess = new_session(); |
1610 new_stream($sess, { path => '/' }, 2); | 1602 new_stream($sess, { path => '/' }, 2); |
1611 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]); | 1603 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]); |
1612 | 1604 |
1613 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | 1605 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
1614 ok($frame, 'even stream - GOAWAY frame'); | 1606 ok($frame, 'even stream - GOAWAY frame'); |
1615 is($frame->{code}, 1, 'even stream - error code'); | 1607 is($frame->{code}, 1, 'even stream - error code'); |
1616 is($frame->{last_sid}, 0, 'even stream - last stream'); | 1608 is($frame->{last_sid}, 0, 'even stream - last stream'); |
1617 | 1609 |
1618 } | |
1619 | |
1620 # GOAWAY on SYN_STREAM with backward StreamID | 1610 # GOAWAY on SYN_STREAM with backward StreamID |
1621 | 1611 |
1622 # 5.1.1. Stream Identifiers | 1612 # 5.1.1. Stream Identifiers |
1623 # The first use of a new stream identifier implicitly closes all | 1613 # The first use of a new stream identifier implicitly closes all |
1624 # streams in the "idle" state <..> with a lower-valued stream identifier. | 1614 # streams in the "idle" state <..> with a lower-valued stream identifier. |
1625 | |
1626 TODO: { | |
1627 local $TODO = 'not yet'; | |
1628 | 1615 |
1629 $sess = new_session(); | 1616 $sess = new_session(); |
1630 $sid = new_stream($sess, { path => '/' }, 3); | 1617 $sid = new_stream($sess, { path => '/' }, 3); |
1631 h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | 1618 h2_read($sess, all => [{ sid => $sid, fin => 1 }]); |
1632 | 1619 |
1636 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | 1623 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
1637 ok($frame, 'backward stream - GOAWAY frame'); | 1624 ok($frame, 'backward stream - GOAWAY frame'); |
1638 is($frame->{code}, 1, 'backward stream - error code'); | 1625 is($frame->{code}, 1, 'backward stream - error code'); |
1639 is($frame->{last_sid}, $sid, 'backward stream - last stream'); | 1626 is($frame->{last_sid}, $sid, 'backward stream - last stream'); |
1640 | 1627 |
1641 } | |
1642 | |
1643 # GOAWAY on the second SYN_STREAM with same StreamID | 1628 # GOAWAY on the second SYN_STREAM with same StreamID |
1644 | |
1645 TODO: { | |
1646 local $TODO = 'not yet'; | |
1647 | 1629 |
1648 $sess = new_session(); | 1630 $sess = new_session(); |
1649 $sid = new_stream($sess, { path => '/' }); | 1631 $sid = new_stream($sess, { path => '/' }); |
1650 h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | 1632 h2_read($sess, all => [{ sid => $sid, fin => 1 }]); |
1651 | 1633 |
1655 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | 1637 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
1656 ok($frame, 'dup stream - GOAWAY frame'); | 1638 ok($frame, 'dup stream - GOAWAY frame'); |
1657 is($frame->{code}, 1, 'dup stream - error code'); | 1639 is($frame->{code}, 1, 'dup stream - error code'); |
1658 is($frame->{last_sid}, $sid, 'dup stream - last stream'); | 1640 is($frame->{last_sid}, $sid, 'dup stream - last stream'); |
1659 | 1641 |
1660 } | |
1661 | |
1662 # missing mandatory request header ':scheme' | 1642 # missing mandatory request header ':scheme' |
1663 | 1643 |
1664 TODO: { | 1644 TODO: { |
1665 local $TODO = 'not yet'; | 1645 local $TODO = 'not yet'; |
1666 | 1646 |
1694 $sid = new_stream($sess, { path => 't1.html' }); | 1674 $sid = new_stream($sess, { path => 't1.html' }); |
1695 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]); | 1675 h2_read($sess, all => [{ sid => $sid, length => 2**16 - 1 }]); |
1696 | 1676 |
1697 $t->stop(); | 1677 $t->stop(); |
1698 | 1678 |
1699 TODO: { | |
1700 local $TODO = 'not yet'; | |
1701 | |
1702 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]); | 1679 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]); |
1703 | 1680 |
1704 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | 1681 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
1705 ok($frame, 'GOAWAY on connection close'); | 1682 ok($frame, 'GOAWAY on connection close'); |
1706 | |
1707 } | |
1708 | 1683 |
1709 ############################################################################### | 1684 ############################################################################### |
1710 | 1685 |
1711 sub h2_ping { | 1686 sub h2_ping { |
1712 my ($sess, $payload) = @_; | 1687 my ($sess, $payload) = @_; |