Is there anything in the FTP protocol like the HTTP Range header?

Suppose I want to transfer only part of a file via FTP - is it possible to use the standard FTP protocol?

In HTTP, I could use the Range header in the request to indicate the data range of the remote resource. If this is a 1 mb file, I can request bytes from 600 to 700 thousand.

Is there anything similar in FTP? I read FTP RFC , I don’t see anything, but I want to make sure that I did not miss anything.

Is there a Restart command in FTP - will it work?


Adding
Having received Brian Bondi, answer below , I wrote a Stream class, read-only, which wraps FTP. It supports Seek () and Read () operations on a resource that is read via FTP, based on the REST verb.
Find it http://cheeso.members.winisp.net/srcview.aspx?dir=streams&file=FtpReadStream.cs

This is pretty slow for Seek (), because setting up a data socket is time consuming. Best results come when you port this stream to a BufferedStream .

+4
source share
2 answers

Yes you can use the REST command.

REST specifies the point at which subsequent file transfer should begin. It is commonly used to restart interrupted transfers. The command should come right before RETR or STOR and therefore come after PORT or PASV .

From FTP RFC 959:

RESTART (REST) ​​The argument field represents the server token on which file transfer should be restarted. This command does not cause file transfer but skips the file to the specified data checkpoint. This command should be immediately followed by the appropriate FTP service command which will result in the file being transferred to the resume.

More details: http://www.faqs.org/rfcs/rfc959.html#ixzz0jZp8azux

+6
source

You should check how GridFTP performs concurrent transfers. This is the use of the methods that you want (and in fact, it may be code that is better to borrow rather than implement from scratch yourself).

+1
source

Source: https://habr.com/ru/post/1305454/


All Articles