FTP、HTTP断点续传和多线程的协议基础
2009-03-13 12:08
357 查看
使用FTP或HTTP协议的下载软件支持断点续传和多线程的协议基础是:
FTP用的是REST和SIZE;HTTP用的是Range。
1、FTP实现断点续传的协议基础
REST(有的服务器可能不支持此命令)
Syntax: REST position
Sets the point at which a file transfer should start; useful for resuming interrupted transfers. For nonstructured files, this is simply a decimal number. This command must immediately precede a data transfer command (RETR or STOR .ly); i.e. it must come after any PORT or PASV command.
2、FTP实现多线程下载同一个大文件的协议基础
SIZE
Syntax: SIZE remote-filename
Returns the size of the remote file as a decimal number.
3、raw FTP commands
http://www.nsftools.com/tips/RawFTP.htm#SIZE
http://www.ietf.org/rfc/rfc959.txt
4、HTTP实现断点续传和多线程下载同一个大文件的协议基础
Range
HTTP retri. requests using conditional or unconditional GET methods MAY request .e or more sub-ranges of the entity, instead of the entire entity, using the Range request header, which applies to the entity returned as the result of the request:
Range = "Range" ":" ranges-specifier
A server MAY ignore the Range header. However, HTTP/1.1 origin servers and intermediate caches ought to support byte ranges when possible, since Range supports efficient recovery from partially failed transfers, and supports efficient partial retri. of large entities.
If the server supports the Range header and the specified range or ranges are appropriate for the entity:
- The presence of a Range header in an unconditional GET modifies
what is returned if the GET is otherwise successful. In other
words, the response carries a status code of 206 (Partial
Content) instead of 200 (OK).
- The presence of a Range header in a conditional GET (a request
using .e or both of If-Modified-Since and If-None-Match, or
.e or both of If-Unmodified-Since and If-Match) modifies what
is returned if the GET is otherwise successful and the
condition is true. It does not affect the 304 (Not Modified)
response returned if the conditional is false.
In some cases, it might be more appropriate to use the If-Range header (see section 14.27) in addition to the Range header.
If a proxy that supports ranges receives a Range request, forwards the request to an inbound server, and receives an entire entity in reply, it SHOULD .ly return the requested range to its client. It SHOULD store the entire received response in its cache if that is consistent with its cache allocation policies.
5、Hypertext Transfer Protocol -- HTTP/1.1
http://www.w3.org/Protocols/rfc2616/rfc2616.html
本文出自 “GONE WITH THE WIND” 博客,请务必保留此出处http://h2appy.blog.51cto.com/609721/138512
FTP用的是REST和SIZE;HTTP用的是Range。
1、FTP实现断点续传的协议基础
REST(有的服务器可能不支持此命令)
Syntax: REST position
Sets the point at which a file transfer should start; useful for resuming interrupted transfers. For nonstructured files, this is simply a decimal number. This command must immediately precede a data transfer command (RETR or STOR .ly); i.e. it must come after any PORT or PASV command.
2、FTP实现多线程下载同一个大文件的协议基础
SIZE
Syntax: SIZE remote-filename
Returns the size of the remote file as a decimal number.
3、raw FTP commands
http://www.nsftools.com/tips/RawFTP.htm#SIZE
http://www.ietf.org/rfc/rfc959.txt
4、HTTP实现断点续传和多线程下载同一个大文件的协议基础
Range
HTTP retri. requests using conditional or unconditional GET methods MAY request .e or more sub-ranges of the entity, instead of the entire entity, using the Range request header, which applies to the entity returned as the result of the request:
Range = "Range" ":" ranges-specifier
A server MAY ignore the Range header. However, HTTP/1.1 origin servers and intermediate caches ought to support byte ranges when possible, since Range supports efficient recovery from partially failed transfers, and supports efficient partial retri. of large entities.
If the server supports the Range header and the specified range or ranges are appropriate for the entity:
- The presence of a Range header in an unconditional GET modifies
what is returned if the GET is otherwise successful. In other
words, the response carries a status code of 206 (Partial
Content) instead of 200 (OK).
- The presence of a Range header in a conditional GET (a request
using .e or both of If-Modified-Since and If-None-Match, or
.e or both of If-Unmodified-Since and If-Match) modifies what
is returned if the GET is otherwise successful and the
condition is true. It does not affect the 304 (Not Modified)
response returned if the conditional is false.
In some cases, it might be more appropriate to use the If-Range header (see section 14.27) in addition to the Range header.
If a proxy that supports ranges receives a Range request, forwards the request to an inbound server, and receives an entire entity in reply, it SHOULD .ly return the requested range to its client. It SHOULD store the entire received response in its cache if that is consistent with its cache allocation policies.
5、Hypertext Transfer Protocol -- HTTP/1.1
http://www.w3.org/Protocols/rfc2616/rfc2616.html
本文出自 “GONE WITH THE WIND” 博客,请务必保留此出处http://h2appy.blog.51cto.com/609721/138512
相关文章推荐
- http协议 文件下载原理及多线程断点续传
- linux下wget命令,支持断点续传,ftp、http、https等协议
- [网络基础知识]HTTP协议结构
- 网络基础与协议入门——(1)HTTP协议重点
- 用C#实现HTTP协议下的多线程文件传输
- HTTP & HTTPS网络协议重点总结(基于SSL/TLS的握手、TCP/IP协议基础、加密学)
- .Net/C#: 实现支持断点续传多线程下载的 Http Web 客户端工具类 (第2版) (C# DIY HttpWebClient) 收藏
- HTTP协议基础(一):简单的HTTP协议
- HTTP协议基础
- TCP/IP 和HTTP 协议基础知识
- 在用HttpWebRequest的时候,发现返回"基础连接已经关闭: 该服务器提交了 HTTP 协议冲突
- Java基础之Http协议的理解与总结 推荐
- 【ASP.net文档】用C#实现HTTP协议下的多线程文件传输
- Http协议基础
- 程序员必备基础知识:通信协议——Http、TCP、UDP
- Java基础 HTTP协议
- 【幻化万千戏红尘】qianfengDay27-HttpURLConnection,OkHttpClient,,多线程下载且断点续传基础学习:
- 漫谈计算机基础之Http协议(一)
- .Net/C#: 实现支持断点续传多线程下载的 Http Web 客户端工具类 (C# DIY HttpWebClient)
- HTTP协议(web基础)