Project curl is a command-line tool that is used to do Internet transfers for resources specified as URLs using Internet protocols. You can read more about its history at https://ec.haxx.se/.

In this tutorial, we learn about using curl to do some simple server testing.

Table Of Content

  1. Examine response header
  2. Show response time
  3. Send request header
  4. The End

Examine response header

To verify if a proxy server cache is working, we can check the response's header "x-proxy-cache" value.

Examine response header using curl:

curl -I https://yoursite.com

Output:

Show response time

Response time is a simple yet straightforward metric to benchmark when optimizing our site.

To check response time using curl:

curl -s -w "%{time_total}\n" -o null https://yoursite.com

Options: + -s: run it in silent mode. Do not show progress info. + -w: format the output string using a placeholder. + -o: write the output to a file. Here we discard it by writing to null.

Send request header

When we need to send "no-cache" request to the header to test the proxy cache server. We can do so via curl too.

Send request header using curl:

Output:

End

We hope this simple tutorial helped you with your development.