You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-users@mina.apache.org by Sébastien Roy <sr...@okiok.com> on 2010/03/18 20:04:33 UTC

Detecting interrupted upload

Hi,

I've been playing around with the FTP server for a while and I really enjoy the experience. The architecture is clean and very easily extensible.

Recently, for the first time, I end up not being able to accomplish something. I was looking for a way to detect FTP uploads that would not complete normally (client close connection, network interruption, etc ...). My conclusion is that there is no way to detect if a transfer has completed normally or if the transfer has been interrupted. Did anyone has any ideas how it would be possible to be notified if such interruption occurs?

I'm willing to change the STOR command or to implement a FTPlet on an event if this is required.

Thanks a lot


-----------------------------------------------------------------
 SebastienRoy


Solutions de sécurité d'entreprise et d'affaires électroniques

(450) 681.1681 ext: 279
Toll free : (877)561.1681

Re: Detecting interrupted upload

Posted by Sai Pullabhotla <sa...@jmethods.com>.
Yes, in theory, an FTP client should send an ABORt command to hint the
server that it is aborting the previous operation, if any is in
progress. As you said, not all FTP clients do this or all FTP servers
handle the ABORt command in a good way. If the client just closes the
data socket when you click on the Abort button, FTP Server would think
that it is the end of the file and does not raise any error.

Also, I was looking at the code in the ABOR command in the server. It
appears that it still sends a 226 message after aborting the data
transfer. I'm not sure if this is the correct behavior, but will let
some one else answer this.

Regards,
Sai Pullabhotla





On Fri, Mar 19, 2010 at 8:36 AM, Sébastien Roy <sr...@okiok.com> wrote:
> Thanks a lot for your suggestions.
>
> I'm taking good notes of what you are proposing. I don't have control on the FTP client side so it's hard for me to ask the client to rename the file after a successful upload. I also already verify the REPLY code and it does not seem to be different when the client close the connection or abort the transfer from what it is when the connection close normally (I will re-test that more today). Regarding that, I'm a bit confuse about how the FTP protocol works. Should the client send the ABOR command to terminate an upload? From what I've seen, some client do that, but most don't.
>
> Regards,
>
> -----------------------------------------------------------------
> Sebastien Roy
>
>
> Solutions de sécurité d'entreprise et d'affaires électroniques
>
> (450) 681.1681 ext: 279
> Toll free : (877)561.1681
>
>
> ________________________________________
> From: David Latorre [dvlato@gmail.com]
> Sent: Friday, March 19, 2010 4:35 AM
> To: ftpserver-users@mina.apache.org
> Subject: Re: Detecting interrupted upload
>
> You should check the reply code as Niklas suggested but, besides this,
> we usually suggest that the client rename the file after successfully
> uploading it - ideally it would also check the MD5 sum of the
> transferred file prior to this name change.
>
>
>
>
> 2010/3/18 Niklas Gustavsson <ni...@protocol7.com>:
>> On Thu, Mar 18, 2010 at 8:04 PM, Sébastien Roy <sr...@okiok.com> wrote:
>>> Recently, for the first time, I end up not being able to accomplish something. I was looking for a way to detect FTP uploads that would not complete normally (client close connection, network interruption, etc ...). My conclusion is that there is no way to detect if a transfer has completed normally or if the transfer has been interrupted. Did anyone has any ideas how it would be possible to be notified if such interruption occurs?
>>
>> From Ftplet.afterCommand, you should be able to look at the reply. For
>> those failed transfers that FtpServer can detect (that causes an
>> SocketException or IOException) this should be something like 426 or
>> 551.
>>
>> /niklas
>>

Re: Detecting interrupted upload

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Fri, Mar 19, 2010 at 2:36 PM, Sébastien Roy <sr...@okiok.com> wrote:
> I'm taking good notes of what you are proposing. I don't have control on the FTP client side so it's hard for me to ask the client to rename the file after a successful upload. I also already verify the REPLY code and it does not seem to be different when the client close the connection or abort the transfer from what it is when the connection close normally (I will re-test that more today).

