Created
October 29, 2021 10:31
-
-
Save shionryuu/4c3b7ae20adf96bae524669eaf70a0c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function __curl() { | |
read proto server path <<<$(echo ${1//// }) | |
DOC=/${path// //} | |
HOST=${server//:*} | |
PORT=${server//*:} | |
[[ x"${HOST}" == x"${PORT}" ]] && PORT=80 | |
exec 3<>/dev/tcp/${HOST}/$PORT | |
echo -en "GET ${DOC} HTTP/1.0\r\nHost: ${HOST}\r\n\r\n" >&3 | |
(while read line; do | |
[[ "$line" == $'\r' ]] && break | |
done && cat) <&3 | |
exec 3>&- | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment