2 ms·
Heres another way to do it without the subshell, using tr. #!/bin/sh IFS=/;while read w x y z;do v=$(echo x|tr x '\34'); case $w in
by 1vuio0pswjnm7 5y ago
Heres another way to do it without the subshell, using tr.
#!/bin/sh
IFS=/;while read w x y z;do
v=$(echo x|tr x '\34');
case $w in http:|https:);;*)exit;esac;
case $x in "");;*)exit;esac;
echo $y > .host
printf '%s\r\n' "GET /$z HTTP/1.1";
printf '%s\r\n' "Host: $y";
printf 'Connection: keep-alive'$v$v;done \
|sed '$s/keep-alive/close/'|tr '\34\34' '\r\n' > .http;
read x < .host;
# SNI;
#openssl s_client -connect $x:443 -ign_eof -servername $x < .http;
# no SNI;
openssl s_client -connect $x:443 -ign_eof -noservername < .http;
exec rm .host .http;
- 1vuio0pswjnm7 5y agocase $x in "");;*)exit;esac is better written as test ${#x} = 0||exit