Menu

#604 curl hangs on few cases of socks5 connections

closed-later
libcurl (356)
5
2014-08-18
2006-09-11
Anonymous
No

curl hangs on few cases of socks5 connections. I use
php with libcurl 7.15.3 and I've seen this issue with
some socks servers. I wanted to make system that
tests socks5 servers with curl, however script hanged
on some socks!

I dont know socks protocol so I can say why it is
happening but here is code to recreate:

<?
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,"http://google.pl");
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_PROXYTYPE,
CURLPROXY_SOCKS5);
curl_setopt ($ch,
CURLOPT_PROXY, "221.208.173.84:3128");
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt ($ch, CURLOPT_TIMEOUT, 5);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
echo "AAA";
$xyz = curl_exec ($ch);
echo "BBB";
?>

I dont know how log socks under 221.208.173.84:3128
will work as it works now. But for now it causes curl
to hang on curl_exec. Script will show AAA but will
NEVER show BBB. Script wont timeout ever, so it will
break every script.

Discussion

  • Daniel Stenberg

    Daniel Stenberg - 2006-09-11

    Logged In: YES
    user_id=1110

    This is fixed in the current development version, I believe.
    Try a daily snapshot or wait for the next release.

     
  • Daniel Stenberg

    Daniel Stenberg - 2006-09-11
    • milestone: --> bad_behaviour
    • status: open --> closed-fixed
     
  • Nobody/Anonymous

    Logged In: NO

    aditional comment: server under 221.208.173.84:3128 might
    not be socks server at all, but this is no reason to curl
    not to timeout! It will break every script that for
    example want to test socks servers

     
  • Nobody/Anonymous

    Logged In: NO

    I've tested september 12 CVS and problem is still there,
    however now it timeouts in like 2-4 minutes - you cant set
    timeout. Try this one:

    <?
    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL,"http://google.pl");
    curl_setopt ($ch, CURLOPT_HEADER, 0);
    curl_setopt ($ch, CURLOPT_PROXYTYPE,
    CURLPROXY_SOCKS5);
    curl_setopt ($ch,
    CURLOPT_PROXY, "202.102.239.179:1080");
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt ($ch, CURLOPT_TIMEOUT, 5);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    echo "AAA";
    $xyz = curl_exec ($ch);
    echo "BBB";
    ?>

     
  • Daniel Stenberg

    Daniel Stenberg - 2006-09-12
    • status: closed-fixed --> closed-later
     
  • Daniel Stenberg

    Daniel Stenberg - 2006-09-12

    Logged In: YES
    user_id=1110

    Ok, so I'll clarify that known bugs #34 apparently still
    goes for socks5 too then. Thanks for testing!

    I don't have any socks5 proxy around and I personally do not
    consider this an important issue to work on.

    Feel free to submit a patch to correct this problem.