FTP 协议中是否有任何内容,例如 HTTP Range 标头? [英] Is there anything in the FTP protocol like the HTTP Range header?

查看:26
本文介绍了FTP 协议中是否有任何内容,例如 HTTP Range 标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我只想通过 FTP 传输文件的一部分 - 是否可以使用标准 FTP 协议?

Suppose I want to transfer just a portion of a file over FTP - is it possible using a standard FTP protocol?

在 HTTP 中,我可以在请求中使用 范围标头指定远程资源的数据范围.如果是 1mb 的文件,我可以要求从 600k 到 700k 的字节.

In HTTP I could use a Range header in the request to specify the data range of the remote resource. If it's a 1mb file, I could ask for the bytes from 600k to 700k.

在 FTP 中有类似的东西吗?我正在阅读 FTP RFC,没有看到任何内容,但想确认一下我没有错过任何东西.

Is there anything like that in FTP? I am reading the FTP RFC, don't see anything, but want to make sure I'm not missing anything.

FTP 中有一个重新启动命令 - 可以吗?

There's a Restart command in FTP - would that work?

附录
在获得 Brian Bondy 之后下面回答,我写了一个封装了FTP的只读Stream类.它支持基于 REST 动词对通过 FTP 读取的资源进行 Seek() 和 Read() 操作.
http://cheeso.members.winisp 找到它.net/srcview.aspx?dir=streams&file=FtpReadStream.cs

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

Seek() 非常慢,因为设置数据套接字需要很长时间.当您将该流包装在 BufferedStream.

It's pretty slow to Seek(), because setting up the data socket takes a long time. Best results come when you wrap that stream in a BufferedStream.

推荐答案

是的,您可以使用 REST 命令.

Yes you can use the REST command.

REST 设置后续文件传输的开始点.它通常用于重新启动中断的传输.该命令必须在 RETRSTOR 之前,因此在 PORTPASV 之后.

REST sets the point at which a subsequent file transfer should start. It is used usually for restarting interrupted transfers. The command must come right before a RETR or STOR and so come after a PORT or PASV.

来自 FTP 的 RFC 959:

RESTART (REST) 参数字段表示在哪个服务器标记文件传输将重新启动.这命令不会导致文件传输但跳过文件到指定的数据检查点.这命令应立即执行通过适当的 FTP 服务命令这将导致文件传输到继续.

RESTART (REST) The argument field represents the server marker at which file transfer is to be restarted. This command does not cause file transfer but skips over the file to the specified data checkpoint. This command shall be immediately followed by the appropriate FTP service command which shall cause file transfer to resume.

阅读更多:http://www.faqs.org/rfcs/rfc959.html#ixzz0jZp8azux

这篇关于FTP 协议中是否有任何内容,例如 HTTP Range 标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