Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #39583 : FTP function always transfers in binary mode
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 9th September 19:32
php-bugs@lists.php.net (ts dot serveroperations at wmdata dot
External User
 
Posts: 1
Default #39583 : FTP function always transfers in binary mode



From: ts dot serveroperations at wmdata dot com
Operating system: Redhat Enterprise ES version 4
PHP version: 4.4.4
PHP Bug Type: FTP related
Bug description: FTP function always transfers in binary mode

Description:
------------
The ftp function always transfer files in binary mode which results in
textfiles being corrupted with no newlines.

The configure line we used is
../configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
--enable-module=so --enable-ftp

We have not made any changes to php.ini.

We tested on both the latest CVS snapshot and PHP 4.4.4

The code below expects a file named testfile.txt to be located in
/var/www/html/ and a ftp server on localhost with user test, password
test, address localhost and a folder named testdir. When we look in the
logfile of the ftp server we see that the file actually was transferred in
binary mode, we tried 2 different ftp servers with the same result.

The ftp server and webserver are on the same machine (Linux Redhat), the
php page is browsed from a windows XP computer and testfile.txt is
downloaded and viewed in windows XP with notepad.

This bug resembles Bug #19036 but this is between windows and linux which
uses different newline characters. Therefore we must use ascii mode.

Reproduce code:
---------------
<?php

// set up basic connection
$ftp_server = "localhost";
$ftp_user_name = "test";
$ftp_user_pass = "test";


$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user
$ftp_user_name";
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
}

$source_file = "/var/www/html/testfile.txt";
$destination_file = "/testdir/testfile.txt";

// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_ASCII);

// check upload status
if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}

// close the FTP stream
ftp_close($conn_id);
?>


Expected result:
----------------
That the file was transferred in ascii mode and that the ftp server
logfile would confirm that.

Actual result:
--------------
The file was transferred in binary mode. This was verified when opening
the textfile and the newlines are gone, replaced by 3 squares. Also the
ftp server logfile states that the transfer was in binary mode.

This is true for both uploads and downloads.

FTP server works as expected when using a regular ftp application e.g.
flashfxp, filezilla etc.

--
Edit bug report at http://bugs.php.net/?id=39583&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39583&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39583&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39583&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39583&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=39583&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39583&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39583&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39583&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39583&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39583&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=39583&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=39583&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39583&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39583&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39583&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39583&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39583&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39583&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39583&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39583&r=mysqlcfg
  Reply With Quote


  sponsored links


2 9th September 21:04
tony2001
External User
 
Posts: 1
Default #39583 : FTP function always transfers in binary mode



ID: 39583
Updated by: tony2001@php.net
Reported By: ts dot serveroperations at wmdata dot com
-Status: Open
+Status: Feedback
Bug Type: FTP related
Operating System: Redhat Enterprise ES version 4
PHP Version: 4.4.4
New Comment:


Please get a decent TXT viewer instead of notepad.
AFAIK it was never able to display Unix line endings properly.

Does your FTP server understand "TYPE A" command?


Previous Comments:
------------------------------------------------------------------------

[2006-11-22 10:29:31] ts dot serveroperations at wmdata dot com

Description:
------------
The ftp function always transfer files in binary mode which results in
textfiles being corrupted with no newlines.

The configure line we used is
../configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
--enable-module=so --enable-ftp

We have not made any changes to php.ini.

We tested on both the latest CVS snapshot and PHP 4.4.4

The code below expects a file named testfile.txt to be located in
/var/www/html/ and a ftp server on localhost with user test, password
test, address localhost and a folder named testdir. When we look in the
logfile of the ftp server we see that the file actually was transferred
in binary mode, we tried 2 different ftp servers with the same result.

The ftp server and webserver are on the same machine (Linux Redhat),
the php page is browsed from a windows XP computer and testfile.txt is
downloaded and viewed in windows XP with notepad.

This bug resembles Bug #19036 but this is between windows and linux
which uses different newline characters. Therefore we must use ascii
mode.

Reproduce code:
---------------
<?php

// set up basic connection
$ftp_server = "localhost";
$ftp_user_name = "test";
$ftp_user_pass = "test";


$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user
$ftp_user_name";
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
}

$source_file = "/var/www/html/testfile.txt";
$destination_file = "/testdir/testfile.txt";

// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file,
FTP_ASCII);

// check upload status
if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as
$destination_file";
}

// close the FTP stream
ftp_close($conn_id);
?>


Expected result:
----------------
That the file was transferred in ascii mode and that the ftp server
logfile would confirm that.

Actual result:
--------------
The file was transferred in binary mode. This was verified when opening
the textfile and the newlines are gone, replaced by 3 squares. Also the
ftp server logfile states that the transfer was in binary mode.

This is true for both uploads and downloads.

FTP server works as expected when using a regular ftp application e.g.
flashfxp, filezilla etc.


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=39583&edit=1
  Reply With Quote
3 9th September 21:06
php-bugs@lists.php.net (ts dot serveroperations at wmdata dot
External User
 
Posts: 1
Default #39583 : FTP function always transfers in binary mode


ID: 39583
User updated by: ts dot serveroperations at wmdata dot com
Reported By: ts dot serveroperations at wmdata dot com
-Status: Feedback
+Status: Open
Bug Type: FTP related
Operating System: Redhat Enterprise ES version 4
PHP Version: 4.4.4
New Comment:

We need to be able to use notepad. However the unix like endings works
if the transfer mode is set to ascii.


If we run "TYPE ASCII" or just "ASCII" the server responds with:
200 Type set to A.

The problem is not that we use notepad, the problem is that all
transfers is in binary mode, even if we state FTP_ASCII in the ftp_put
or ftp_get functions.


Previous Comments:
------------------------------------------------------------------------

[2006-11-22 11:18:37] tony2001@php.net


Please get a decent TXT viewer instead of notepad.
AFAIK it was never able to display Unix line endings properly.

Does your FTP server understand "TYPE A" command?

------------------------------------------------------------------------

[2006-11-22 10:29:31] ts dot serveroperations at wmdata dot com

Description:
------------
The ftp function always transfer files in binary mode which results in
textfiles being corrupted with no newlines.

The configure line we used is
../configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
--enable-module=so --enable-ftp

We have not made any changes to php.ini.

We tested on both the latest CVS snapshot and PHP 4.4.4

The code below expects a file named testfile.txt to be located in
/var/www/html/ and a ftp server on localhost with user test, password
test, address localhost and a folder named testdir. When we look in the
logfile of the ftp server we see that the file actually was transferred
in binary mode, we tried 2 different ftp servers with the same result.

The ftp server and webserver are on the same machine (Linux Redhat),
the php page is browsed from a windows XP computer and testfile.txt is
downloaded and viewed in windows XP with notepad.

This bug resembles Bug #19036 but this is between windows and linux
which uses different newline characters. Therefore we must use ascii
mode.

Reproduce code:
---------------
<?php

// set up basic connection
$ftp_server = "localhost";
$ftp_user_name = "test";
$ftp_user_pass = "test";


$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user
$ftp_user_name";
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
}

