From:             administrator at gesoft dot org
Operating system: FreeBSD 6.1
PHP version:      5.2.5
PHP Bug Type:     cURL related
Bug description:  curl_multi work in single thread with socks5

Description:
------------
curl_multi does not processing multiple cURL handles in parallel when
SOCKS type proxies are used. This could be easily determined by checking
the spent time or by using any NET software to check amount of opened
connections for particular process (you will see that curl_multi opens one
or max two connections at a time)

Reproduce code:
---------------
  $mh = curl_multi_init();
  foreach ($servers as $server) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'http://google.com');
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_ENCODING, '');
    curl_setopt($ch, CURLOPT_PROXY, trim($server));
    curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);  
    curl_multi_add_handle($mh, $ch);
  }

  $microTime = GetMicroTime();
  do {
    do {
    } while (curl_multi_exec($mh, $stillRunning) ===
CURLM_CALL_MULTI_PERFORM);
  } while ($stillRunning);  
  $timeSpend = GetMicroTime() - $microTime;

  echo sprintf('%01.4f', $timeSpend);

Expected result:
----------------
The maximum spent time should be ~5 sec.

Actual result:
--------------
While the actual value vary from 20 till 35 sec. 

p.s. If you will use simple HTTP type proxies the result will be as
expected ~5 sec.

-- 
Edit bug report at http://bugs.php.net/?id=44553&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44553&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44553&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44553&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44553&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44553&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44553&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44553&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44553&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44553&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44553&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44553&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44553&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44553&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44553&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44553&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44553&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44553&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44553&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44553&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44553&r=mysqlcfg

Reply via email to