comparison h2_proxy_protocol.t @ 882:e309d9701007

Tests: avoid RST in HTTP/2 proxy_protocol tests. Do not write to a socket that was shut down by the peer. On win32 this can result in WSAECONNABORTED read error before all pending data was delivered.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 24 Mar 2016 01:13:01 +0300
parents a6abbfed42c0
children e3df9c2100de
comparison
equal deleted inserted replaced
881:56ed4be9ff41 882:e309d9701007
68 ok($frame, 'PROXY HEADERS frame'); 68 ok($frame, 'PROXY HEADERS frame');
69 is($frame->{headers}->{'x-pp'}, '192.0.2.1', 'PROXY remote addr'); 69 is($frame->{headers}->{'x-pp'}, '192.0.2.1', 'PROXY remote addr');
70 70
71 # invalid PROXY protocol string 71 # invalid PROXY protocol string
72 72
73 $sess = new_session(8081, proxy => 'BOGUS TCP4 192.0.2.1 192.0.2.2 1234 5678', 73 my $s = http('BOGUS TCP4 192.0.2.1 192.0.2.2 1234 5678', start => 1);
74 pure => 1); 74 $frames = h2_read({ socket => $s }, all => [{ type => 'GOAWAY' }]);
75 $frames = h2_read($sess, all => [{ type => 'GOAWAY' }]);
76 75
77 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; 76 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
78 ok($frame, 'invalid PROXY - GOAWAY frame'); 77 ok($frame, 'invalid PROXY - GOAWAY frame');
79 is($frame->{code}, 1, 'invalid PROXY - error code'); 78 is($frame->{code}, 1, 'invalid PROXY - error code');
80 79