$source_file = "/var/www/html/testfile.txt";
$destination_file = "/testdir/testfile.txt";

// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file,
FTP_ASCII);

// check upload status
if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as
$destination_file";
}

// close the FTP stream
ftp_close($conn_id);
?>


Expected result:
----------------
That the file was transferred in ascii mode and that the ftp server
logfile would confirm that.

Actual result:
--------------
The file was transferred in binary mode. This was verified when opening
the textfile and the newlines are gone, replaced by 3 squares. Also the
ftp server logfile states that the transfer was in binary mode.

This is true for both uploads and downloads.

FTP server works as expected when using a regular ftp application e.g.
flashfxp, filezilla etc.


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=39583&edit=1
  Reply With Quote
4 9th September 21:06
tony2001
External User
 
Posts: 1
Default #39583 : FTP function always transfers in binary mode


ID: 39583
Updated by: tony2001@php.net
Reported By: ts dot serveroperations at wmdata dot com
-Status: Open
+Status: Feedback
Bug Type: FTP related
Operating System: Redhat Enterprise ES version 4
PHP Version: 4.4.4
New Comment:

Is it possible to get a log of this FTP session to see what exactly is
passed to the server and what was its response?


Previous Comments:
------------------------------------------------------------------------

[2006-11-22 13:36:13] ts dot serveroperations at wmdata dot com

We need to be able to use notepad. However the unix like endings works
if the transfer mode is set to ascii.


If we run "TYPE ASCII" or just "ASCII" the server responds with:
200 Type set to A.

The problem is not that we use notepad, the problem is that all
transfers is in binary mode, even if we state FTP_ASCII in the ftp_put
or ftp_get functions.

------------------------------------------------------------------------

[2006-11-22 11:18:37] tony2001@php.net


Please get a decent TXT viewer instead of notepad.
AFAIK it was never able to display Unix line endings properly.

Does your FTP server understand "TYPE A" command?

------------------------------------------------------------------------

[2006-11-22 10:29:31] ts dot serveroperations at wmdata dot com

Description:
------------
The ftp function always transfer files in binary mode which results in
textfiles being corrupted with no newlines.

The configure line we used is
../configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
--enable-module=so --enable-ftp

We have not made any changes to php.ini.

We tested on both the latest CVS snapshot and PHP 4.4.4

The code below expects a file named testfile.txt to be located in
/var/www/html/ and a ftp server on localhost with user test, password
test, address localhost and a folder named testdir. When we look in the
logfile of the ftp server we see that the file actually was transferred
in binary mode, we tried 2 different ftp servers with the same result.

The ftp server and webserver are on the same machine (Linux Redhat),
the php page is browsed from a windows XP computer and testfile.txt is
downloaded and viewed in windows XP with notepad.

This bug resembles Bug #19036 but this is between windows and linux
which uses different newline characters. Therefore we must use ascii
mode.

Reproduce code:
---------------
<?php

// set up basic connection
$ftp_server = "localhost";
$ftp_user_name = "test";
$ftp_user_pass = "test";


$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user
$ftp_user_name";
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
}

$source_file = "/var/www/html/testfile.txt";
$destination_file = "/testdir/testfile.txt";

// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file,
FTP_ASCII);

// check upload status
if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as
$destination_file";
}

// close the FTP stream
ftp_close($conn_id);
?>


Expected result:
----------------
That the file was transferred in ascii mode and that the ftp server
logfile would confirm that.

Actual result:
--------------
The file was transferred in binary mode. This was verified when opening
the textfile and the newlines are gone, replaced by 3 squares. Also the
ftp server logfile states that the transfer was in binary mode.

This is true for both uploads and downloads.

FTP server works as expected when using a regular ftp application e.g.
flashfxp, filezilla etc.


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=39583&edit=1
  Reply With Quote
