Changeset 27 for trunk

Show
Ignore:
Timestamp:
11/11/04 11:01:55 (4 years ago)
Author:
gerd
Message:

Added Proxy-support as requested in Bug#85

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/patSession.php

    r25 r27  
    1717 */                                                                      
    1818define( 'PATSESSION_ERROR_NOT_ACTIVE', 1 ); 
     19 
     20/** 
     21 * error definition: could not load driver 
     22 */                                                                      
     23define( 'PATSESSION_ERROR_DRIVER_NOT_FOUND', 2 ); 
    1924 
    2025/** 
     
    136141                                { 
    137142                                        // search for files 
    138                                         if( $entry === '.' || $entry === '..' || !is_file( $includePath . '/' . $entry ) ) 
     143                                        if( $entry[0] === '.' || !is_file( $includePath . '/' . $entry ) ) 
    139144                                        { 
    140145                                                continue; 
     
    162167                 
    163168                        // create error!  
    164                         return patErrorManager::raiseError( 'patSession:factory:1'
     169                        return patErrorManager::raiseError( 'patSession:' . PATSESSION_ERROR_DRIVER_NOT_FOUND
    165170                                                        'Storage driver not found!', 
    166171                                                        'Driver "'. $storage .'" not found - available drivers: "'. implode( '", "', $available ) .'"' 
  • trunk/patSession/Storage.php

    r26 r27  
    6161        *  - fix_browser 
    6262        *  - fix_referer 
     63    *  - use_token 
    6364        *  
    6465        * @var array $_security list of checks that will be done. 
    6566        */ 
    66         var $_security = array( 'fix_referer', 'fix_ip', 'fix_browser' ); 
     67        var $_security = array( 'fix_referer', 'fix_ip', 'fix_browser', 'use_token' ); 
    6768 
    6869   /** 
     
    278279                        $this->set( '_patSession_atime', null ); 
    279280                        $this->set( '_patSession_clientAddr', null ); 
     281                        $this->set( '_patSession_clientForwarded', null ); 
    280282                        $this->set( '_patSession_clientBrowser', null ); 
    281283                } 
     
    312314                { 
    313315                        // referer must match server 
    314                         preg_match( '°https?://(.*)/°U', $_SERVER['HTTP_REFERER'], $match ); 
     316                        preg_match( '|https?://(.*)/|U', $_SERVER['HTTP_REFERER'], $match ); 
    315317                        $ref    =       $match[1]; 
    316318                         
     
    351353                                return false; 
    352354                        } 
     355                         
     356                        // some polite proxy server tell, for whom they forward the request for 
     357                        if( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) 
     358                        { 
     359                                $forwarded      =       $this->get( '_patSession_clientForwarded' ); 
     360                                 
     361                                if( $forwarded === null ) 
     362                                { 
     363                                        $this->set( '_patSession_clientForwarded', $_SERVER['HTTP_X_FORWARDED_FOR'] ); 
     364                                } 
     365                                else if( $_SERVER['HTTP_X_FORWARDED_FOR'] !== $forwarded ) 
     366                                { 
     367                                        $this->_state   =       'fix_ip_failed'; 
     368                                        return false; 
     369                                } 
     370                        } 
    353371                } 
    354372                 
  • trunk/patSession/Storage/Cli.php

    r26 r27  
    77 * $Id$ 
    88 * 
    9  * @version     1.0.3 
     9 * @version     1.0.5 
    1010 * @package patSession 
    1111 * @subpackage Storage 
  • trunk/patSession/Storage/Native.php

    r26 r27  
    88 * $Id$ 
    99 * 
    10  * @version     1.0.4 
     10 * @version     1.0.5 
    1111 * @package patSession 
    1212 * @subpackage Storage 
  • trunk/patSession/Storage/Null.php

    r26 r27  
    88 * $Id$ 
    99 * 
    10  * @version     1.0.3 
     10 * @version     1.0.5 
    1111 * @package patSession 
    1212 * @subpackage Storage