summaryrefslogtreecommitdiff
path: root/ext/standard/ftp_fopen_wrapper.c
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2004-07-24 04:14:26 +0000
committerSara Golemon <pollita@php.net>2004-07-24 04:14:26 +0000
commitb0f344e4933f6ff927b10a7f340ce8c600bbebc8 (patch)
tree893e534d811489b67d3fcffa11f42c8abbb4712d /ext/standard/ftp_fopen_wrapper.c
parent93f795bb9e74a2e7cae0ead7deacdf311a7aa6c7 (diff)
downloadphp-git-b0f344e4933f6ff927b10a7f340ce8c600bbebc8.tar.gz
Oh by the way, only use proxy mode for reading...
Diffstat (limited to 'ext/standard/ftp_fopen_wrapper.c')
-rw-r--r--ext/standard/ftp_fopen_wrapper.c18
1 files changed, 12 insertions, 6 deletions
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;