Curmudgeonly cURL

For reference, curmudgeonly. We all love a good curmedgeonly old fart, sometimes that’s exactly what cURL is, it has after all been around for a long time in tech years!

[sourcecode language=”bash”]
curl http://0.0.0.0:8080/hello/Adron
[/sourcecode]

The straight usage of curl does a get against the URI and returns the response body of the request made.

[sourcecode language=”bash”]
curl -i http://0.0.0.0:8080/hello/Adron
[/sourcecode]

or

[sourcecode language=”bash”]
curl –include http://0.0.0.0:8080/hello/Adron
[/sourcecode]

The -i returns the header info of the response of the request made. It is the same as the –include option.

[sourcecode language=”bash”]
curl -H "connection: close" http://0.0.0.0:8080/hello/Adron
[/sourcecode]

This curl command adds the connection: close option to the GET request to the curl command. The server then, instead of leaving the connection open afterwards immediately closes the connection and shows this in the response.

The commands above can be combined, as can others, into commands such as this.

[sourcecode language=”bash”]
curl -iH "connection: close" http://0.0.0.0:8080/hello/Adron
[/sourcecode]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.