Send https request with openssl s_client
Inspired by https://news.ycombinator.com/item?id=32903694.
To send a simple http get with openssl s_client
, use this template.
sed -r -e 's/$/\r/;' <<EOF | openssl s_client -connect www.example.com:443 -ign_eof GET /internal/directory.html HTTP/1.1 Host: www.example.com Connection: close EOF
Or with printf.
printf 'GET /internal/directory.html HTTP/1.1\r\nHost: www.example.com\r\nConnection: close\r\n\r\n' | openssl s_client -connect www.example.com:443 -ign_eof
Here is a sample post:
sed -r -e 's/$/\r/;' <<EOF | openssl s_client -connect server3.ipa.internal.com:443 -ign_eof POST /coupons/search/ HTTP/1.0 Host: server3.ipa.internal.com Connection: close Content-Type: text/plain;charset=UTF-8 Accept: text/plain cheese EOF
Comments