🐧Dave Null🐧 is a user on mamot.fr. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.
🐧Dave Null🐧 @devnull
Follow

function setproxy() {
export {http,https,ftp}_proxy='<http://greatfirewall.bullshit.tld>:<PORT>'
}

function unsetproxy() {
unset {http,https,ftp}_proxy
}

function httpretcode {
curl -sIL $1 | grep HTTP | tail -n1 | cut -d " " -f 2
}

· Web · 0 · 0

@devnull Nice, I have an improvement for httpretcode though:

function httpretcode {
curl -sIo /dev/null --write-out '%{http_code}\n' $1
}

@benofbrown curl -sILo /dev/null --write-out '%{http_code}\n' $1 instead of curl -sIo /dev/null --write-out '%{http_code}\n' $1

Without the -L option, you'll get the first status code. I wanted the last one (after all redirects).

@devnull Good point, I often forget about redirects when testing with curl.