Show
Ignore:
Timestamp:
12/23/06 02:31:43 (14 years ago)
Author:
exi
Message:

Added externalids to autoupgrade code.
Added custom headers to the http_class.
Added an option to set the socket timeout when using the http_class.
Pushed version to 1.2.2 in globals.php.
Fixed a bug in the battle parser which prevented it from parsing kills of the last day.
Added code to the synchronization module so it can handle item value updates as well.
Changed killists so they don't list kills as a kill anymore where an corp/alliance member has been killed, right, those are now pure losses. This should also resolve an issue with the battle parser going mad.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dev/common/class.http.php

    r159 r162  
    2020        $this->postform = array(); 
    2121        $this->postdata = array(); 
     22        $this->headers = array(); 
     23        $this->socket_timeout = 5; 
     24    } 
     25 
     26    // socket timeout is the amount of time in second which is waited 
     27    // for incoming data, set higher if you request stuff from heavy-loaded 
     28    // scripts or compressed data streams 
     29    function setSockettimeout($int) 
     30    { 
     31        $this->socket_timeout = $int; 
    2232    } 
    2333 
     
    5464        if (!$this->fp) 
    5565        { 
    56             //echo "Error occured with fsockopen: $errstr ($errno)<br>\n"; 
     66            $this->_errno = $errno; 
     67            $this->_errstr = $errstr; 
    5768            return false; 
    5869        } 
    5970        return true; 
     71    } 
     72 
     73    function getError() 
     74    { 
     75        return 'Error occured with fsockopen: '.$this->_errstr.' ('.$this->_errno.')<br/>'."\n"; 
    6076    } 
    6177 
     
    8298                          .'Host: '.$this->url['host'].$lf 
    8399                          .'Connection: close'.$lf; 
     100        if (count($this->headers)) 
     101        { 
     102            $request_string .= join($lf, $this->headers).$lf; 
     103        } 
    84104        if ($this->method == 'POST') 
    85105        { 
     
    115135 
    116136        $header = 1; 
    117         socket_set_timeout($fp, 5); 
     137        socket_set_timeout($fp, $this->socket_timeout); 
    118138        while ($line = fgets($fp, 4096)) 
    119139        { 
     
    161181        $this->useragent = $string; 
    162182    } 
     183 
     184    function set_header($headerstring) 
     185    { 
     186        if (!strpos($headerstring, ':')) 
     187        { 
     188            return; 
     189        } 
     190        $this->headers[$headerstring] = $headerstring; 
     191    } 
    163192} 
    164193?>