comparison ssl.t @ 1552:3b6b2667ece9

Tests: added https test with pipelined requests.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 28 Feb 2020 18:20:33 +0300
parents c6f27bcdd9d9
children 2f00ed2e0d1a
comparison
equal deleted inserted replaced
1551:27237569776f 1552:3b6b2667ece9
29 plan(skip_all => 'IO::Socket::SSL not installed') if $@; 29 plan(skip_all => 'IO::Socket::SSL not installed') if $@;
30 eval { IO::Socket::SSL::SSL_VERIFY_NONE(); }; 30 eval { IO::Socket::SSL::SSL_VERIFY_NONE(); };
31 plan(skip_all => 'IO::Socket::SSL too old') if $@; 31 plan(skip_all => 'IO::Socket::SSL too old') if $@;
32 32
33 my $t = Test::Nginx->new()->has(qw/http http_ssl rewrite proxy/) 33 my $t = Test::Nginx->new()->has(qw/http http_ssl rewrite proxy/)
34 ->has_daemon('openssl')->plan(23); 34 ->has_daemon('openssl')->plan(24);
35 35
36 $t->write_file_expand('nginx.conf', <<'EOF'); 36 $t->write_file_expand('nginx.conf', <<'EOF');
37 37
38 %%TEST_GLOBALS%% 38 %%TEST_GLOBALS%%
39 39
56 56
57 ssl_certificate_key inner.key; 57 ssl_certificate_key inner.key;
58 ssl_certificate inner.crt; 58 ssl_certificate inner.crt;
59 ssl_session_cache shared:SSL:1m; 59 ssl_session_cache shared:SSL:1m;
60 ssl_verify_client optional_no_ca; 60 ssl_verify_client optional_no_ca;
61
62 keepalive_requests 1000;
61 63
62 location / { 64 location / {
63 return 200 "body $ssl_session_reused"; 65 return 200 "body $ssl_session_reused";
64 } 66 }
65 location /id { 67 location /id {
279 281
280 # c->read->ready handling bug in ngx_ssl_recv(), triggered with chunked body 282 # c->read->ready handling bug in ngx_ssl_recv(), triggered with chunked body
281 283
282 like(get_body('/body', '0123456789', 20, 5), qr/X-Body: (0123456789){100}/, 284 like(get_body('/body', '0123456789', 20, 5), qr/X-Body: (0123456789){100}/,
283 'request body chunked'); 285 'request body chunked');
286
287 # pipelined requests
288
289 $s = get_ssl_socket(8085);
290 my $req = <<EOF;
291 GET / HTTP/1.1
292 Host: localhost
293
294 EOF
295
296 $req x= 1000;
297
298 my $r = http($req, socket => $s) || "";
299 is(() = $r =~ /(200 OK)/g, 1000, 'pipelined requests');
284 300
285 ############################################################################### 301 ###############################################################################
286 302
287 sub get { 303 sub get {
288 my ($uri, $port, $ctx) = @_; 304 my ($uri, $port, $ctx) = @_;