Lines 1517-1523
static long op_bio_retry_ctrl(BIO *_b,int _cmd,long _num,void *_ptr){
Link Here
|
1517 |
return ret; |
1517 |
return ret; |
1518 |
} |
1518 |
} |
1519 |
|
1519 |
|
1520 |
# if OPENSSL_VERSION_NUMBER<0x10100000L |
1520 |
# if OPENSSL_VERSION_NUMBER<0x10100000L || LIBRESSL_VERSION_NUMBER<=0x2040100fL |
1521 |
# define BIO_set_data(_b,_ptr) ((_b)->ptr=(_ptr)) |
1521 |
# define BIO_set_data(_b,_ptr) ((_b)->ptr=(_ptr)) |
1522 |
# define BIO_set_init(_b,_init) ((_b)->init=(_init)) |
1522 |
# define BIO_set_init(_b,_init) ((_b)->init=(_init)) |
1523 |
# endif |
1523 |
# endif |
Lines 1535-1541
static int op_bio_retry_free(BIO *_b){
Link Here
|
1535 |
return _b!=NULL; |
1535 |
return _b!=NULL; |
1536 |
} |
1536 |
} |
1537 |
|
1537 |
|
1538 |
# if OPENSSL_VERSION_NUMBER<0x10100000L |
1538 |
# if OPENSSL_VERSION_NUMBER<0x10100000L || LIBRESSL_VERSION_NUMBER<=0x2040100fL |
1539 |
/*This is not const because OpenSSL doesn't allow it, even though it won't |
1539 |
/*This is not const because OpenSSL doesn't allow it, even though it won't |
1540 |
write to it.*/ |
1540 |
write to it.*/ |
1541 |
static BIO_METHOD op_bio_retry_method={ |
1541 |
static BIO_METHOD op_bio_retry_method={ |
Lines 1556-1562
static BIO_METHOD op_bio_retry_method={
Link Here
|
1556 |
proxying https URL requests.*/ |
1556 |
proxying https URL requests.*/ |
1557 |
static int op_http_conn_establish_tunnel(OpusHTTPStream *_stream, |
1557 |
static int op_http_conn_establish_tunnel(OpusHTTPStream *_stream, |
1558 |
OpusHTTPConn *_conn,op_sock _fd,SSL *_ssl_conn,BIO *_ssl_bio){ |
1558 |
OpusHTTPConn *_conn,op_sock _fd,SSL *_ssl_conn,BIO *_ssl_bio){ |
1559 |
# if OPENSSL_VERSION_NUMBER>=0x10100000L |
1559 |
# if OPENSSL_VERSION_NUMBER>=0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) |
1560 |
BIO_METHOD *bio_retry_method; |
1560 |
BIO_METHOD *bio_retry_method; |
1561 |
# endif |
1561 |
# endif |
1562 |
BIO *retry_bio; |
1562 |
BIO *retry_bio; |
Lines 1569-1575
static int op_http_conn_establish_tunnel(OpusHTTPStream *_stream,
Link Here
|
1569 |
ret=op_http_conn_write_fully(_conn, |
1569 |
ret=op_http_conn_write_fully(_conn, |
1570 |
_stream->proxy_connect.buf,_stream->proxy_connect.nbuf); |
1570 |
_stream->proxy_connect.buf,_stream->proxy_connect.nbuf); |
1571 |
if(OP_UNLIKELY(ret<0))return ret; |
1571 |
if(OP_UNLIKELY(ret<0))return ret; |
1572 |
# if OPENSSL_VERSION_NUMBER>=0x10100000L |
1572 |
# if OPENSSL_VERSION_NUMBER>=0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) |
1573 |
bio_retry_method=BIO_meth_new(BIO_TYPE_NULL,"retry"); |
1573 |
bio_retry_method=BIO_meth_new(BIO_TYPE_NULL,"retry"); |
1574 |
if(bio_retry_method==NULL)return OP_EFAULT; |
1574 |
if(bio_retry_method==NULL)return OP_EFAULT; |
1575 |
BIO_meth_set_write(bio_retry_method,op_bio_retry_write); |
1575 |
BIO_meth_set_write(bio_retry_method,op_bio_retry_write); |
Lines 1592-1598
static int op_http_conn_establish_tunnel(OpusHTTPStream *_stream,
Link Here
|
1592 |
/*This shouldn't succeed, since we can't read yet.*/ |
1592 |
/*This shouldn't succeed, since we can't read yet.*/ |
1593 |
OP_ALWAYS_TRUE(SSL_connect(_ssl_conn)<0); |
1593 |
OP_ALWAYS_TRUE(SSL_connect(_ssl_conn)<0); |
1594 |
SSL_set_bio(_ssl_conn,_ssl_bio,_ssl_bio); |
1594 |
SSL_set_bio(_ssl_conn,_ssl_bio,_ssl_bio); |
1595 |
# if OPENSSL_VERSION_NUMBER>=0x10100000L |
1595 |
# if OPENSSL_VERSION_NUMBER>=0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) |
1596 |
BIO_meth_free(bio_retry_method); |
1596 |
BIO_meth_free(bio_retry_method); |
1597 |
# endif |
1597 |
# endif |
1598 |
/*Only now do we disable write coalescing, to allow the CONNECT |
1598 |
/*Only now do we disable write coalescing, to allow the CONNECT |
Lines 2231-2237
static int op_http_stream_open(OpusHTTPStream *_stream,const char *_url,
Link Here
|
2231 |
/*Initialize the SSL library if necessary.*/ |
2231 |
/*Initialize the SSL library if necessary.*/ |
2232 |
if(OP_URL_IS_SSL(&_stream->url)&&_stream->ssl_ctx==NULL){ |
2232 |
if(OP_URL_IS_SSL(&_stream->url)&&_stream->ssl_ctx==NULL){ |
2233 |
SSL_CTX *ssl_ctx; |
2233 |
SSL_CTX *ssl_ctx; |
2234 |
# if OPENSSL_VERSION_NUMBER<0x10100000L |
2234 |
# if OPENSSL_VERSION_NUMBER<0x10100000L || LIBRESSL_VERSION_NUMBER<=0x2040100fL |
2235 |
# if !defined(OPENSSL_NO_LOCKING) |
2235 |
# if !defined(OPENSSL_NO_LOCKING) |
2236 |
/*The documentation says SSL_library_init() is not reentrant. |
2236 |
/*The documentation says SSL_library_init() is not reentrant. |
2237 |
We don't want to add our own depenencies on a threading library, and it |
2237 |
We don't want to add our own depenencies on a threading library, and it |