Curl as a Network Protocol Testing Tool

Zhimin Wen
3 min readApr 13, 2023
Image by Сергей from Pixabay

Curl is commonly known as its capability dealing with HTTP and HTTPS services. But in fact it has a wide range of protocol that are supported. This make it a perfect tool for testing in some of the restricted environment where other tool could not be easily obtained. The same applies to the container environment.

Let’s explore some of theses protocols curl supports.

Telnet with Curl

Open a telnet session with curl using the common format as protocol://hostname:port

For an example, the HTTP service, type in “GET / HTTP/1.0” and enter twice, then we will have the HTTP response.

curl telnet://google.com:80
GET / HTTP/1.0


HTTP/1.0 200 OK
Date: Thu, 13 Apr 2023 08:12:59 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-0UjfoqjKKH08-IJyvrc2KA' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp
P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
Server: gws
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
...

With the telnet, we can send email to a SMTP server on the telnet session. But a better approach is to use the…

--

--