Skip to content

Instantly share code, notes, and snippets.

@jaredyam
Created April 4, 2022 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredyam/217ca9f4dea69839375de47fe91f960c to your computer and use it in GitHub Desktop.
Save jaredyam/217ca9f4dea69839375de47fe91f960c to your computer and use it in GitHub Desktop.
#!/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