-
-
Save scentoni/24aca389f2bc12ece5fc005e94f2baf2 to your computer and use it in GitHub Desktop.
Abuse openssl as a curlstitute
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 | |
# Usage: | |
# orl 'https://eu.httpbin.org/#/HTTP_Methods' | |
orl () { | |
url=$1 | |
rex="\([^:]*\)://\([^/]*\)\(/.*\)" | |
uscheme=$(echo $url |sed "s,$rex,\1,") | |
uauthority=$(echo $url |sed "s,$rex,\2,") | |
upath=$(echo $url |sed "s,$rex,\3,") | |
echo "GET ${upath} HTTP/1.1\r\nHost: ${uauthority}\r\nConnection: Close\r\n\r\n" | openssl s_client -quiet -state -connect ${uauthority}:443 |sed '/^HTTP/,/^\r$/d' | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment