comparison ssl_proxy_protocol.t @ 1866:a797d7428fa5

Tests: simplified http SSL tests with IO::Socket::SSL. The http SSL tests which previously used IO::Socket::SSL were converted to use improved IO::Socket::SSL infrastructure in Test::Nginx.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 18 May 2023 18:07:19 +0300
parents cdcd75657e52
children
comparison
equal deleted inserted replaced
1865:0e1865aa9b33 1866:a797d7428fa5
146 sub pp_get { 146 sub pp_get {
147 my ($url, $proxy) = @_; 147 my ($url, $proxy) = @_;
148 148
149 my $s = http($proxy, start => 1); 149 my $s = http($proxy, start => 1);
150 150
151 eval { 151 return http(<<EOF, socket => $s, SSL => 1);
152 local $SIG{ALRM} = sub { die "timeout\n" };
153 local $SIG{PIPE} = sub { die "sigpipe\n" };
154 alarm(8);
155 IO::Socket::SSL->start_SSL($s,
156 SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(),
157 SSL_error_trap => sub { die $_[1] }
158 );
159 alarm(0);
160 };
161 alarm(0);
162
163 if ($@) {
164 log_in("died: $@");
165 return undef;
166 }
167
168 return http(<<EOF, socket => $s);
169 GET $url HTTP/1.0 152 GET $url HTTP/1.0
170 Host: localhost 153 Host: localhost
171 154
172 EOF 155 EOF
173 } 156 }