diff options
| author | Wez Furlong <wez@php.net> | 2003-02-27 17:43:38 +0000 |
|---|---|---|
| committer | Wez Furlong <wez@php.net> | 2003-02-27 17:43:38 +0000 |
| commit | fd61f69077f6156ca71dde60ecfd9ed9765a02db (patch) | |
| tree | 7285ad393cdb5a85107a3329d1ab2bcafe89f051 /ext/standard/ftp_fopen_wrapper.c | |
| parent | 560e33968de93250377606782949f5004affca83 (diff) | |
| download | php-git-fd61f69077f6156ca71dde60ecfd9ed9765a02db.tar.gz | |
Another big commit (tm).
Main Changes:
- Implement a socket transport layer for use by all code that needs to open
some kind of "special" socket for network or IPC.
- Extensions can register (and override) transports.
- Implement ftruncate() on streams via the ioctl-alike option interface.
- Implement mmap() on streams via the ioctl-alike option interface.
- Implement generic crypto API via the ioctl-alike option interface.
(currently only supports OpenSSL, but could support other SSL toolkits,
and other crypto transport protocols).
Impact:
- tcp sockets can be overloaded by the openssl capable sockets at runtime,
removing the link-time requirement for ssl:// and https:// sockets and
streams.
- checking stream types using PHP_STREAM_IS_SOCKET is deprecated, since
there are now a range of possible socket-type streams.
Working towards:
- socket servers using the new transport layer
- mmap support under win32
- Cleaner code.
# I will be updating the win32 build to add the new files shortly
# after this commit.
Diffstat (limited to 'ext/standard/ftp_fopen_wrapper.c')
| -rw-r--r-- | ext/standard/ftp_fopen_wrapper.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index 98b5a27892..192786058d 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -142,10 +142,8 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch char *scratch; int result; int i, use_ssl; -#if HAVE_OPENSSL_EXT int use_ssl_on_data=0; php_stream *reuseid=NULL; -#endif char *tpath, *ttpath, *hoststart=NULL; size_t file_size = 0; @@ -182,7 +180,6 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch goto errexit; } -#if HAVE_OPENSSL_EXT if (use_ssl) { /* send the AUTH TLS request name */ @@ -212,7 +209,9 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch } if (use_ssl) { - if (use_ssl && php_stream_sock_ssl_activate(stream, 1) == FAILURE) { + if (php_stream_xport_crypto_setup(stream, + STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 + || php_stream_xport_crypto_enable(stream, 1 TSRMLS_CC) < 0) { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode"); php_stream_close(stream); stream = NULL; @@ -240,8 +239,6 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch #endif } -#endif - /* send the user name */ php_stream_write_string(stream, "USER "); if (resource->user != NULL) { @@ -433,14 +430,15 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch php_stream_context_set(datastream, context); php_stream_notify_progress_init(context, 0, file_size); -#if HAVE_OPENSSL_EXT - if (use_ssl_on_data && php_stream_sock_ssl_activate_with_method(datastream, 1, SSLv23_method(), reuseid TSRMLS_CC) == FAILURE) { + if (use_ssl_on_data && (php_stream_xport_crypto_setup(stream, + STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 || + php_stream_xport_crypto_enable(stream, 1 TSRMLS_CC) < 0)) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode"); php_stream_close(datastream); datastream = NULL; goto errexit; } -#endif /* remember control stream */ datastream->wrapperdata = (zval *)stream; |
