{"id":1031,"date":"2017-06-09T07:10:00","date_gmt":"2017-06-09T07:10:00","guid":{"rendered":"http:\/\/www.ipcpu.com\/?p=1031"},"modified":"2021-05-18T08:31:05","modified_gmt":"2021-05-18T08:31:05","slug":"curl-time","status":"publish","type":"post","link":"https:\/\/c.ipcpu.com\/2017\/06\/curl-time\/","title":{"rendered":"\u4f7f\u7528curl\u6765\u68c0\u6d4burl\u8017\u65f6"},"content":{"rendered":"

\u4f7f\u7528curl\u6765\u68c0\u6d4burl\u8017\u65f6.md<\/p>\n

curl\u662f\u4e00\u4e2a\u5f88\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5206\u6790URL\u5728\u5404\u4e2a\u9636\u6bb5\u7684\u8017\u65f6\u3002\u4f7f\u7528\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n

\n
# curl -L --output \/dev\/null --silent --show-error --write-out '\\n\\nnamelookup:    %{time_namelookup}\\nconnect:      %{time_connect}\\nsslhandshake:  %{time_appconnect}\\npretransfer:  %{time_pretransfer}\\nredirect:      %{time_redirect}\\nfirstbyte:    %{time_starttransfer}\\ntotal:        %{time_total}\\n\\n\\n'  http:\/\/www.qyer.com -x 106.2.6.210:80\r\n\r\n\r\nnamelookup:    0.000\r\nconnect:      0.190\r\nsslhandshake:  0.000\r\npretransfer:  0.190\r\nredirect:      0.000\r\nfirstbyte:    0.564\r\ntotal:        0.564<\/code><\/pre>\n<\/div>\n

\u73b0\u5728\u5f88\u591a\u7f51\u7ad9\u90fd\u662f\u7528\u7684HTTP\uff0c\u4e0a\u9762\u7684\u65b9\u6cd5\u7528\u4e0d\u4e86\uff0c\u53ef\u4ee5\u4f7f\u7528curl\u65b0\u529f\u80fdresolve(curl 7.21.3+)<\/p>\n

\n
# curl -L --output \/dev\/null --silent --show-error --write-out '\\n\\nnamelookup:    %{time_namelookup}\\nconnect:       %{time_connect}\\nsslhandshake:  %{time_appconnect}\\npretransfer:   %{time_pretransfer}\\nredirect:      %{time_redirect}\\nfirstbyte:     %{time_starttransfer}\\ntotal:         %{time_total}\\n\\n\\n'  https:\/\/www.baidu.com\/ --resolve \"www.baidu.com:443:180.97.33.108\"\r\n\r\n\r\nnamelookup:    0.023074\r\nconnect:       0.056913\r\nsslhandshake:  0.379040\r\npretransfer:   0.379117\r\nredirect:      0.000000\r\nfirstbyte:     0.415180\r\ntotal:         0.415550\r\n<\/code><\/pre>\n<\/div>\n

\u5404\u4e2a\u9636\u6bb5\u8017\u65f6\u89e3\u91ca<\/p>\n

\n

namelookup - The time, in seconds, it took from the start until the name resolving was completed.<\/p>\n

connect - The time, in seconds, it took from the start until the TCP connect to the remote host(or proxy) was completed.#<\/p>\n

sslhandshake - 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)<\/p>\n

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 negotiations that are specific to the particular protocol(s) involved.<\/p>\n

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 execution time for multiple redirections.<\/p>\n

firstbyte - The time, in seconds, it took from the start until the first byte was just about to be transferred. This includes time_pre-transfer and also the time the server needed to calculate the result.<\/p>\n

total - The total time, in seconds, that the full operation lasted. The time will be displayed with millisecond resolution.<\/p>\n<\/blockquote>\n

<\/p>\n

<\/div>\n
<\/div>\n
\n
<\/div>\n
<\/div>\n
<\/div>\n
<\/div>\n
<\/div>\n<\/div>\n
\n
<\/div>\n
<\/div>\n
<\/div>\n
<\/div>\n
<\/div>\n<\/div>\n

<\/wiz_tmp_tag><\/p>\n

\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1aIPCPU-\u7f51\u7edc\u4e4b\u8def<\/a> » \u4f7f\u7528curl\u6765\u68c0\u6d4burl\u8017\u65f6<\/a><\/p>","protected":false},"excerpt":{"rendered":"

\u4f7f\u7528curl\u6765\u68c0\u6d4burl\u8017\u65f6.md curl\u662f\u4e00\u4e2a\u5f88\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5206\u6790URL\u5728\u5404\u4e2a\u9636\u6bb5\u7684\u8017\u65f6\u3002\u4f7f\u7528\u65b9\u6cd5\u5982\u4e0b\uff1a # curl -L –output \/dev\/null –silent –show-error –write-out ‘\\n\\nnamelookup: %{time_namelookup}\\nconnect: %{time_connect}\\nsslhandshake: %{time_appconnect}\\npretransfer: %{time_pretransfer}\\nredirect: %{time_redirect}\\nfirstbyte: %{time_starttransfer}\\ntotal: %{time_total}\\n\\n\\n’ http:\/\/www.qyer.com -x 106.2.6.210:80 namelookup: 0.000 connect: 0.190 sslhandshake: 0.000 pretransfer: 0.190 redirect: 0.000 firstbyte: 0.564 total: 0.564 \u73b0\u5728\u5f88\u591a\u7f51\u7ad9\u90fd\u662f\u7528\u7684HTTP\uff0c\u4e0a\u9762\u7684\u65b9\u6cd5\u7528\u4e0d\u4e86\uff0c\u53ef\u4ee5\u4f7f\u7528curl\u65b0\u529f\u80fdresolve(curl 7.21.3+) # curl -L –output \/dev\/null –silent –show-error –write-out ‘\\n\\nnamelookup: %{time_namelookup}\\nconnect: %{time_connect}\\nsslhandshake: %{time_appconnect}\\npretransfer: %{time_pretransfer}\\nredirect: %{time_redirect}\\nfirstbyte: %{time_starttransfer}\\ntotal: %{time_total}\\n\\n\\n’ https:\/\/www.baidu.com\/ –resolve […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[29],"_links":{"self":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1031"}],"collection":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/comments?post=1031"}],"version-history":[{"count":7,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1031\/revisions"}],"predecessor-version":[{"id":1441,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1031\/revisions\/1441"}],"wp:attachment":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/media?parent=1031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/categories?post=1031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/tags?post=1031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}