summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Esser <sesser@php.net>2002-09-08 19:11:07 +0000
committerStefan Esser <sesser@php.net>2002-09-08 19:11:07 +0000
commit9fca868f907a95bfb88a954dd1a497bdb32adbbc (patch)
tree4478b8a2627f71ddc9bffbaecfe846fbcf89df18
parent7dd7d39385d21ec48a283ecc1e11bbe5195f3b20 (diff)
downloadphp-git-9fca868f907a95bfb88a954dd1a497bdb32adbbc.tar.gz
Control connection gets closed in ssl mode now, too.
-rw-r--r--ext/standard/ftp_fopen_wrapper.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index e4d44bf8ee..7a62a7e40f 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -100,9 +100,24 @@ static int php_stream_ftp_stream_stat(php_stream_wrapper *wrapper,
}
+static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper,
+ php_stream *stream
+ TSRMLS_DC)
+{
+ php_stream *controlstream = (php_stream *)stream->wrapperdata;
+
+ if (controlstream) {
+ php_stream_write_string(controlstream, "QUIT\r\n");
+ php_stream_close(controlstream);
+ stream->wrapperdata = NULL;
+ }
+ return 0;
+}
+
+
static php_stream_wrapper_ops ftp_stream_wops = {
php_stream_url_wrap_ftp,
- NULL, /* stream_close */
+ php_stream_ftp_stream_close, /* stream_close */
php_stream_ftp_stream_stat,
NULL, /* stat_url */
NULL /* opendir */
@@ -373,12 +388,16 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch
if (!use_ssl) {
php_stream_write_string(stream, "QUIT\r\n");
php_stream_close(stream);
+ stream = NULL;
}
/* open the data channel */
datastream = php_stream_sock_open_host(resource->host, portno, SOCK_STREAM, 0, 0);
if (datastream == NULL)
goto errexit;
+
+ /* remember control stream */
+ datastream->wrapperdata = (zval *)stream;
php_stream_context_set(datastream, context);
php_stream_notify_progress_init(context, 0, file_size);
@@ -390,7 +409,6 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch
goto errexit;
}
-
php_url_free(resource);
return datastream;