radio24/TorBox

Problem: improve curl proxy method

Closed this issue · 3 comments

@nyxnor I may found a problem with the following use of curl, but maybe I do something wrong:

OCHECK=$(curl -x socks5h://127.0.0.1:9050 -m 6 -s $CHECK_URL) used here gives a $? of 97 .

I haven't seen the exit code 97 yet neither on the man page https://curl.se/docs/manpage.html#exit-codes

$ curl -x socks5h://127.0.0.1:9050 -m 6 -s https://check.torproject.org/api/ip
{"IsTor":true,"IP":"22.333.444.555"}
$ echo $?
0
$ curl -x socks5h://127.0.0.1:9050 -m 6 -s http://google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
$ echo $?
0

First try was correct domain, second try is incorrect and shows 97

$ OCHECK=$(curl -x socks5h://127.0.0.1:9050 -m 6 -s http://google.com)
$ echo $?
0
$ OCHECK=$(curl -x socks5h://127.0.0.1:9050 -m 6 -s http://google.coa)
$ echo $?
97

Ok, found the problem - it was the URL. Thanks for helping!