Menu

#82 The second http request after https has still 443 port value

None
closed-fixed
None
5
2016-06-29
2015-01-15
ukits
No

When I call https(443) connection with Snoopy and call again http(80) connection with same connection, $port value has '443'. and warning occured like below:

Warning: stream_socket_client(): unable to connect to tcp://www.abc.com:443 (Connection refused) in /home/ukits/extract_html/_common/anylogin/lib/Snoopy.class.php on line 875

For example:

$loginAfterUrl = 'http://www.abc.com';
$loginUrl = 'https://login.abc.com';
$loginFormInputArray = array(...);
$getHttpUrl = 'http://www.abc.com/board';

$Snoopy = new Snoopy;
$Snoopy->referer = $loginAfterUrl;
$Snoopy->submit($loginUrl, $loginFormInputArray);
$Snoopy->setcookies();

$Snoopy->fetch($getHttpUrl); // it has warning
$Snoopy->rawheaders;
$result = $Snoopy->results;

Discussion

  • Gene Wood

    Gene Wood - 2015-05-31

    Thanks for the bug report. This issue has been fixed in Snoopy 2.0.0

    The test I used which works in Snoopy 2.0.0 and fails in Snoopy 1.2.5 is

    <?php
    include "Snoopy.class.php";
    $Snoopy = new Snoopy;
    $Snoopy->fetch("https://accounts.google.com/");
    print_r($Snoopy);
    $Snoopy->fetch("http://www.php.net/");
    print_r($Snoopy);
    ?>
    

    You can get the new version of Snoopy 2.0.0 here

     
  • Gene Wood

    Gene Wood - 2015-05-31
    • status: open --> closed-fixed
    • assigned_to: Gene Wood
    • Group: -->
     
  • Funkybunch

    Funkybunch - 2016-06-29

    I still had the problem. I fixed it by setting the correct port when http is detected.
    At line 866 switch to this:

    if($this->scheme == 'http'){            
        $port = 80;
        $host = "tcp://" . $host;
    }
    
     

    Last edit: Funkybunch 2016-06-29

Log in to post a comment.

MongoDB Logo MongoDB