Req #44059 [Opn]: Able to get more infos about FTP
| From: | cmb@php.net | Date: | Wed, 07 Jul 2021 10:21:12 +0000 |
| Subject: | Req #44059 [Opn]: Able to get more infos about FTP | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234853@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=44059&edit=1
ID: 44059
Updated by: cmb@php.net
Reported by: daniel dot chobe at nextiraone dot de
Summary: Able to get more infos about FTP
Status: Open
Type: Feature/Change Request
Package: FTP related
Operating System: Linux
PHP Version: 5.2.5
Block user comment: N
Private report: N
New Comment:
> Could someone write a statement, please?
Consider to provide a PR[1] for better visibility.
[1] <https://github.com/php/php-src/pulls>
Previous Comments:
------------------------------------------------------------------------
[2009-04-17 06:54:58] daniel dot buschke at nextiraone dot de
Could someone write a statement, please?
It would be nice to know if this patch has any chance to get into the tree.
------------------------------------------------------------------------
[2008-02-06 08:19:26] daniel dot chobe at nextiraone dot de
--- ftp_save/php_ftp.c 2006-10-23 09:23:23.000000000 +0200
+++ ftp/php_ftp.c 2006-10-23 10:58:54.000000000 +0200
@@ -120,6 +120,10 @@
REGISTER_LONG_CONSTANT("FTP_FAILED", PHP_FTP_FAILED, CONST_PERSISTENT | CONST_CS);
REGISTER_LONG_CONSTANT("FTP_FINISHED", PHP_FTP_FINISHED, CONST_PERSISTENT |
CONST_CS);
REGISTER_LONG_CONSTANT("FTP_MOREDATA", PHP_FTP_MOREDATA, CONST_PERSISTENT |
CONST_CS);
+
+ REGISTER_LONG_CONSTANT("FTP_PASSIVPORT", PHP_FTP_PASSIVPORT, CONST_PERSISTENT |
CONST_CS);
+ REGISTER_LONG_CONSTANT("FTP_LASTRESPONSE", PHP_FTP_LASTRESPONSE, CONST_PERSISTENT
| CONST_CS);
+
return SUCCESS;
}
@@ -1195,6 +1199,10 @@
case PHP_FTP_OPT_AUTOSEEK:
RETURN_BOOL(ftp->autoseek);
break;
+ case PHP_FTP_LASTRESPONSE:
+ RETURN_STRING(ftp->inbuf, 1);
+ break;
+ case PHP_FTP_PASSIVPORT:
+ RETURN_LONG(((struct sockaddr_in *)& ftp->pasvaddr)->sin_port);
+ break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option
'%ld'", option);
RETURN_FALSE;
diff --new-file -u -r ftp_save/php_ftp.h ftp/php_ftp.h
--- ftp_save/php_ftp.h 2006-10-23 09:23:23.000000000 +0200
+++ ftp/php_ftp.h 2006-10-23 09:24:12.000000000 +0200
@@ -29,6 +29,8 @@
#define PHP_FTP_OPT_TIMEOUT_SEC 0
#define PHP_FTP_OPT_AUTOSEEK 1
+#define PHP_FTP_LASTRESPONSE 2
+#define PHP_FTP_PASSIVPORT 3
#define PHP_FTP_AUTORESUME -1
PHP_MINIT_FUNCTION(ftp);
------------------------------------------------------------------------
[2008-02-06 08:17:46] daniel dot chobe at nextiraone dot de
Description:
------------
The FTP Extension dont show the choosen passiv port. But sometime it helps if your have problem with
your connection.
The other thing your can get is the last ftp responseline. It also helps in case of problems with
FTP Connections.
Reproduce code:
---------------
<?php
# Connect, Login, Uploads, get Information
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
echo ftp_get_option($conn_id, FTP_LASTRESPONSE).PHP_EOL;
echo ftp_get_option($conn_id, FTP_PASSIVPORT).PHP_EOL;
ftp_close($conn_id);
?>
Expected result:
----------------
226 Transfer complete
43020
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=44059&edit=1