curl命令怎么用 curl常用命令及参数详解(10)
curl命令怎么用
The -# option will display a totally different progress bar that does not need much explanation!
Speed Limit
Curl allows the user to set the transfer speed conditions that must be met to let the transfer keep going. By using the switch -y and -Y you can make curl abort transfers if the transfer speed is below the specified lowest limit for a specified time.
To have curl abort the download if the speed is slower than 3000 bytes per second for 1 minute, run:
curl -Y 3000 -y 60 www.far-away-site.com
This can be used in combination with the overall time limit, so that the above operation must be completed in whole within 30 minutes:
curl -m 1800 -Y 3000 -y 60 www.far-away-site.com
Forcing curl not to transfer data faster than a given rate is also possible, which might be useful if you are using a limited bandwidth connection and you do not want your transfer to use all of it (sometimes referred to as "bandwidth throttle").
Make curl transfer data no faster than 10 kilobytes per second:
curl --limit-rate 10K www.far-away-site.com
or
curl --limit-rate 10240 www.far-away-site.com
Or prevent curl from uploading data faster than 1 megabyte per second:
curl -T upload --limit-rate 1M ftp://uploadshereplease.com
When using the --limit-rate option, the transfer rate is regulated on a per-second basis, which will cause the total transfer speed to become lower than the given number. Sometimes of course substantially lower, if your transfer stalls during periods.
Config File
Curl automatically tries to read the .curlrc file (or _curlrc file on Microsoft Windows systems) from the user's home dir on startup.
The config file could be made up with normal command line switches, but you can also specify the long options without the dashes to make it more readable. You can separate the options and the parameter with spaces, or with = or :. Comments can be used within the file. If the first letter on a line is a #-symbol the rest of the line is treated as a comment.
If you want the parameter to contain spaces, you must enclose the entire parameter within double quotes ("). Within those quotes, you specify a quote as \".
NOTE: You must specify options and their arguments on the same line.
Example, set default time out and proxy in a config file:
# We want a 30 minute timeout:
-m 1800
#. .. and we use a proxy for all accesses:
proxy = proxy.our.domain.com:8080
Whitespaces ARE significant at the end of lines, but all whitespace leading up to the first characters of each line are ignored.
Prevent curl from reading the default file by using -q as the first command line parameter, like:
curl -q www.thatsite.com
Force curl to get and display a local help page in case it is invoked without URL by making a config file similar to:
# default url to get
url = "http://help.with.curl.com/curlhelp.html"
You can specify another config file to be read by using the -K/--config flag. If you set config file name to - it will read the config from stdin, which can be handy if you want to hide options from being visible in process tables etc:
相关阅读
-
网站推广的基本方法为哪些 网络营销与策划方案
小编为网友们解答网站推广的基本方法为哪些和网络营销与策划方案方面的内容,具体详情如下: 网络世界已变成当代人不可或缺的一种生活习惯,因此,以互联网为基本的商业主题活动也日
-
定制网站建设哪家便宜好做 网页设计制作网站推荐
今天分享:定制网站建设哪家便宜好做和网页设计制作网站推荐方面的内容,接下来就是全面介绍。 网站建设如果能够做得比较好的话,一般能够给其他人留下一个比较深刻的印象,这对于任
-
网站设计制作从哪里学起 html零基础入门教程
你是不是想知道网站设计制作从哪里学起和html零基础入门教程的介绍,请看下面详细的介绍。 网站是很多人都会使用的工具,但是做网站对于大部分人来说就不是件容易的事了,在这里,把学
-
JS怎么判断奇偶数方法代码 javascript判断奇偶数代码及原理详解
javascript判断奇偶数代码 ,以及判断奇偶数的原理分享给各位JS初学者。 代码如下: !DOCTYPE htmlhtmlheadmeta charset="utf-8"meta name="viewport" content="width=device-width, initial-scale=1"title判断奇偶数/title/headb


