HTTP Proxy bug

Help
2010-04-07
2013-05-21
  • After trying to get NuSOAP to work behind a firewall, I found that there was actually a bug in NuSOAP that prevent the HTTP Proxy port from being used.

    The bug is not difficult to replicate:

    $client->setHTTPProxy('192.168.0.1','8080');
    

    should use port 8080 to connect to the HTTP proxy. instead it uses the port it got via the wsdl.

    The fix is easy. Maybe this can be added to this version of NuSOAP as well?

    Around line 2323 in nusoap.php, as part of the 'connect' function in the soap_transport_http class:

    // open socket
    if($connection_timeout > 0){
      $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout);
    } else {
      $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
    }
    

    should be changed to:

    // open socket
    if($connection_timeout > 0){
      $this->fp = @fsockopen( $host, $port, $this->errno, $this->error_str, $connection_timeout);
    } else {
      $this->fp = @fsockopen( $host, $port, $this->errno, $this->error_str);
    }
    

    marcel

     
  • Not sure what happened in my previous post, but the new code should read:

    // open socket
    if($connection_timeout > 0){
    $this->fp = @fsockopen( $host, $port, $this->errno, $this->error_str, $connection_timeout);
    } else {
    $this->fp = @fsockopen( $host, $port, $this->errno, $this->error_str);
    }