Mercurial > hg > nginx-tests
comparison h2.t @ 669:0c442e551ba1
Tests: corrected HTTP/2 tests for GOAWAY.
In particular, unlike in SPDY, GOAWAY has a dedicated Last-Stream-ID field.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 02 Sep 2015 13:02:47 +0300 |
parents | 1f34870e9538 |
children | 944b87756cab |
comparison
equal
deleted
inserted
replaced
668:1f34870e9538 | 669:0c442e551ba1 |
---|---|
504 | 504 |
505 TODO: { | 505 TODO: { |
506 local $TODO = 'not yet'; | 506 local $TODO = 'not yet'; |
507 | 507 |
508 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | 508 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
509 isnt($frame, undef, 'updated table size - invalid index GOAWAY'); | 509 ok($frame, 'updated table size - invalid index GOAWAY'); |
510 | 510 |
511 } | 511 } |
512 | 512 |
513 # HEAD | 513 # HEAD |
514 | 514 |
1426 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]); | 1426 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]); |
1427 | 1427 |
1428 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | 1428 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
1429 ok($frame, 'even stream - GOAWAY frame'); | 1429 ok($frame, 'even stream - GOAWAY frame'); |
1430 is($frame->{code}, 1, 'even stream - error code'); | 1430 is($frame->{code}, 1, 'even stream - error code'); |
1431 is($frame->{sid}, 0, 'even stream - last used stream'); | 1431 is($frame->{last_sid}, 0, 'even stream - last stream'); |
1432 | 1432 |
1433 } | 1433 } |
1434 | 1434 |
1435 # GOAWAY on SYN_STREAM with backward StreamID | 1435 # GOAWAY on SYN_STREAM with backward StreamID |
1436 | |
1437 # 5.1.1. Stream Identifiers | |
1438 # The first use of a new stream identifier implicitly closes all | |
1439 # streams in the "idle" state <..> with a lower-valued stream identifier. | |
1436 | 1440 |
1437 TODO: { | 1441 TODO: { |
1438 local $TODO = 'not yet'; | 1442 local $TODO = 'not yet'; |
1439 | 1443 |
1440 $sess = new_session(); | 1444 $sess = new_session(); |
1445 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]); | 1449 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]); |
1446 | 1450 |
1447 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | 1451 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
1448 ok($frame, 'backward stream - GOAWAY frame'); | 1452 ok($frame, 'backward stream - GOAWAY frame'); |
1449 is($frame->{code}, 1, 'backward stream - error code'); | 1453 is($frame->{code}, 1, 'backward stream - error code'); |
1450 is($frame->{sid}, $sid, 'backward stream - last used stream'); | 1454 is($frame->{last_sid}, $sid, 'backward stream - last stream'); |
1451 | 1455 |
1452 } | 1456 } |
1453 | 1457 |
1454 # RST_STREAM on the second SYN_STREAM with same StreamID | 1458 # GOAWAY on the second SYN_STREAM with same StreamID |
1455 | 1459 |
1456 TODO: { | 1460 TODO: { |
1457 local $TODO = 'not yet'; | 1461 local $TODO = 'not yet'; |
1458 | 1462 |
1459 $sess = new_session(); | 1463 $sess = new_session(); |
1460 $sid = new_stream($sess, { path => '/' }); | 1464 $sid = new_stream($sess, { path => '/' }); |
1461 h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | 1465 h2_read($sess, all => [{ sid => $sid, fin => 1 }]); |
1462 | 1466 |
1463 $sid2 = new_stream($sess, { path => '/' }, $sid); | 1467 $sid2 = new_stream($sess, { path => '/' }, $sid); |
1464 $frames = h2_read($sess, all => [{ type => 'RST_STREAM' }]); | 1468 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]); |
1465 | 1469 |
1466 ($frame) = grep { $_->{type} eq "RST_STREAM" } @$frames; | 1470 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
1467 ok($frame, 'dup stream - RST_STREAM frame'); | 1471 ok($frame, 'dup stream - GOAWAY frame'); |
1468 is($frame->{code}, 1, 'dup stream - error code'); | 1472 is($frame->{code}, 1, 'dup stream - error code'); |
1469 is($frame->{sid}, $sid, 'dup stream - stream'); | 1473 is($frame->{last_sid}, $sid, 'dup stream - last stream'); |
1470 | 1474 |
1471 } | 1475 } |
1472 | 1476 |
1473 # missing mandatory request header ':scheme' | 1477 # missing mandatory request header ':scheme' |
1474 | 1478 |