You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "David Latorre (JIRA)" <ji...@apache.org> on 2008/09/24 12:37:44 UTC
[jira] Created: (FTPSERVER-184) IODataConnection ASCII mode does
not work as expected.
IODataConnection ASCII mode does not work as expected.
------------------------------------------------------
Key: FTPSERVER-184
URL: https://issues.apache.org/jira/browse/FTPSERVER-184
Project: FtpServer
Issue Type: Improvement
Reporter: David Latorre
New lines in files sent in ASCII mode are transformed into /r/n no matter what platform the ftp server is running on. But if I'm not wrong, the new EOL should be equal to "line.separator" . If ASCII mode is going to be supported, this ought to be changed.
The code in IODataConnection.transfer()
{
if (isAscii) {
for (int i = 0; i < count; ++i) {
byte b = buff[i];
if (b == '\n' && !lastWasCR) {
bos.write('\r');
}
if (b == '\r') {
lastWasCR = true;
} else {
lastWasCR = false;
}
bos.write(b);
}
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
Re: [jira] Commented: (FTPSERVER-184) IODataConnection ASCII mode does not work as expected.
Posted by Sai Pullabhotla <sa...@jmethods.com>.
I've a couple of classes to handle the ASCII transfer mode. Since
these classes are inherited from InputStream and OutputStream, you
should be able to plug these in very easily by just wrapping the
original stream into the new stream. I used these classes in my FTP
Client implementation. We should be able to use these in the Server as
well with no (or little) modifications.
I've attached the classes for you to take a look at.
Regards,
Sai Pullabhotla
Phone: (402) 408-5753
Fax: (402) 408-6861
www.jMethods.com
On Mon, Nov 17, 2008 at 3:26 PM, Niklas Gustavsson (JIRA)
<ji...@apache.org> wrote:
>
> [ https://issues.apache.org/jira/browse/FTPSERVER-184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648348#action_12648348 ]
>
> Niklas Gustavsson commented on FTPSERVER-184:
> ---------------------------------------------
>
> David, would you like to work on this for M4 or should we reschedule it for now? I do think we should fix this, but it could be done for 1.0
>
>> IODataConnection ASCII mode does not work as expected.
>> ------------------------------------------------------
>>
>> Key: FTPSERVER-184
>> URL: https://issues.apache.org/jira/browse/FTPSERVER-184
>> Project: FtpServer
>> Issue Type: Improvement
>> Components: Core
>> Affects Versions: 1.0-M2, 1.0-M3
>> Reporter: David Latorre
>> Assignee: Niklas Gustavsson
>> Fix For: 1.0-M4
>>
>>
>> New lines in files sent in ASCII mode are transformed into /r/n no matter what platform the ftp server is running on. But if I'm not wrong, the new EOL should be equal to "line.separator" . If ASCII mode is going to be supported, this ought to be changed.
>>
>> The code in IODataConnection.transfer()
>> {
>> if (isAscii) {
>> for (int i = 0; i < count; ++i) {
>> byte b = buff[i];
>> if (b == '\n' && !lastWasCR) {
>> bos.write('\r');
>> }
>> if (b == '\r') {
>> lastWasCR = true;
>> } else {
>> lastWasCR = false;
>> }
>> bos.write(b);
>> }
>> }
>> }
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>
[jira] Commented: (FTPSERVER-184) IODataConnection ASCII mode does
not work as expected.
Posted by "Niklas Gustavsson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FTPSERVER-184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648348#action_12648348 ]
Niklas Gustavsson commented on FTPSERVER-184:
---------------------------------------------
David, would you like to work on this for M4 or should we reschedule it for now? I do think we should fix this, but it could be done for 1.0
> IODataConnection ASCII mode does not work as expected.
> ------------------------------------------------------
>
> Key: FTPSERVER-184
> URL: https://issues.apache.org/jira/browse/FTPSERVER-184
> Project: FtpServer
> Issue Type: Improvement
> Components: Core
> Affects Versions: 1.0-M2, 1.0-M3
> Reporter: David Latorre
> Assignee: Niklas Gustavsson
> Fix For: 1.0-M4
>
>
> New lines in files sent in ASCII mode are transformed into /r/n no matter what platform the ftp server is running on. But if I'm not wrong, the new EOL should be equal to "line.separator" . If ASCII mode is going to be supported, this ought to be changed.
>
> The code in IODataConnection.transfer()
> {
> if (isAscii) {
> for (int i = 0; i < count; ++i) {
> byte b = buff[i];
> if (b == '\n' && !lastWasCR) {
> bos.write('\r');
> }
> if (b == '\r') {
> lastWasCR = true;
> } else {
> lastWasCR = false;
> }
> bos.write(b);
> }
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (FTPSERVER-184) IODataConnection ASCII mode does
not work as expected.
Posted by "Niklas Gustavsson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FTPSERVER-184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Niklas Gustavsson updated FTPSERVER-184:
----------------------------------------
Component/s: Core
Fix Version/s: 1.0-M4
Assignee: Niklas Gustavsson
Affects Version/s: 1.0-M2
1.0-M3
> IODataConnection ASCII mode does not work as expected.
> ------------------------------------------------------
>
> Key: FTPSERVER-184
> URL: https://issues.apache.org/jira/browse/FTPSERVER-184
> Project: FtpServer
> Issue Type: Improvement
> Components: Core
> Affects Versions: 1.0-M2, 1.0-M3
> Reporter: David Latorre
> Assignee: Niklas Gustavsson
> Fix For: 1.0-M4
>
>
> New lines in files sent in ASCII mode are transformed into /r/n no matter what platform the ftp server is running on. But if I'm not wrong, the new EOL should be equal to "line.separator" . If ASCII mode is going to be supported, this ought to be changed.
>
> The code in IODataConnection.transfer()
> {
> if (isAscii) {
> for (int i = 0; i < count; ++i) {
> byte b = buff[i];
> if (b == '\n' && !lastWasCR) {
> bos.write('\r');
> }
> if (b == '\r') {
> lastWasCR = true;
> } else {
> lastWasCR = false;
> }
> bos.write(b);
> }
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (FTPSERVER-184) IODataConnection ASCII mode does
not work as expected.
Posted by "David Latorre (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FTPSERVER-184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645656#action_12645656 ]
David Latorre commented on FTPSERVER-184:
-----------------------------------------
Hello,
Sure you are right here, I didn't make myself clear enough Im sorry.
As you (and RFC959) say, when we are sending the file we should transform to NVT-ASCII but not when we are receiving the file. In this second case, i think that the expected behaviour is that the text message be written to a file with the default line separator for the platform.
The sender converts the data from an internal character
representation to the standard 8-bit NVT-ASCII
representation (see the Telnet specification). The receiver
will convert the data from the standard form to his own
internal form.
Actually , according to the spec before a RETR ASCII operation is transformed we should be converting the charset to ASCII , for our machine could be using EBCDIC to store files and clients are supposed to expect that files are encoded in NVT-ASCII.
So I don't know ... Any way, this has little priority for me (until someone using a non-ascii-compatible encoding complains) so we could leave this for the future. Any way I don't like ASCII mode for it breaks the 'REST' command. My implementation only supports binary mode.
> IODataConnection ASCII mode does not work as expected.
> ------------------------------------------------------
>
> Key: FTPSERVER-184
> URL: https://issues.apache.org/jira/browse/FTPSERVER-184
> Project: FtpServer
> Issue Type: Improvement
> Components: Core
> Affects Versions: 1.0-M2, 1.0-M3
> Reporter: David Latorre
> Assignee: Niklas Gustavsson
> Fix For: 1.0-M4
>
>
> New lines in files sent in ASCII mode are transformed into /r/n no matter what platform the ftp server is running on. But if I'm not wrong, the new EOL should be equal to "line.separator" . If ASCII mode is going to be supported, this ought to be changed.
>
> The code in IODataConnection.transfer()
> {
> if (isAscii) {
> for (int i = 0; i < count; ++i) {
> byte b = buff[i];
> if (b == '\n' && !lastWasCR) {
> bos.write('\r');
> }
> if (b == '\r') {
> lastWasCR = true;
> } else {
> lastWasCR = false;
> }
> bos.write(b);
> }
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (FTPSERVER-184) IODataConnection ASCII mode does
not work as expected.
Posted by "Niklas Gustavsson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FTPSERVER-184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645557#action_12645557 ]
Niklas Gustavsson commented on FTPSERVER-184:
---------------------------------------------
RFC 959 does specify the following:
In accordance with the NVT standard, the <CRLF> sequence
should be used where necessary to denote the end of a line
of text. (See the discussion of file structure at the end
of the Section on Data Representation and Storage.)
So, I think we're doing the right thing.
> IODataConnection ASCII mode does not work as expected.
> ------------------------------------------------------
>
> Key: FTPSERVER-184
> URL: https://issues.apache.org/jira/browse/FTPSERVER-184
> Project: FtpServer
> Issue Type: Improvement
> Components: Core
> Affects Versions: 1.0-M2, 1.0-M3
> Reporter: David Latorre
> Assignee: Niklas Gustavsson
> Fix For: 1.0-M4
>
>
> New lines in files sent in ASCII mode are transformed into /r/n no matter what platform the ftp server is running on. But if I'm not wrong, the new EOL should be equal to "line.separator" . If ASCII mode is going to be supported, this ought to be changed.
>
> The code in IODataConnection.transfer()
> {
> if (isAscii) {
> for (int i = 0; i < count; ++i) {
> byte b = buff[i];
> if (b == '\n' && !lastWasCR) {
> bos.write('\r');
> }
> if (b == '\r') {
> lastWasCR = true;
> } else {
> lastWasCR = false;
> }
> bos.write(b);
> }
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (FTPSERVER-184) IODataConnection ASCII mode does not
work as expected.
Posted by "Niklas Gustavsson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FTPSERVER-184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Niklas Gustavsson closed FTPSERVER-184.
---------------------------------------
Resolution: Fixed
We now store files sent in ascii mode with the local line endings (rev 721551).
> IODataConnection ASCII mode does not work as expected.
> ------------------------------------------------------
>
> Key: FTPSERVER-184
> URL: https://issues.apache.org/jira/browse/FTPSERVER-184
> Project: FtpServer
> Issue Type: Improvement
> Components: Core
> Affects Versions: 1.0-M2, 1.0-M3
> Reporter: David Latorre
> Assignee: Niklas Gustavsson
> Fix For: 1.0-M4
>
>
> New lines in files sent in ASCII mode are transformed into /r/n no matter what platform the ftp server is running on. But if I'm not wrong, the new EOL should be equal to "line.separator" . If ASCII mode is going to be supported, this ought to be changed.
>
> The code in IODataConnection.transfer()
> {
> if (isAscii) {
> for (int i = 0; i < count; ++i) {
> byte b = buff[i];
> if (b == '\n' && !lastWasCR) {
> bos.write('\r');
> }
> if (b == '\r') {
> lastWasCR = true;
> } else {
> lastWasCR = false;
> }
> bos.write(b);
> }
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.