… | |
… | |
2193 | $self->{tls} = $tls = $self->{tls_ctx}->_get_session ($tls, $self, $self->{peername}); |
2193 | $self->{tls} = $tls = $self->{tls_ctx}->_get_session ($tls, $self, $self->{peername}); |
2194 | |
2194 | |
2195 | # basically, this is deep magic (because SSL_read should have the same issues) |
2195 | # basically, this is deep magic (because SSL_read should have the same issues) |
2196 | # but the openssl maintainers basically said: "trust us, it just works". |
2196 | # but the openssl maintainers basically said: "trust us, it just works". |
2197 | # (unfortunately, we have to hardcode constants because the abysmally misdesigned |
2197 | # (unfortunately, we have to hardcode constants because the abysmally misdesigned |
2198 | # and mismaintained ssleay-module doesn't even offer them). |
2198 | # and mismaintained ssleay-module didn't offer them for a decade or so). |
2199 | # http://www.mail-archive.com/openssl-dev@openssl.org/msg22420.html |
2199 | # http://www.mail-archive.com/openssl-dev@openssl.org/msg22420.html |
2200 | # |
2200 | # |
2201 | # in short: this is a mess. |
2201 | # in short: this is a mess. |
2202 | # |
2202 | # |
2203 | # note that we do not try to keep the length constant between writes as we are required to do. |
2203 | # note that we do not try to keep the length constant between writes as we are required to do. |
2204 | # we assume that most (but not all) of this insanity only applies to non-blocking cases, |
2204 | # we assume that most (but not all) of this insanity only applies to non-blocking cases, |
2205 | # and we drive openssl fully in blocking mode here. Or maybe we don't - openssl seems to |
2205 | # and we drive openssl fully in blocking mode here. Or maybe we don't - openssl seems to |
2206 | # have identity issues in that area. |
2206 | # have identity issues in that area. |
2207 | # Net::SSLeay::CTX_set_mode ($ssl, |
2207 | # Net::SSLeay::set_mode ($ssl, |
2208 | # (eval { local $SIG{__DIE__}; Net::SSLeay::MODE_ENABLE_PARTIAL_WRITE () } || 1) |
2208 | # (eval { local $SIG{__DIE__}; Net::SSLeay::MODE_ENABLE_PARTIAL_WRITE () } || 1) |
2209 | # | (eval { local $SIG{__DIE__}; Net::SSLeay::MODE_ACCEPT_MOVING_WRITE_BUFFER () } || 2)); |
2209 | # | (eval { local $SIG{__DIE__}; Net::SSLeay::MODE_ACCEPT_MOVING_WRITE_BUFFER () } || 2)); |
2210 | Net::SSLeay::CTX_set_mode ($tls, 1|2); |
2210 | Net::SSLeay::set_mode ($tls, 1|2); |
2211 | |
2211 | |
2212 | $self->{_rbio} = Net::SSLeay::BIO_new (Net::SSLeay::BIO_s_mem ()); |
2212 | $self->{_rbio} = Net::SSLeay::BIO_new (Net::SSLeay::BIO_s_mem ()); |
2213 | $self->{_wbio} = Net::SSLeay::BIO_new (Net::SSLeay::BIO_s_mem ()); |
2213 | $self->{_wbio} = Net::SSLeay::BIO_new (Net::SSLeay::BIO_s_mem ()); |
2214 | |
2214 | |
2215 | Net::SSLeay::BIO_write ($self->{_rbio}, $self->{rbuf}); |
2215 | Net::SSLeay::BIO_write ($self->{_rbio}, $self->{rbuf}); |