| 1 | ## ElastiCurl |
| 2 | This is a sample application showing how to use `aws-c-http` in client mode. It's intended to replicate the command-line interface of curl's http support. |
| 3 | |
| 4 | ### Usage |
| 5 | ### Examples |
| 6 | Dump the body of example.com to stdout |
| 7 | |
| 8 | elasticurl example.com |
| 9 | |
| 10 | Make a POST request with a header and payload, logging ERROR and FATAL messages: |
| 11 | |
| 12 | elasticurl -v ERROR -P -H "content-type: application/json" -i -d "{'test':'testval'}" http://httpbin.org/post |
| 13 | |
| 14 | Download an http resource to a file on disk, logging INFO, WARN, ERROR, and FATAL messages: |
| 15 | |
| 16 | elasticurl -v INFO -o elastigirl.png https://upload.wikimedia.org/wikipedia/en/thumb/e/ef/Helen_Parr.png/220px-Helen_Parr.png |
| 17 | |
| 18 | ### Command Line Interface |
| 19 | elasticurl [options] url |
| 20 | |
| 21 | Note: https is always the default. If you want plain-text http, either specify `http` manually, or set ports `80` or `8080` |
| 22 | |
| 23 | #### Options |
| 24 | ##### --cacert |
| 25 | Path to a PEM Armored PKCS#7 CA Certificate file. |
| 26 | ##### --capath |
| 27 | Path to a directory containing ca certificates (only supported on Unix systems). |
| 28 | ##### --cert |
| 29 | Path for a certificate to use with mTLS. Usually this is a path to a PEM armored PKCS#7 file. |
| 30 | On windows this can also be a registry path for certificate manager. |
| 31 | ##### --key |
| 32 | Key corresponding to `--cert`. Usually this is a path to a PEM armored PKCS#7 file, if using a certificate manager |
| 33 | registry path for `--cert`, this should be empty. |
| 34 | ##### --connect-timeout |
| 35 | Amount of time to wait for a connection. The default value is 3000 (3 seconds). This value is specified in milliseconds. |
| 36 | ##### -H, --header |
| 37 | Line to send as a header in format `[header-key]: [header-value]`. This option can be specified multiple times. The max |
| 38 | number of supported values is currently 10. |
| 39 | ##### -d, --data |
| 40 | String to send as the payload body for a POST or PUT method. |
| 41 | ##### --data-file |
| 42 | Path to a file to send as the payload body for a POST or PUT method. |
| 43 | ##### -M, --method |
| 44 | Http method to use for the request (e.g. GET, POST, PUT, DELETE etc...). GET is the default. |
| 45 | ##### -G, --get |
| 46 | Uses GET as the method for the http request. |
| 47 | ##### -P, --post |
| 48 | Uses POST as the method for the http request. |
| 49 | ##### -I, --head |
| 50 | Uses HEAD as the method for the http request. |
| 51 | ##### -i, --include |
| 52 | Includes the response headers in the output to stdout. |
| 53 | ##### -k, --insecure |
| 54 | Turns off TLS certificate validation. |
| 55 | ##### -o, --output |
| 56 | Sends the response body to the path specified instead of stdout. |
| 57 | ##### -t, --trace |
| 58 | Sends log message to the path specified instead of stderr. |
| 59 | ##### -v, --verbose |
| 60 | Sets the verbosity level of logs. Options are: ERROR|INFO|DEBUG|TRACE. Default is no logging. If you set this option, |
| 61 | without the `--trace` argument, logs will be written to stderr. |
| 62 | ##### -h, --help |
| 63 | Displays the help message and exits the program. |