From: Stefan Esser Date: Sun, 8 Sep 2002 19:11:07 +0000 (+0000) Subject: Control connection gets closed in ssl mode now, too. X-Git-Tag: RELEASE_0_91~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9fca868f907a95bfb88a954dd1a497bdb32adbbc;p=php Control connection gets closed in ssl mode now, too. --- 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;