刚刚man了一下curl的-w的参数,吓一跳,内容真的好多啊!!!
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[root@PC ~]# curl -o /dev/null -s -w '%{time_connect}\n' 'https://note.t4x.org' #建立到服务器的 TCP 连接所用的时间 0.372 [root@PC ~]# curl -o /dev/null -s -w '%{time_starttransfer}\n' 'https://note.t4x.org' #在发出请求之后,Web 服务器返回数据的第一个字节所用的时间 1.413 [root@PC ~]# curl -o /dev/null -s -w '%{time_total}\n' 'https://note.t4x.org' #完成请求所用的时间 1.001 [root@PC ~]# curl -o /dev/null -s -w '%{time_namelookup}\n' 'https://note.t4x.org' # DNS解析时间,从请求开始到DNS解析完毕所用时间(记得关掉 Linux 的 nscd 的服务测试) 0.289 [root@PC ~]# curl -o /dev/null -s -w '%{speed_download}\n' 'https://note.t4x.org' #下载速度,单位-字节每秒。 16061.000 [root@PC ~]# curl -o /dev/null -s -w '%{time_namelookup}:%{time_connect}:%{time_starttransfer}:%{time_total}:%{speed_download}\n' 'https://note.t4x.org' 1.353:1.371:1.902:2.054:17378.000 [root@PC ~]# curl -o /dev/null -s -w '%{time_namelookup}:%{time_connect}:%{time_starttransfer}:%{time_total}:%{speed_download}\n' 'http://zmingcx.com' 0.181:0.223:0.266:0.570:135401.000 |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
NOTE: The %-symbol is a special symbol in the win32-environment, where all occurrences of % must be doubled when using this option. The variables available at this point are: url_effective The URL that was fetched last. This is most mean- ingful if you’ve told curl to follow location: headers. http_code The numerical response code that was found in the last retrieved HTTP(S) or FTP(s) transfer. In 7.18.2 the alias response_code was added to show the same info. http_connect The numerical code that was found in the last response (from a proxy) to a curl CONNECT request. (Added in 7.12.4) time_total The total time, in seconds, that the full opera- tion lasted. The time will be displayed with mil- lisecond resolution. time_namelookup The time, in seconds, it took from the start until the name resolving was completed. time_connect The time, in seconds, it took from the start until the TCP connect to the remote host (or proxy) was completed. time_appconnect The time, in seconds, it took from the start until the SSL/SSH/etc connect/handshake to the remote host was completed. (Added in 7.19.0) time_pretransfer The time, in seconds, it took from the start until the file transfer was just about to begin. This includes all pre-transfer commands and nego- tiations that are specific to the particular pro- tocol(s) involved. time_redirect The time, in seconds, it took for all redirection steps include name lookup, connect, pretransfer and transfer before the final transaction was started. time_redirect shows the complete execu- tion time for multiple redirections. (Added in 7.12.3) time_starttransfer The time, in seconds, it took from the start until the first byte was just about to be trans- ferred. This includes time_pretransfer and also the time the server needed to calculate the result. size_download The total amount of bytes that were downloaded. size_upload The total amount of bytes that were uploaded. size_header The total amount of bytes of the downloaded head- ers. size_request The total amount of bytes that were sent in the HTTP request. speed_download The average download speed that curl measured for the complete download. speed_upload The average upload speed that curl measured for the complete upload. content_type The Content-Type of the requested document, if there was any. num_connects Number of new connects made in the recent trans- fer. (Added in 7.12.3) num_redirects Number of redirects that were followed in the request. (Added in 7.12.3) redirect_url When a HTTP request was made without -L to follow redirects, this variable will show the actual URL a redirect would take you to. (Added in 7.18.2) ftp_entry_path The initial path libcurl ended up in when logging on to the remote FTP server. (Added in 7.15.4) ssl_verify_result The result of the SSL peer certificate verifica- tion that was requested. 0 means the verification was successful. (Added in 7.19.0) |
转载:http://7567567.blog.51cto.com/706378/619842SourceByrd's Weblog-https://note.t4x.org/basic/curl-silent-write-out-format/ SourceByrd's Weblog-https://note.t4x.org/basic/curl-silent-write-out-format/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!