iliaa           Mon Nov 25 17:01:46 2002 EDT

  Modified files:              (Branch: PHP_4_3)
    /php4/ext/standard  ftp_fopen_wrapper.c 
  Log:
  MFH
  
  
Index: php4/ext/standard/ftp_fopen_wrapper.c
diff -u php4/ext/standard/ftp_fopen_wrapper.c:1.38 
php4/ext/standard/ftp_fopen_wrapper.c:1.38.2.1
--- php4/ext/standard/ftp_fopen_wrapper.c:1.38  Thu Nov  7 22:02:51 2002
+++ php4/ext/standard/ftp_fopen_wrapper.c       Mon Nov 25 17:01:46 2002
@@ -17,7 +17,7 @@
    |          Hartmut Holzgraefe <[EMAIL PROTECTED]>                       |
    +----------------------------------------------------------------------+
  */
-/* $Id: ftp_fopen_wrapper.c,v 1.38 2002/11/08 03:02:51 iliaa Exp $ */
+/* $Id: ftp_fopen_wrapper.c,v 1.38.2.1 2002/11/25 22:01:46 iliaa Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -402,21 +402,32 @@
                php_stream_write_string(stream, "/");
        }
        php_stream_write_string(stream, "\r\n");
+       
+       /* open the data channel */
+       if (hoststart == NULL) {
+               hoststart = resource->host;
+       }
+       datastream = php_stream_sock_open_host(hoststart, portno, SOCK_STREAM, 0, 0);
+       if (datastream == NULL) {
+               goto errexit;
+       }
 
+       result = GET_FTP_RESULT(stream);
+       if (result != 150) {
+               /* Could not retrieve or send the file 
+                * this data will only be sent to us after connection on the data port 
+was initiated.
+                */
+               php_stream_close(datastream);
+               datastream = NULL;
+               goto errexit;   
+       }
+       
        /* close control connection if not in ssl mode */
        if (!use_ssl) {
                php_stream_write_string(stream, "QUIT\r\n");
                php_stream_close(stream);
                stream = NULL;
        }
-
-       /* open the data channel */
-       if (hoststart == NULL) {
-               hoststart = resource->host;
-       }
-       datastream = php_stream_sock_open_host(hoststart, portno, SOCK_STREAM, 0, 0);
-       if (datastream == NULL)
-               goto errexit;
                
        php_stream_context_set(datastream, context);
        php_stream_notify_progress_init(context, 0, file_size);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to