There are many ways (due to how TCP/IP works) in which the data
connection might be broken, but the server would just think the client
closed it normally.

> Regarding that, I'm a bit confuse about how the FTP protocol works. Should the client send the ABOR command to terminate an upload? From what I've seen, some client do that, but most don't.

ABOR will not work with FtpServer since we do handle the control and
dataconnections on the same thread (we block the thread to do the data
transfer). Most clients I'm familiar with just kill the socket, which
will leave a partially transferred file. Therefore the need to move as
David described.

/niklas

RE: Detecting interrupted upload

Posted by Sébastien Roy <sr...@okiok.com>.
Thanks a lot for your suggestions.

I'm taking good notes of what you are proposing. I don't have control on the FTP client side so it's hard for me to ask the client to rename the file after a successful upload. I also already verify the REPLY code and it does not seem to be different when the client close the connection or abort the transfer from what it is when the connection close normally (I will re-test that more today). Regarding that, I'm a bit confuse about how the FTP protocol works. Should the client send the ABOR command to terminate an upload? From what I've seen, some client do that, but most don't.

Regards,

-----------------------------------------------------------------
Sebastien Roy


Solutions de sécurité d'entreprise et d'affaires électroniques

(450) 681.1681 ext: 279
Toll free : (877)561.1681


________________________________________
From: David Latorre [dvlato@gmail.com]
Sent: Friday, March 19, 2010 4:35 AM
To: ftpserver-users@mina.apache.org
Subject: Re: Detecting interrupted upload

You should check the reply code as Niklas suggested but, besides this,
we usually suggest that the client rename the file after successfully
uploading it - ideally it would also check the MD5 sum of the
transferred file prior to this name change.




2010/3/18 Niklas Gustavsson <ni...@protocol7.com>:
> On Thu, Mar 18, 2010 at 8:04 PM, Sébastien Roy <sr...@okiok.com> wrote:
>> Recently, for the first time, I end up not being able to accomplish something. I was looking for a way to detect FTP uploads that would not complete normally (client close connection, network interruption, etc ...). My conclusion is that there is no way to detect if a transfer has completed normally or if the transfer has been interrupted. Did anyone has any ideas how it would be possible to be notified if such interruption occurs?
>
> From Ftplet.afterCommand, you should be able to look at the reply. For
> those failed transfers that FtpServer can detect (that causes an
> SocketException or IOException) this should be something like 426 or
> 551.
>
> /niklas
>

Re: Detecting interrupted upload

Posted by David Latorre <dv...@gmail.com>.
You should check the reply code as Niklas suggested but, besides this,
we usually suggest that the client rename the file after successfully
uploading it - ideally it would also check the MD5 sum of the
transferred file prior to this name change.




2010/3/18 Niklas Gustavsson <ni...@protocol7.com>:
> On Thu, Mar 18, 2010 at 8:04 PM, Sébastien Roy <sr...@okiok.com> wrote:
>> Recently, for the first time, I end up not being able to accomplish something. I was looking for a way to detect FTP uploads that would not complete normally (client close connection, network interruption, etc ...). My conclusion is that there is no way to detect if a transfer has completed normally or if the transfer has been interrupted. Did anyone has any ideas how it would be possible to be notified if such interruption occurs?
>
> From Ftplet.afterCommand, you should be able to look at the reply. For
> those failed transfers that FtpServer can detect (that causes an
> SocketException or IOException) this should be something like 426 or
> 551.
>
> /niklas
>

Re: Detecting interrupted upload

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Thu, Mar 18, 2010 at 8:04 PM, Sébastien Roy <sr...@okiok.com> wrote:
> Recently, for the first time, I end up not being able to accomplish something. I was looking for a way to detect FTP uploads that would not complete normally (client close connection, network interruption, etc ...). My conclusion is that there is no way to detect if a transfer has completed normally or if the transfer has been interrupted. Did anyone has any ideas how it would be possible to be notified if such interruption occurs?

>From Ftplet.afterCommand, you should be able to look at the reply. For
those failed transfers that FtpServer can detect (that causes an
SocketException or IOException) this should be something like 426 or
551.

/niklas