From b0f344e4933f6ff927b10a7f340ce8c600bbebc8 Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Sat, 24 Jul 2004 04:14:26 +0000 Subject: Oh by the way, only use proxy mode for reading... --- ext/standard/ftp_fopen_wrapper.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'ext/standard/ftp_fopen_wrapper.c') diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index 4d6b28b53d..ce584cc018 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -384,12 +384,6 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch int allow_overwrite = 0; int read_write = 0; - if (context && - php_stream_context_get_option(context, "ftp", "proxy", &tmpzval) == SUCCESS) { - /* Use http wrapper to proxy ftp request */ - return php_stream_url_wrap_http(wrapper, path, mode, options, opened_path, context STREAMS_CC TSRMLS_CC); - } - tmp_line[0] = '\0'; if (strpbrk(mode, "r+")) { @@ -412,6 +406,18 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch return NULL; } + if (context && + php_stream_context_get_option(context, "ftp", "proxy", &tmpzval) == SUCCESS) { + if (read_write == 1) { + /* Use http wrapper to proxy ftp request */ + return php_stream_url_wrap_http(wrapper, path, mode, options, opened_path, context STREAMS_CC TSRMLS_CC); + } else { + /* ftp proxy is read-only */ + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP proxy may only be used in read mode"); + return NULL; + } + } + stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &resource, &use_ssl, &use_ssl_on_data TSRMLS_CC); if (!stream) { goto errexit; -- cgit v1.2.1