├── LICENSE ├── README.md └── templates └── .curl-format /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 James Wickett 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # curl-trace 2 | an opinionated way to run curl that gives you output formatting like this: 3 | 4 | ``` 5 | Request Details: 6 | url: https://www.google.com/ 7 | num_redirects: 0 8 | content_type: text/html; charset=ISO-8859-1 9 | response_code: 200 10 | remote_ip: 216.58.193.100 11 | 12 | Timing Analysis: 13 | time_namelookup: 0.137 14 | time_connect: 0.193 15 | time_appconnect: 0.437 16 | time_pretransfer: 0.437 17 | time_redirect: 0.000 18 | time_starttransfer: 0.536 19 | ---------- 20 | time_total: 0.730 21 | ``` 22 | 23 | ## Installation 24 | 25 | Clone the repo locally. 26 | 27 | ``` 28 | git clone git@github.com:wickett/curl-trace.git 29 | ``` 30 | 31 | Add `alias curl-trace='curl -w "@/path/to/repo/templates/.curl-format" -o /dev/null -s'` to your `.bash_profile` to get timing and other analysis for your curls. 32 | 33 | Reload `.bash_profile` 34 | 35 | ``` 36 | source ~/.bash_profile 37 | ``` 38 | 39 | ## Usage 40 | 41 | ``` 42 | $ curl-trace -L https://google.com 43 | ``` 44 | 45 | ``` 46 | $ curl-trace https://www.google.com/ 47 | 48 | Request Details: 49 | url: https://www.google.com/ 50 | num_redirects: 0 51 | content_type: text/html; charset=ISO-8859-1 52 | response_code: 200 53 | remote_ip: 216.58.193.100 54 | 55 | Timing Analysis: 56 | time_namelookup: 0.137 57 | time_connect: 0.193 58 | time_appconnect: 0.437 59 | time_pretransfer: 0.437 60 | time_redirect: 0.000 61 | time_starttransfer: 0.536 62 | ---------- 63 | time_total: 0.730 64 | 65 | ``` 66 | 67 | ## Suggestions for additional templates 68 | Open an issue or send a pull request. It would be great to have a collection of templates for running curl. 69 | 70 | 71 | -------------------------------------------------------------------------------- /templates/.curl-format: -------------------------------------------------------------------------------- 1 | \n 2 | Request Details:\n 3 | url: %{url_effective}\n 4 | num_redirects: %{num_redirects}\n 5 | content_type: %{content_type}\n 6 | response_code: %{response_code}\n 7 | remote_ip: %{remote_ip}\n 8 | \n 9 | Timing Analysis:\n 10 | time_namelookup: %{time_namelookup}\n 11 | time_connect: %{time_connect}\n 12 | time_appconnect: %{time_appconnect}\n 13 | time_pretransfer: %{time_pretransfer}\n 14 | time_redirect: %{time_redirect}\n 15 | time_starttransfer: %{time_starttransfer}\n 16 | ----------\n 17 | time_total: %{time_total}\n 18 | \n 19 | --------------------------------------------------------------------------------