FTP and HTTP Breakpoint continuation principle

Source: Internet
Author: User
Tags ftp client

First, the most important point is that the continuation of the breakpoint requires the support of the server, which is a necessary condition.
Traditional FTP server does not support the continuation of breakpoints because it does not support rest instructions, and traditional FTP directives (I mean server-side directives) do not include rest instructions.

Second, the client should know to use a series of instructions such as rest to make a breakpoint continuation.

Take a look at the detailed process of the breakpoint continuation (FTP SERVER):
First, the client uses the rest instruction to tell the FTP server that it needs to start at a point in the file, then use the Stor or RETR command to start the file, and the approximate command flow is as follows:

TYPE I
Type set to I.
PASV
Entering passive Mode (204,48,18,69,98,250)
REST 187392
Restarting at 187392. Send STORE or RETRIEVE to initiate transfer.
Retr/pub/audio/pci/maestro-3/win2k/1056.zip
Opening BINARY Mode data connection For/pub/audio/pci/maestro-3/win2k/1056.zip (936098 bytes).

First use the type command to tell FTP server to use binary mode to transfer files;
Then use the PASV command to tell FTP server to use passive open mode to transfer files;
Then use the rest 187392 instruction to tell the FTP server to start the transfer from 187392 bytes of the file;
Finally, the RETR instruction is used to transfer the file.

As you can see from the above, the FTP server supports rest instructions, and some FTP servers (especially old ones) do not support this instruction, even if the FTP client supports a breakpoint continuation.

The FTP server:serv-u FTP that supports the breakpoint, also has a series of newly appeared FTP SERVER;
Does not support breakpoints: IIS4 Previous version of the band are not, IIS5 have, not home can test, log into the FTP server, and then enter rest 1000 command to see whether the server knows, understanding is to support breakpoints.


This is the FTP server breakpoint, the HTTP breakpoint continues to pass:
The previous version of HTTP server also does not support breakpoints, http/1.1 began to support, specifically as follows:

In the header information of an HTTP request, this is usually the case:

Get http://xxx.xxx.xxx.xxx/index.html http/1.1
Host:www.163.net
accept:*/*

Above is the main content of the HTTP request header, which is the information sent to HTTP server by clients such as browsers.
In this request header, the first line is called Request Line,get (usually get an HTML page with a get,cgi, etc request is a post), http://bbs.netbuddy.org/index.html is url,http/1.1 as the version number.
Host:bbs.netbuddy.org is the HTTP server name, this is also http/1.1 new Dongdong, before doing a virtual host but to a host name corresponding to multiple IP, now good ... Oh, this digress too far, do not say.

To do a continuation of the breakpoint, the browser and other clients need to send in the request header
range:bytes=1140736-
The request is to tell the HTTP SERVER that the file is to be routed from 1140736 bytes.


Last but not least, if you look at the above description there may be a problem, so how do multicast? That's a few more threads, connect to the server, use the breakpoint instruction to transfer the file, in the process of transmission, will check the front (for example, the first ant) to get the file of the previous (for example, the second ant) of the starting point, equal to stop the ant in front, and finally merge a few parts, We get a complete file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.