How to make http/https requests yourself with nc/telnet/openssl

Posted . Visible to the public.

Sometimes you want/have to send specific http(s) requests. You can do that easy with curl or just write the request yourself.

make a http request with nc

nc example.com 80
GET / HTTP/1.1
Host: example.com
# press enter

make a http request with telnet

telnet example.com 80
GET / HTTP/1.1
Host: example.com
# press enter

make https request with openssl

openssl s_client -connect example.com:443
GET / HTTP/1.1
Host: example.com
# press enter

You can specify more headers if you want:

nc example.com 80
GET /foo.html HTTP/1.1
Host: example.com
Accept-Encoding: gzip
Accept: text/html
# press enter
Last edit
Kim Klotz
License
Source code in this card is licensed under the MIT License.
Posted by Kim Klotz to makandra dev (2017-04-24 15:25)