The resume of the breakpoint is very common now. If there is no breakpoint, then the downloaded content has been downloaded 90%, but the download process is interrupted, so download it from the beginning. This article will briefly introduce how the Linux system breakpoint resume is implemented.
HTTP principle
In fact, HTTP principle is very simple, that is the Http requests and generally download was different.
For example, when a browser requests a message on the server, the request is as follows:
Suppose the server domain name is wwwws.sjtu.edu.cn and the file name is down.zip .
GET /down.zip HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-
excel, application/msword, application/vnd.ms-powerpoint, */*
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
Connection: Keep-Alive
After receiving the request, the server looks for the requested file and extracts the file as required. The information is then returned to the browser, and the returned information is as follows:
200
Content-Length=106786028
Accept-Ranges=bytes
Date= Mon, 30 Apr 2001 12:56:11 GMT
ETag=W/“02ca57e173c11:95b”
Content-Type=application/octet-stream
Server= Microsoft-IIS/5.0
Last-Modified=Mon, 30 Apr 2001 12:56:11 GMT
The so-called breakpoint resume, that is, to start from where the file has been downloaded Download. So add a message when the client browser passes to the web server -- where to start.
The following is to use a "browser" that you have compiled to pass the request information to the Web server, starting with 2000070 bytes.
GET /down.zip HTTP/1.0
User-Agent: NetFox
RANGE: bytes=2000070-
Accept: text/html, image /gif, image/jpeg, *; q=.2, */*; q=.2
A closer look reveals a line RANGE: bytes=2000070-
The meaning of one line is to tell the server that the file down.zip starts from 2000070 bytes, and the preceding bytes are not passed.
After receiving this request, the server returns the following information:
206
Content-Length=106786028
Content-Range=bytes 2000070-106786027 /106786028
Date=Mon, 30 Apr 2001 12:55:20 GMT
ETag=W/“02ca57e173c11:95b”
Content-Type=application/octet -stream
Server=Microsoft-IIS/5.0
Last-Modified=Mon, 30 Apr 2001 12:55:20 GMT
Compare with the information returned by the previous server , you will find a line added:
Content-Range=bytes 2000070-106786027/106786028
The returned code is also changed to 206, instead of 200.
Knowing the above principle, you can program the breakpoint. Previous12Next page Total 2 pages
I have been installing LibreOffice on Linux for a while. I need to uninstall LibreOffice for various
When doing Linux system operations, sometimes you need to back up the web files on
When a user logs in to the Linux system server to view it, it is found that the results detected by
On Linux systems, the env command can temporarily clear Bash environment variables
How to set up Kde5 for Gentoo Linux system?
Linux cancels the SSH login password
How to use commands to manage files in Linux
How to use the command line to access Gmail
Linux error when reporting a scheduled task -bash:crontab:command?
What should I do when Linux upgrades Glibc?
Two ways to speed up the copying speed of Linux files
Xfs Extension Method Guide for Linux
How does Linux modify the PATH path of sudo?
How to set up Win10 notebook to maximize power saving and extend battery life?
Various Windows operating system installation tips
XP system can not be installed properly. How to solve .net?
How to set the user name in the start menu
Linuxweb directory file full script
After upgrading Windows 7 SP1, mscorsvw.exe mad CPU
Win7 system desktop shows my computer icon the easiest way
How to disable Win7 system IE browser to automatically start the program