5 9th September 22:34
php-bugs@lists.php.net (ts dot serveroperations at wmdata dot
External User
 
Posts: 1
Default #39583 : FTP function always transfers in binary mode


ID: 39583
User updated by: ts dot serveroperations at wmdata dot com
Reported By: ts dot serveroperations at wmdata dot com
-Status: Feedback
+Status: Open
Bug Type: FTP related
Operating System: Redhat Enterprise ES version 4
PHP Version: 4.4.4
New Comment:

This is the transferlog from the ftpserver:
Wed Nov 22 15:08:25 2006 0 drops 83 /site/tempdir/testfile.txt b _ i r
temp ftp 0 *

The ftp server is glftpd 2.01 for i386 Linux

We sniffed the transfer using tcpdump, here's the output, sorry that it
is in HEX but we cut off all numbers to reduce linesize, but it is still
readable and you can make out 150.Opening.BINARY.mode:


547369717(0) win 32767 <mss 16396,sackOK,timestamp 2440911661
0,nop,wscale 2>
...............E.
..<..@.@.p.......
........p........
.........@......}
[-........
536371407(0) ack 3547369718 win 32767<mss 16396,sackOK,timestamp
2440911661 2440911661,nop,wscale 2>
...............E.
..<..@.@.<.......
............p....
...5x....@......}
[-.}[-....
92 <nop,nop,timestamp 2440911661 2440911661>
...............E.
..4..@.@.p.......
........p........
............}[-.}
[-
3538374111(0) win 32767 <mss 16396,sackOK,timestamp 2440911716
0,nop,wscale 2>
...............E.
..<..@.@.%.......
......q..M.......
.........@......}
[d........
3538374112 win 0
...............E.
..(..@.@.0.......
....q........M.P.
.......
1 win 8192 <nop,nop,timestamp 2440911721 2440911661>
...............E.
..l..@.@.V|......
............p....
....`.......}[i.}
[-220.localhost.
Dropsite..(glFTP
192 <nop,nop,timestamp 2440911721 2440911721>
...............E.
..4..@.@.p.......
........p........
............}[i.}
[i
57 win 8192 <nop,nop,timestamp 2440911722 2440911721>
...............E.
..?..@.@.p.......
........p........
....3.......}[j.}
[iUSER.temp..
192 <nop,nop,timestamp 2440911722 2440911722>
...............E.
..4..@.@.V.......
............p....
............}[j.}
[j
k 12 win 8192 <nop,nop,timestamp 2440911728 2440911722>
...............E.
..U..@.@.V.......
............p....
....I.......}[p.}
[j331.Password.r
equired.for.temp
k 90 win 8192 <nop,nop,timestamp 2440911728 2440911728>
...............E.
..?..@.@.p.......
........p.....)..
....3.......}[p.}
[pPASS.temp..
ack 23 win 8192 <nop,nop,timestamp 2440911736 2440911728>
...............E.
.....@.@.T.......
..........).p....
............}[x.}
[p230-..........
.................
8192 <nop,nop,timestamp 2440911776 2440911736>
...............E.
..4..@.@.p.......
........p........
............}[..}
[x
ack 23 win 8192 <nop,nop,timestamp 2440911782 2440911776>
...............E.
.....@.@.U.......
............p....
............}[..}
[.230-.`-=------
----------------
8192 <nop,nop,timestamp 2440911782 2440911782>
...............E.
..4..@.@.p.......
........p........
............}[..}
[.
k 711 win 8192 <nop,nop,timestamp 2440911783 2440911782>
...............E.
..L..@.@.p.......
........p........
....@.......}[..}
[.PORT.127,0,0,1
,138,186..
ack 47 win 8192 <nop,nop,timestamp 2440911787 2440911783>
...............E.
..R..@.@.V.......
............p.$..
....F.......}[..}
[.200.PORT.comma
nd.successful...
k 741 win 8192 <nop,nop,timestamp 2440911787 2440911787>
...............E.
..P..@.@.p.......
........p.$......
....D.......}[..}
[.STOR./tempdir/
testfile.txt..
:3545163343(0) win 32767 <mss 16396,sackOK,timestamp 2440911791
0,nop,wscale 2>
...............E.
..<..@.@.~.......
...1....N.O......
...,R....@......}
[.........
:3537573975(0) ack 3545163344 win 32767 <mss 16396,sackOK,timestamp
2440911791 2440911791,nop,wscale 2>
...............E.
..<..@.@.<.......
.....1....W.N.P..
...S.....@......}
[..}[.....
8192 <nop,nop,timestamp 2440911791 2440911791>
...............E.
..4..@.@.~.......
...1....N.P...X..
............}[..}
[.
ack 75 win 8192 <nop,nop,timestamp 2440911795 2440911787>
...............E.
..o..@.@.Vm......
............p.@..
....c.......}[..}
[.150.Opening.BI
NARY.mode.data.c
ck 1 win 8192 <nop,nop,timestamp 2440911795 2440911791>
...............E.
...C.@.@..w......
.....1....X.N.P..
....{.......}[..}
[.blasdjknas..q.
..dqw..dwe......f
8192 <nop,nop,timestamp 2440911795 2440911795>
...............E.
..4..@.@.~.......
...1....N.P......
............}[..}
[.
ck 1 win 8192 <nop,nop,timestamp 2440911795 2440911795>
...............E.
..4C.@.@.........
.....1......N.P..
............}[..}
[.
85 win 8192 <nop,nop,timestamp 2440911800 2440911795>
...............E.
..4..@.@.~.......
...1....N.P......
............}[..}
[.
8192 <nop,nop,timestamp 2440911800 2440911800>
...............E.
..4C.@.@.........
.....1......N.Q..
............}[..}
[.
8192 <nop,nop,timestamp 2440911835 2440911795>
...............E.
..4..@.@.p.......
........p.@......
............}[..}
[.
ack 75 win 8192 <nop,nop,timestamp 2440911838 2440911835>
...............E.
.....@.@.V/......
............p.@..
............}[..}
[.226-.[Ul:.0.0M
B].[Dl:.0.0MB].[
8192 <nop,nop,timestamp 2440911838 2440911838>
...............E.
..4..@.@.p.......
........p.@...f..
....T.......}[..}
[.
919 win 8192 <nop,nop,timestamp 2440911838 2440911838>
...............E.
..:..@.@.p.......
........p.@...f..
............}[..}
[.QUIT..
ack 81 win 8192 <nop,nop,timestamp 2440911847 2440911838>
...............E.
..B..@.@.V.......
..........f.p.F..
....6.......}[..}
[.221-.Goodbye..
ack 81 win 8192 <nop,nop,timestamp 2440911851 2440911838>
...............E.
..:..@.@.V.......
..........t.p.F..
............}[..}
[.221...
940 win 8192 <nop,nop,timestamp 2440911851 2440911847>
...............E.
..4..@.@.p.......
........p.F...{..
....".......}[..}
[.
192 <nop,nop,timestamp 2440911851 2440911851>
...............E.
..4..@.@.V.......
..........{.p.G..
............}[..}
[.


Previous Comments:
------------------------------------------------------------------------

[2006-11-22 13:47:02] tony2001@php.net

Is it possible to get a log of this FTP session to see what exactly is
passed to the server and what was its response?

------------------------------------------------------------------------

[2006-11-22 13:36:13] ts dot serveroperations at wmdata dot com

We need to be able to use notepad. However the unix like endings works
if the transfer mode is set to ascii.


If we run "TYPE ASCII" or just "ASCII" the server responds with:
200 Type set to A.

The problem is not that we use notepad, the problem is that all
transfers is in binary mode, even if we state FTP_ASCII in the ftp_put
or ftp_get functions.

------------------------------------------------------------------------

[2006-11-22 11:18:37] tony2001@php.net


Please get a decent TXT viewer instead of notepad.
AFAIK it was never able to display Unix line endings properly.

Does your FTP server understand "TYPE A" command?

------------------------------------------------------------------------

[2006-11-22 10:29:31] ts dot serveroperations at wmdata dot com

Description:
------------
The ftp function always transfer files in binary mode which results in
textfiles being corrupted with no newlines.

The configure line we used is
../configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
--enable-module=so --enable-ftp

We have not made any changes to php.ini.

We tested on both the latest CVS snapshot and PHP 4.4.4

The code below expects a file named testfile.txt to be located in
/var/www/html/ and a ftp server on localhost with user test, password
test, address localhost and a folder named testdir. When we look in the
logfile of the ftp server we see that the file actually was transferred
in binary mode, we tried 2 different ftp servers with the same result.

The ftp server and webserver are on the same machine (Linux Redhat),
the php page is browsed from a windows XP computer and testfile.txt is
downloaded and viewed in windows XP with notepad.

This bug resembles Bug #19036 but this is between windows and linux
which uses different newline characters. Therefore we must use ascii
mode.

Reproduce code:
---------------
<?php

// set up basic connection
$ftp_server = "localhost";
$ftp_user_name = "test";
$ftp_user_pass = "test";


$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user
$ftp_user_name";
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
}

$source_file = "/var/www/html/testfile.txt";
$destination_file = "/testdir/testfile.txt";

// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file,
FTP_ASCII);

// check upload status
if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as
$destination_file";
}

// close the FTP stream
ftp_close($conn_id);
?>


Expected result:
----------------
That the file was transferred in ascii mode and that the ftp server
logfile would confirm that.

Actual result:
--------------
The file was transferred in binary mode. This was verified when opening
the textfile and the newlines are gone, replaced by 3 squares. Also the
ftp server logfile states that the transfer was in binary mode.

This is true for both uploads and downloads.

FTP server works as expected when using a regular ftp application e.g.
flashfxp, filezilla etc.


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=39583&edit=1
  Reply With Quote
6 9th September 22:35
tony2001
External User
 
Posts: 1
Default #39583 : FTP function always transfers in binary mode


ID: 39583
Updated by: tony2001@php.net
Reported By: ts dot serveroperations at wmdata dot com
-Status: Open
+Status: Feedback
Bug Type: FTP related
Operating System: Redhat Enterprise ES version 4
PHP Version: 4.4.4
New Comment:

That's right, the default mode is binary, but I don't see any TYPE
commands in your log.
The ftp_put() function first sends "TYPE <type>" command and STOR after
that.
Can you trace it in gdb and set a breakpoint on "ftp_put" and
"ftp_type" functions to see how exactly they are executed?


Previous Comments:
------------------------------------------------------------------------

[2006-11-22 15:18:25] ts dot serveroperations at wmdata dot com

This is the transferlog from the ftpserver:
Wed Nov 22 15:08:25 2006 0 drops 83 /site/tempdir/testfile.txt b _ i r
temp ftp 0 *

The ftp server is glftpd 2.01 for i386 Linux

We sniffed the transfer using tcpdump, here's the output, sorry that it
is in HEX but we cut off all numbers to reduce linesize, but it is still
readable and you can make out 150.Opening.BINARY.mode:


547369717(0) win 32767 <mss 16396,sackOK,timestamp 2440911661
0,nop,wscale 2>
...............E.
..<..@.@.p.......
........p........
.........@......}
[-........
536371407(0) ack 3547369718 win 32767<mss 16396,sackOK,timestamp
2440911661 2440911661,nop,wscale 2>
...............E.
..<..@.@.<.......
............p....
...5x....@......}
[-.}[-....
92 <nop,nop,timestamp 2440911661 2440911661>
...............E.
..4..@.@.p.......
........p........
............}[-.}
[-
3538374111(0) win 32767 <mss 16396,sackOK,timestamp 2440911716
0,nop,wscale 2>
...............E.
..<..@.@.%.......
......q..M.......
.........@......}
[d........
3538374112 win 0
...............E.
..(..@.@.0.......
....q........M.P.
.......
1 win 8192 <nop,nop,timestamp 2440911721 2440911661>
...............E.
..l..@.@.V|......
............p....
....`.......}[i.}
[-220.localhost.
Dropsite..(glFTP
192 <nop,nop,timestamp 2440911721 2440911721>
...............E.
..4..@.@.p.......
........p........
............}[i.}
[i
57 win 8192 <nop,nop,timestamp 2440911722 2440911721>
...............E.
..?..@.@.p.......
........p........
....3.......}[j.}
[iUSER.temp..
192 <nop,nop,timestamp 2440911722 2440911722>
...............E.
..4..@.@.V.......
............p....
............}[j.}
[j
k 12 win 8192 <nop,nop,timestamp 2440911728 2440911722>
...............E.
..U..@.@.V.......
............p....
....I.......}[p.}
[j331.Password.r
equired.for.temp
k 90 win 8192 <nop,nop,timestamp 2440911728 2440911728>
...............E.
..?..@.@.p.......
........p.....)..
....3.......}[p.}
[pPASS.temp..
ack 23 win 8192 <nop,nop,timestamp 2440911736 2440911728>
...............E.
.....@.@.T.......
..........).p....
............}[x.}
[p230-..........
.................
8192 <nop,nop,timestamp 2440911776 2440911736>
...............E.
..4..@.@.p.......
........p........
............}[..}
[x
ack 23 win 8192 <nop,nop,timestamp 2440911782 2440911776>
...............E.
.....@.@.U.......
............p....
............}[..}
[.230-.`-=------
----------------
8192 <nop,nop,timestamp 2440911782 2440911782>
...............E.
..4..@.@.p.......
........p........
............}[..}
[.
k 711 win 8192 <nop,nop,timestamp 2440911783 2440911782>
...............E.
..L..@.@.p.......
........p........
....@.......}[..}
[.PORT.127,0,0,1
,138,186..
ack 47 win 8192 <nop,nop,timestamp 2440911787 2440911783>
...............E.
..R..@.@.V.......
............p.$..
....F.......}[..}
[.200.PORT.comma
nd.successful...
k 741 win 8192 <nop,nop,timestamp 2440911787 2440911787>
...............E.
..P..@.@.p.......
........p.$......
....D.......}[..}
[.STOR./tempdir/
testfile.txt..
:3545163343(0) win 32767 <mss 16396,sackOK,timestamp 2440911791
0,nop,wscale 2>
...............E.
..<..@.@.~.......
...1....N.O......
...,R....@......}
[.........
:3537573975(0) ack 3545163344 win 32767 <mss 16396,sackOK,timestamp
2440911791 2440911791,nop,wscale 2>
...............E.
..<..@.@.<.......
.....1....W.N.P..
...S.....@......}
[..}[.....
8192 <nop,nop,timestamp 2440911791 2440911791>
...............E.
..4..@.@.~.......
...1....N.P...X..
............}[..}
[.
ack 75 win 8192 <nop,nop,timestamp 2440911795 2440911787>
...............E.
..o..@.@.Vm......
............p.@..
....c.......}[..}
[.150.Opening.BI
NARY.mode.data.c
ck 1 win 8192 <nop,nop,timestamp 2440911795 2440911791>
...............E.
...C.@.@..w......
.....1....X.N.P..
....{.......}[..}
[.blasdjknas..q.
..dqw..dwe......f
8192 <nop,nop,timestamp 2440911795 2440911795>
...............E.
..4..@.@.~.......
...1....N.P......
............}[..}
[.
ck 1 win 8192 <nop,nop,timestamp 2440911795 2440911795>
...............E.
..4C.@.@.........
.....1......N.P..
............}[..}
[.
85 win 8192 <nop,nop,timestamp 2440911800 2440911795>
...............E.
..4..@.@.~.......
...1....N.P......
............}[..}
[.
8192 <nop,nop,timestamp 2440911800 2440911800>
...............E.
..4C.@.@.........
.....1......N.Q..
............}[..}
[.
8192 <nop,nop,timestamp 2440911835 2440911795>
...............E.
..4..@.@.p.......
........p.@......
............}[..}
[.
ack 75 win 8192 <nop,nop,timestamp 2440911838 2440911835>
...............E.
.....@.@.V/......
............p.@..
............}[..}
[.226-.[Ul:.0.0M
B].[Dl:.0.0MB].[
8192 <nop,nop,timestamp 2440911838 2440911838>
...............E.
..4..@.@.p.......
........p.@...f..
....T.......}[..}
[.
919 win 8192 <nop,nop,timestamp 2440911838 2440911838>
...............E.
..:..@.@.p.......
........p.@...f..
............}[..}
[.QUIT..
ack 81 win 8192 <nop,nop,timestamp 2440911847 2440911838>
...............E.
..B..@.@.V.......
..........f.p.F..
....6.......}[..}
[.221-.Goodbye..
ack 81 win 8192 <nop,nop,timestamp 2440911851 2440911838>
...............E.
..:..@.@.V.......
..........t.p.F..
............}[..}
[.221...
940 win 8192 <nop,nop,timestamp 2440911851 2440911847>
...............E.
..4..@.@.p.......
........p.F...{..
....".......}[..}
[.
192 <nop,nop,timestamp 2440911851 2440911851>
...............E.
..4..@.@.V.......
..........{.p.G..
............}[..}
[.

------------------------------------------------------------------------

[2006-11-22 13:47:02] tony2001@php.net

Is it possible to get a log of this FTP session to see what exactly is
passed to the server and what was its response?

------------------------------------------------------------------------

[2006-11-22 13:36:13] ts dot serveroperations at wmdata dot com

We need to be able to use notepad. However the unix like endings works
if the transfer mode is set to ascii.


If we run "TYPE ASCII" or just "ASCII" the server responds with:
200 Type set to A.

The problem is not that we use notepad, the problem is that all
transfers is in binary mode, even if we state FTP_ASCII in the ftp_put
or ftp_get functions.

------------------------------------------------------------------------

[2006-11-22 11:18:37] tony2001@php.net


Please get a decent TXT viewer instead of notepad.
AFAIK it was never able to display Unix line endings properly.

Does your FTP server understand "TYPE A" command?

------------------------------------------------------------------------

[2006-11-22 10:29:31] ts dot serveroperations at wmdata dot com

Description:
------------
The ftp function always transfer files in binary mode which results in
textfiles being corrupted with no newlines.

The configure line we used is
../configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
--enable-module=so --enable-ftp

We have not made any changes to php.ini.

We tested on both the latest CVS snapshot and PHP 4.4.4

The code below expects a file named testfile.txt to be located in
/var/www/html/ and a ftp server on localhost with user test, password
test, address localhost and a folder named testdir. When we look in the
logfile of the ftp server we see that the file actually was transferred
in binary mode, we tried 2 different ftp servers with the same result.

The ftp server and webserver are on the same machine (Linux Redhat),
the php page is browsed from a windows XP computer and testfile.txt is
downloaded and viewed in windows XP with notepad.

This bug resembles Bug #19036 but this is between windows and linux
which uses different newline characters. Therefore we must use ascii
mode.

Reproduce code:
---------------
<?php

// set up basic connection
$ftp_server = "localhost";
$ftp_user_name = "test";
$ftp_user_pass = "test";


$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user
$ftp_user_name";
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name";
}

$source_file = "/var/www/html/testfile.txt";
$destination_file = "/testdir/testfile.txt";

// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file,
FTP_ASCII);

// check upload status
if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as
$destination_file";
}

// close the FTP stream
ftp_close($conn_id);
?>


Expected result:
----------------
That the file was transferred in ascii mode and that the ftp server
logfile would confirm that.

Actual result:
--------------
The file was transferred in binary mode. This was verified when opening
the textfile and the newlines are gone, replaced by 3 squares. Also the
ftp server logfile states that the transfer was in binary mode.

This is true for both uploads and downloads.

FTP server works as expected when using a regular ftp application e.g.
flashfxp, filezilla etc.


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=39583&edit=1
  Reply With Quote
7 10th September 03:54
php-bugs@lists.php.net (ts dot serveroperations at wmdata dot
External User
 
Posts: 1
Default #39583 : FTP function always transfers in binary mode


ID: 39583
User updated by: ts dot serveroperations at wmdata dot com
Reported By: ts dot serveroperations at wmdata dot com
-Status: Feedback
+Status: Open
Bug Type: FTP related
Operating System: Redhat Enterprise ES version 4
PHP Version: 4.4.4
New Comment:

Is this what you wanted? I just breaked at the breakpoints, didn't do
any steps. I did this in command-line php. I recompiled PHP (CVS
version) with the following configure:

../configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
--enable-module=so --enable-ftp --enable-debug


If you want I can redo it with php 4.4.4.


# gdb /usr/local/bin/php
GNU gdb Red Hat Linux (6.1post-1.20040607.62rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host
libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) break ftp_put
Breakpoint 1 at 0x807bd51: file
/usr/local/src/php4-STABLE-200611211330/ext/ftp/ftp.c, line 759.
(gdb) break ftp_type
Breakpoint 2 at 0x807abc4: file
/usr/local/src/php4-STABLE-200611211330/ext/ftp/ftp.c, line 539.
(gdb) run /var/www/html/mupp/index.php
Starting program: /usr/local/bin/php /var/www/html/mupp/index.php
Connected to localhost, for user temp
Breakpoint 1, ftp_put (ftp=0x8628d1c, path=0x8628bfc
"/tempdir/testfile.txt", instream=0x8625f4c, type=FTPTYPE_ASCII,
startpos=140656052)
at /usr/local/src/php4-STABLE-200611211330/ext/ftp/ftp.c:759
759 {
(gdb) c
Continuing.

Breakpoint 2, ftp_type (ftp=0x0, type=140656052) at
/usr/local/src/php4-STABLE-200611211330/ext/ftp/ftp.c:539
539 {
(gdb) c
Continuing.
Uploaded /var/www/html/testfile.txt to localhost as
/tempdir/testfile.txt

Program exited normally.
(gdb)


Previous Comments:
------------------------------------------------------------------------

[2006-11-22 15:50:36] tony2001@php.net

That's right, the default mode is binary, but I don't see any TYPE
commands in your log.
The ftp_put() function first sends "TYPE <type>" command and STOR after
that.
Can you trace it in gdb and set a breakpoint on "ftp_put" and
"ftp_type" functions to see how exactly they are executed?

------------------------------------------------------------------------

[2006-11-22 15:18:25] ts dot serveroperations at wmdata dot com

This is the transferlog from the ftpserver:
Wed Nov 22 15:08:25 2006 0 drops 83 /site/tempdir/testfile.txt b _ i r
temp ftp 0 *

The ftp server is glftpd 2.01 for i386 Linux

We sniffed the transfer using tcpdump, here's the output, sorry that it
is in HEX but we cut off all numbers to reduce linesize, but it is still
readable and you can make out 150.Opening.BINARY.mode:


547369717(0) win 32767 <mss 16396,sackOK,timestamp 2440911661
0,nop,wscale 2>
...............E.
..<..@.@.p.......
........p........
.........@......}
[-........
536371407(0) ack 3547369718 win 32767<mss 16396,sackOK,timestamp
2440911661 2440911661,nop,wscale 2>
...............E.
..<..@.@.<.......
............p....
...5x....@......}
[-.}[-....
92 <nop,nop,timestamp 2440911661 2440911661>
...............E.
..4..@.@.p.......
........p........
............}[-.}
[-
3538374111(0) win 32767 <mss 16396,sackOK,timestamp 2440911716
0,nop,wscale 2>
...............E.
..<..@.@.%.......
......q..M.......
.........@......}
[d........
3538374112 win 0
...............E.
..(..@.@.0.......
....q........M.P.
.......
1 win 8192 <nop,nop,timestamp 2440911721 2440911661>
...............E.
..l..@.@.V|......
............p....
....`.......}[i.}
[-220.localhost.
Dropsite..(glFTP
192 <nop,nop,timestamp 2440911721 2440911721>
...............E.
..4..@.@.p.......
........p........
............}[i.}
[i
57 win 8192 <nop,nop,timestamp 2440911722 2440911721>
...............E.
..?..@.@.p.......
........p........
....3.......}[j.}
[iUSER.temp..
192 <nop,nop,timestamp 2440911722 2440911722>
...............E.
..4..@.@.V.......
............p....
............}[j.}
[j
k 12 win 8192 <nop,nop,timestamp 2440911728 2440911722>
...............E.
..U..@.@.V.......
............p....
....I.......}[p.}
[j331.Password.r
equired.for.temp
k 90 win 8192 <nop,nop,timestamp 2440911728 2440911728>
...............E.
..?..@.@.p.......
........p.....)..
....3.......}[p.}
[pPASS.temp..
ack 23 win 8192 <nop,nop,timestamp 2440911736 2440911728>
...............E.
.....@.@.T.......
..........).p....
............}[x.}
[p230-..........
.................
8192 <nop,nop,timestamp 2440911776 2440911736>
...............E.
..4..@.@.p.......
........p........
............}[..}
[x
ack 23 win 8192 <nop,nop,timestamp 2440911782 2440911776>
...............E.
.....@.@.U.......
............p....
............}[..}
[.230-.`-=------
----------------
8192 <nop,nop,timestamp 2440911782 2440911782>
...............E.
..4..@.@.p.......
........p........
............}[..}
[.
k 711 win 8192 <nop,nop,timestamp 2440911783 2440911782>
...............E.
..L..@.@.p.......
........p........
....@.......}[..}
[.PORT.127,0,0,1
,138,186..
ack 47 win 8192 <nop,nop,timestamp 2440911787 2440911783>
...............E.
..R..@.@.V.......
............p.$..
....F.......}[..}
[.200.PORT.comma
nd.successful...
k 741 win 8192 <nop,nop,timestamp 2440911787 2440911787>
...............E.
..P..@.@.p.......
........p.$......
....D.......}[..}
[.STOR./tempdir/
testfile.txt..
:3545163343(0) win 32767 <mss 16396,sackOK,timestamp 2440911791
0,nop,wscale 2>
...............E.
..<..@.@.~.......
...1....N.O......
...,R....@......}
[.........
:3537573975(0) ack 3545163344 win 32767 <mss 16396,sackOK,timestamp
2440911791 2440911791,nop,wscale 2>
...............E.
..<..@.@.<.......
.....1....W.N.P..
...S.....@......}
[..}[.....
8192 <nop,nop,timestamp 2440911791 2440911791>
...............E.
..4..@.@.~.......
...1....N.P...X..
............}[..}
[.
ack 75 win 8192 <nop,nop,timestamp 2440911795 2440911787>
...............E.
..o..@.@.Vm......
............p.@..
....c.......}[..}
[.150.Opening.BI
NARY.mode.data.c
ck 1 win 8192 <nop,nop,timestamp 2440911795 2440911791>
...............E.
...C.@.@..w......
.....1....X.N.P..
....{.......}[..}
[.blasdjknas..q.
..dqw..dwe......f
8192 <nop,nop,timestamp 2440911795 2440911795>
...............E.
..4..@.@.~.......
...1....N.P......
............}[..}
[.
ck 1 win 8192 <nop,nop,timestamp 2440911795 2440911795>
...............E.
..4C.@.@.........
.....1......N.P..
............}[..}
[.
85 win 8192 <nop,nop,timestamp 2440911800 2440911795>
...............E.
..4..@.@.~.......
...1....N.P......
............}[..}
[.
8192 <nop,nop,timestamp 2440911800 2440911800>
...............E.
..4C.@.@.........
.....1......N.Q..
............}[..}
[.
8192 <nop,nop,timestamp 2440911835 2440911795>
...............E.
..4..@.@.p.......
........p.@......
............}[..}
[.
ack 75 win 8192 <nop,nop,timestamp 2440911838 2440911835>
...............E.
.....@.@.V/......
............p.@..
............}[..}
[.226-.[Ul:.0.0M
B].[Dl:.0.0MB].[
8192 <nop,nop,timestamp 2440911838 2440911838>
...............E.
..4..@.@.p.......
........p.@...f..
....T.......}[..}
[.
919 win 8192 <nop,nop,timestamp 2440911838 2440911838>
...............E.
..:..@.@.p.......
........p.@...f..
............}[..}
[.QUIT..
ack 81 win 8192 <nop,nop,timestamp 2440911847 2440911838>
...............E.
..B..@.@.V.......
..........f.p.F..
....6.......}[..}
[.221-.Goodbye..
ack 81 win 8192 <nop,nop,timestamp 2440911851 2440911838>
...............E.
..:..@.@.V.......
..........t.p.F..
............}[..}
[.221...
940 win 8192 <nop,nop,timestamp 2440911851 2440911847>
...............E.
..4..@.@.p.......
........p.F...{..
....".......}[..}
[.
192 <nop,nop,timestamp 2440911851 2440911851>
...............E.
..4..@.@.V.......
..........{.p.G..
............}[..}
[.

------------------------------------------------------------------------

[2006-11-22 13:47:02] tony2001@php.net

Is it possible to get a log of this FTP session to see what exactly is
passed to the server and what was its response?

------------------------------------------------------------------------

[2006-11-22 13:36:13] ts dot serveroperations at wmdata dot com

We need to be able to use notepad. However the unix like endings works
if the transfer mode is set to ascii.


If we run "TYPE ASCII" or just "ASCII" the server responds with:
200 Type set to A.

The problem is not that we use notepad, the problem is that all
transfers is in binary mode, even if we state FTP_ASCII in the ftp_put
or ftp_get functions.

------------------------------------------------------------------------

[2006-11-22 11:18:37] tony2001@php.net


Please get a decent TXT viewer instead of notepad.
AFAIK it was never able to display Unix line endings properly.

Does your FTP server understand "TYPE A" command?

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/39583

--
Edit this bug report at http://bugs.php.net/?id=39583&edit=1
  Reply With Quote
8 10th September 06:19
tony2001
External User
 
Posts: 1
Default #39583 : FTP function always transfers in binary mode


ID: 39583
Updated by: tony2001@php.net
Reported By: ts dot serveroperations at wmdata dot com
-Status: Open
+Status: Closed
Bug Type: FTP related
Operating System: Redhat Enterprise ES version 4
PHP Version: 4.4.4
New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

Thank you for the report, and for helping us make PHP better.


Previous Comments:
------------------------------------------------------------------------

[2006-11-23 15:30:58] ts dot serveroperations at wmdata dot com

Is this what you wanted? I just breaked at the breakpoints, didn't do
any steps. I did this in command-line php. I recompiled PHP (CVS
version) with the following configure:

../configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
--enable-module=so --enable-ftp --enable-debug


If you want I can redo it with php 4.4.4.


# gdb /usr/local/bin/php
GNU gdb Red Hat Linux (6.1post-1.20040607.62rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host
libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) break ftp_put
Breakpoint 1 at 0x807bd51: file
/usr/local/src/php4-STABLE-200611211330/ext/ftp/ftp.c, line 759.
(gdb) break ftp_type
Breakpoint 2 at 0x807abc4: file
/usr/local/src/php4-STABLE-200611211330/ext/ftp/ftp.c, line 539.
(gdb) run /var/www/html/mupp/index.php
Starting program: /usr/local/bin/php /var/www/html/mupp/index.php
Connected to localhost, for user temp
Breakpoint 1, ftp_put (ftp=0x8628d1c, path=0x8628bfc
"/tempdir/testfile.txt", instream=0x8625f4c, type=FTPTYPE_ASCII,
startpos=140656052)
at /usr/local/src/php4-STABLE-200611211330/ext/ftp/ftp.c:759
759 {
(gdb) c
Continuing.

Breakpoint 2, ftp_type (ftp=0x0, type=140656052) at
/usr/local/src/php4-STABLE-200611211330/ext/ftp/ftp.c:539
539 {
(gdb) c
Continuing.
Uploaded /var/www/html/testfile.txt to localhost as
/tempdir/testfile.txt

Program exited normally.
(gdb)

------------------------------------------------------------------------

[2006-11-22 15:50:36] tony2001@php.net

That's right, the default mode is binary, but I don't see any TYPE
commands in your log.
The ftp_put() function first sends "TYPE <type>" command and STOR after
that.
Can you trace it in gdb and set a breakpoint on "ftp_put" and
"ftp_type" functions to see how exactly they are executed?

------------------------------------------------------------------------

[2006-11-22 15:18:25] ts dot serveroperations at wmdata dot com

This is the transferlog from the ftpserver:
Wed Nov 22 15:08:25 2006 0 drops 83 /site/tempdir/testfile.txt b _ i r
temp ftp 0 *

The ftp server is glftpd 2.01 for i386 Linux

We sniffed the transfer using tcpdump, here's the output, sorry that it
is in HEX but we cut off all numbers to reduce linesize, but it is still
readable and you can make out 150.Opening.BINARY.mode:


547369717(0) win 32767 <mss 16396,sackOK,timestamp 2440911661
0,nop,wscale 2>
...............E.
..<..@.@.p.......
........p........
.........@......}
[-........
536371407(0) ack 3547369718 win 32767<mss 16396,sackOK,timestamp
2440911661 2440911661,nop,wscale 2>
...............E.
..<..@.@.<.......
............p....
...5x....@......}
[-.}[-....
92 <nop,nop,timestamp 2440911661 2440911661>
...............E.
..4..@.@.p.......
........p........
............}[-.}
[-
3538374111(0) win 32767 <mss 16396,sackOK,timestamp 2440911716
0,nop,wscale 2>
...............E.
..<..@.@.%.......
......q..M.......
.........@......}
[d........
3538374112 win 0
...............E.
..(..@.@.0.......
....q........M.P.
.......
1 win 8192 <nop,nop,timestamp 2440911721 2440911661>
...............E.
..l..@.@.V|......
............p....
....`.......}[i.}
[-220.localhost.
Dropsite..(glFTP
192 <nop,nop,timestamp 2440911721 2440911721>
...............E.
..4..@.@.p.......
........p........
............}[i.}
[i
57 win 8192 <nop,nop,timestamp 2440911722 2440911721>
...............E.
..?..@.@.p.......
........p........
....3.......}[j.}
[iUSER.temp..
192 <nop,nop,timestamp 2440911722 2440911722>
...............E.
..4..@.@.V.......
............p....
............}[j.}
[j
k 12 win 8192 <nop,nop,timestamp 2440911728 2440911722>
...............E.
..U..@.@.V.......
............p....
....I.......}[p.}
[j331.Password.r
equired.for.temp
k 90 win 8192 <nop,nop,timestamp 2440911728 2440911728>
...............E.
..?..@.@.p.......
........p.....)..
....3.......}[p.}
[pPASS.temp..
ack 23 win 8192 <nop,nop,timestamp 2440911736 2440911728>
...............E.
.....@.@.T.......
..........).p....
............}[x.}
[p230-..........
.................
8192 <nop,nop,timestamp 2440911776 2440911736>
...............E.
..4..@.@.p.......
........p........
............}[..}
[x
ack 23 win 8192 <nop,nop,timestamp 2440911782 2440911776>
...............E.
.....@.@.U.......
............p....
............}[..}
[.230-.`-=------
----------------
8192 <nop,nop,timestamp 2440911782 2440911782>
...............E.
..4..@.@.p.......
........p........
............}[..}
[.
k 711 win 8192 <nop,nop,timestamp 2440911783 2440911782>
...............E.
..L..@.@.p.......
........p........
....@.......}[..}
[.PORT.127,0,0,1
,138,186..
ack 47 win 8192 <nop,nop,timestamp 2440911787 2440911783>
...............E.
..R..@.@.V.......
............p.$..
....F.......}[..}
[.200.PORT.comma
nd.successful...
k 741 win 8192 <nop,nop,timestamp 2440911787 2440911787>
...............E.
..P..@.@.p.......
........p.$......
....D.......}[..}
[.STOR./tempdir/
testfile.txt..
:3545163343(0) win 32767 <mss 16396,sackOK,timestamp 2440911791
0,nop,wscale 2>
...............E.
..<..@.@.~.......
...1....N.O......
...,R....@......}
[.........
:3537573975(0) ack 3545163344 win 32767 <mss 16396,sackOK,timestamp
2440911791 2440911791,nop,wscale 2>
...............E.
..<..@.@.<.......
.....1....W.N.P..
...S.....@......}
[..}[.....
8192 <nop,nop,timestamp 2440911791 2440911791>
...............E.
..4..@.@.~.......
...1....N.P...X..
............}[..}
[.
ack 75 win 8192 <nop,nop,timestamp 2440911795 2440911787>
...............E.
..o..@.@.Vm......
............p.@..
....c.......}[..}
[.150.Opening.BI
NARY.mode.data.c
ck 1 win 8192 <nop,nop,timestamp 2440911795 2440911791>
...............E.
...C.@.@..w......
.....1....X.N.P..
....{.......}[..}
[.blasdjknas..q.
..dqw..dwe......f
8192 <nop,nop,timestamp 2440911795 2440911795>
...............E.
..4..@.@.~.......
...1....N.P......
............}[..}
[.
ck 1 win 8192 <nop,nop,timestamp 2440911795 2440911795>
...............E.
..4C.@.@.........
.....1......N.P..
............}[..}
[.
85 win 8192 <nop,nop,timestamp 2440911800 2440911795>
...............E.
..4..@.@.~.......
...1....N.P......
............}[..}
[.
8192 <nop,nop,timestamp 2440911800 2440911800>
...............E.
..4C.@.@.........
.....1......N.Q..
............}[..}
[.
8192 <nop,nop,timestamp 2440911835 2440911795>
...............E.
..4..@.@.p.......
........p.@......
............}[..}
[.
ack 75 win 8192 <nop,nop,timestamp 2440911838 2440911835>
...............E.
.....@.@.V/......
............p.@..
............}[..}
[.226-.[Ul:.0.0M
B].[Dl:.0.0MB].[
8192 <nop,nop,timestamp 2440911838 2440911838>
...............E.
..4..@.@.p.......
........p.@...f..
....T.......}[..}
[.
919 win 8192 <nop,nop,timestamp 2440911838 2440911838>
...............E.
..:..@.@.p.......
........p.@...f..
............}[..}
[.QUIT..
ack 81 win 8192 <nop,nop,timestamp 2440911847 2440911838>
...............E.
..B..@.@.V.......
..........f.p.F..
....6.......}[..}
[.221-.Goodbye..
ack 81 win 8192 <nop,nop,timestamp 2440911851 2440911838>
...............E.
..:..@.@.V.......
..........t.p.F..
............}[..}
[.221...
940 win 8192 <nop,nop,timestamp 2440911851 2440911847>
...............E.
..4..@.@.p.......
........p.F...{..
....".......}[..}
[.
192 <nop,nop,timestamp 2440911851 2440911851>
...............E.
..4..@.@.V.......
..........{.p.G..
............}[..}
[.

------------------------------------------------------------------------

[2006-11-22 13:47:02] tony2001@php.net

Is it possible to get a log of this FTP session to see what exactly is
passed to the server and what was its response?

------------------------------------------------------------------------

[2006-11-22 13:36:13] ts dot serveroperations at wmdata dot com

We need to be able to use notepad. However the unix like endings works
if the transfer mode is set to ascii.


If we run "TYPE ASCII" or just "ASCII" the server responds with:
200 Type set to A.

The problem is not that we use notepad, the problem is that all
transfers is in binary mode, even if we state FTP_ASCII in the ftp_put
or ftp_get functions.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/39583

--
Edit this bug report at http://bugs.php.net/?id=39583&edit=1
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666