#1172 curl-7.28.1: PHP curl_getinfo misbehavior

closed-invalid
None
5
2013-06-21
2012-12-11
No

Commit da82f59b697310229ccdf66104d5d65a44dfab98 ends support for CURLOPT_SSL_VERIFYHOST => 1. Using it in a php script still returns values for curl_getinfo() and curl_multi_getcontent(), however, it is not as it should be since the head of the returned HTML is cut off. For example, using the following script

<?php

$cm = curl_multi_init();
$stuffs = curl_init();
$curl_options = array(
CURLOPT_URL => 'http://www.google.ca',
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_SSL_VERIFYHOST => 1, // toggle 0/1 to test
CURLOPT_SSL_VERIFYPEER => 1,
CURLOPT_HEADER => 1
);
curl_setopt_array($stuffs, $curl_options);
curl_multi_add_handle($cm, $stuffs);
do { curl_multi_exec($cm, $running); } while($running > 0);
$content = curl_multi_getcontent($stuffs);
$info = curl_getinfo($stuffs);
curl_multi_remove_handle($cm, $stuffs);
curl_multi_close($cm);
print_r($info);
// cuts off too much, the header size is incorrect
echo mb_substr($content, $info['header_size']);

?>

we get

0473,4000567,4000955,4001042,4001372,4001416,4001569,4001959,4001966,4002000,4002036,4002048,4002161,4002240,4002348,4002359,4002378,4002391,4002436,4002460,4002510,4002562,4002707,4002710,4002733,4002756,4002768,4002773,4002786,4002789,4002868,4002883",ei:"X2bFUMOTFOr-2QWDuYCgDg"},authuser:0,ml:function(){},kHL:"en",time:function(){return(new ....

with "<!doctype html><html" cut off. Setting CURLOPT_SSL_VERIFYHOST => 0 fixes it. Of course, reverting to pre da82f5 "fixes" it to, but as noted in the commit message, this is not a good idea.

Thanks to Andrew Saunders for isolating the issue! See the downstream bug for more info.

https://bugs.gentoo.org/show_bug.cgi?id=444788

Discussion

  • Daniel Stenberg

    Daniel Stenberg - 2012-12-11

    Sorry, but this bugtracker is for curl and libcurl. The PHP/CURL binding is written and maintained by the PHP team, so please submit PHP/CURL bugs to them at https://bugs.php.net/report.php

    If this is a bug in libcurl that happens without PHP, then please provide sample code showing it!

     
  • Daniel Stenberg

    Daniel Stenberg - 2012-12-11
    • assigned_to: nobody --> bagder
    • milestone: --> bad_behaviour
    • labels: --> SSL/TLS
    • status: open --> pending
     
  • Pierrick Charron

    This bug is not a libcurl bug, but a PHP/cURL binding problem (introduced by the CURLOPT_SSL_VERIFYHOST change) and is explained in the php bug : https://bugs.php.net/bug.php?id=63795

     
    Last edit: Pierrick Charron 2012-12-19
  • Daniel Stenberg

    Daniel Stenberg - 2012-12-19
    • labels: SSL/TLS -->
    • status: pending --> closed-invalid
     
  • Daniel Stenberg

    Daniel Stenberg - 2012-12-19

    Thanks a lot for that info Pierrick, closing this entry now.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks