cURL / Mailing Lists / curl-library / Single Mail

curl-library

tsocks (transparent socks) vs. libcurl

From: Cláudio Sampaio <patola_at_gmail.com>
Date: Mon, 25 Jan 2010 07:48:31 -0200

Hello, fellow programmers,

Any of you has any clue with my WWW::Curl program is not working with
transparent socks in Ubuntu Linux?
Would it be due to the certifying agent?
Or does it unset LD_LIBRARY_PATH or something?

Connecting directly through telnet is working, but through libcurl is not:

[patola_at_ubuntola grabber]% export
TSOCKS_CONF_FILE=/etc/tsocks.conf.myintranet
[patola_at_ubuntola grabber]% tsocks telnet myapp.myintranet.net 80

Trying 10.10.10.10...
Connected to myapp.
Escape character is '^]'.
^]quit

telnet> quit
Connection closed.
[patola_at_ubuntola grabber]% tsocks telnet myapp.myintranet.net 443

Trying 10.10.10.10...
Connected to myapp.
Escape character is '^]'.
^]quit

telnet> quit
Connection closed.
[patola_at_ubuntola grabber]% tsocks ./grabber.pl -u mylogin -p mypassword -c
myintranet -v
***** We'll query myintranet tickets (Customer Maximo).
*** We'll query tickets/problems with status QUEUED and approval/assignee
status . Numeric: 0, 0.
*** LOGIN: We'll load https://myapp.myintranet.net/maximo/j_security_check
**** LOGIN: We'll post
j_username=mylogin&j_password=mypassword&login=true&langcode=EN&login_hidden.x=0&login_hidden.y=0
* About to connect() to myapp.myintranet.net port 443 (#0)
* Trying 10.10.10.10... * Timeout
* couldn't connect to host
* Closing connection #0
##### An error happened: Couldn't connect to server (7)
[patola_at_ubuntola grabber]%

Code is:
--------------------------------------(...)
if ($options{'verbose'}) { printf "*** LOGIN: We'll load %s\n**** LOGIN:
We'll post %s\n", $myurl, $mypost }

$curl->setopt(CURLOPT_HEADER,1);
$curl->setopt(CURLOPT_POST,1);
$curl->setopt(CURLOPT_VERBOSE,1);
$curl->setopt(CURLOPT_FOLLOWLOCATION,1);
$curl->setopt(CURLOPT_SSL_VERIFYHOST,0);
$curl->setopt(CURLOPT_COOKIEJAR,$cookiesfile);
$curl->setopt(CURLOPT_COOKIEFILE,$cookiesfile);
$curl->setopt(CURLOPT_USERAGENT,$useragent);
$curl->setopt(CURLOPT_URL, $myurl);
$curl->setopt(CURLOPT_POSTFIELDS, $mypost);

open (my $fileb, ">", \$response_body);
$curl->setopt(CURLOPT_WRITEDATA,$fileb);

# Starts the actual request
my $retcode = $curl->perform;
-----------------------------------------(...)

Thanks in advance for any clue!

Cláudio

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-01-25