Mercurial > hg > nginx-tests
comparison stream_ssl_preread.t @ 1314:b6d941ff65f4
Tests: added stream ssl preread test for message fragmentation.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 30 Mar 2018 18:08:23 +0300 |
parents | 766bcbb632ee |
children | 8c764fd93b5e |
comparison
equal
deleted
inserted
replaced
1313:cc2f17cd9677 | 1314:b6d941ff65f4 |
---|---|
120 my $ssl = Net::SSLeay::new($ctx) or die; | 120 my $ssl = Net::SSLeay::new($ctx) or die; |
121 Net::SSLeay::set_tlsext_host_name($ssl, 'example.org') == 1 or die; | 121 Net::SSLeay::set_tlsext_host_name($ssl, 'example.org') == 1 or die; |
122 }; | 122 }; |
123 plan(skip_all => 'Net::SSLeay with OpenSSL SNI support required') if $@; | 123 plan(skip_all => 'Net::SSLeay with OpenSSL SNI support required') if $@; |
124 | 124 |
125 $t->plan(12); | 125 $t->plan(13); |
126 | 126 |
127 $t->write_file('openssl.conf', <<EOF); | 127 $t->write_file('openssl.conf', <<EOF); |
128 [ req ] | 128 [ req ] |
129 default_bits = 1024 | 129 default_bits = 1024 |
130 encrypt_key = no | 130 encrypt_key = no |
173 | 173 |
174 # allow record with older SSL version, such as 3.0 | 174 # allow record with older SSL version, such as 3.0 |
175 | 175 |
176 is(get_oldver(), 'foo', 'older version in ssl record'); | 176 is(get_oldver(), 'foo', 'older version in ssl record'); |
177 | 177 |
178 # SNI "foo|f" fragmented across TLS records | |
179 | |
180 is(get_frag(), 'foof', 'handshake fragment split on SNI'); | |
181 | |
178 $t->stop(); | 182 $t->stop(); |
179 | 183 |
180 is($t->read_file('status.log'), "400\n", 'preread buffer full - log'); | 184 is($t->read_file('status.log'), "400\n", 'preread buffer full - log'); |
181 | 185 |
182 ############################################################################### | 186 ############################################################################### |
187 | |
188 sub get_frag { | |
189 my $r = pack("N*", 0x16030100, 0x3b010000, 0x380303ac, | |
190 0x8c8678a0, 0xaa1e7eed, 0x3644eed6, 0xc3bd2c69, | |
191 0x7bc7deda, 0x249db0e3, 0x0c339eba, 0xa80b7600, | |
192 0x00020000, 0x0100000d, 0x00000009, 0x00070000, | |
193 0x04666f6f, 0x16030100); | |
194 $r .= pack("n", 0x0166); | |
195 | |
196 http($r); | |
197 } | |
183 | 198 |
184 sub get_short { | 199 sub get_short { |
185 my $r = pack("N*", 0x16030100, 0x38010000, 0x330303eb); | 200 my $r = pack("N*", 0x16030100, 0x38010000, 0x330303eb); |
186 $r .= pack("N*", 0x6357cdba, 0xa6b8d853, 0xf1f6ac0f); | 201 $r .= pack("N*", 0x6357cdba, 0xa6b8d853, 0xf1f6ac0f); |
187 $r .= pack("N*", 0xdf03178c, 0x0ae41824, 0xe7643682); | 202 $r .= pack("N*", 0xdf03178c, 0x0ae41824, 0xe7643682); |