cURL 在默認情況下,有很多資訊是不會顯示,例如你連線的時間、上傳以及下載的速度……等等。
這邊可以用cURL 的 -w / --write-out參數來處理。
例如:
C:\> REM 在 Windows 下執行
C:\> REM 特地加 --output nul 是避免顯示 response body
C:\> curl https://example.com -w "time_connect: %{time_connect}" --output nul
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 528 0 528 0 0 1667 0 --:--:-- --:--:-- --:--:-- 1692
time_connect: 0.128459
除了上述提到的連線的時間、上傳以及下載的速度……等等外,還有 remote IP、本地連線的 port、connection ID……等等,詳細可參閱 cURL 的 -w / --write-out 說明
參考資料
Stenberg, D. (n.d.). Curl Man Page. Curl. https://curl.se/docs/manpage.html
四叶草的诗雨. (2020, January 8). 使用curl命令查看请求响应时间方法(转载). https://www.cnblogs.com/name-lizonglin/p/12167808.html
沒有留言:
張貼留言