Changeset 1247

Show
Ignore:
Timestamp:
01/16/08 17:22:25 (8 months ago)
Author:
mikey
Message:

added stubProcessor::isSSL()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/websites/memphis/stubMemphisProcessor.php

    r1246 r1247  
    1313                      'net::stubbles::lang::stubMode', 
    1414                      'net::stubbles::util::stubRegistry', 
    15                       'net::stubbles::util::validators::stubEqualValidator', 
    1615                      'net::stubbles::util::validators::stubPreSelectValidator', 
    1716                      'net::stubbles::websites::cache::stubCachableProcessor', 
     
    150149        $this->cache->addCacheVar('variant', $this->session->getValue('net.stubbles.websites.variantmanager.variant', '')); 
    151150        $sslMode = 'no'; 
    152         if ($this->request->validateValue(new stubEqualValidator(443), 'SERVER_PORT', stubRequest::SOURCE_HEADER) === true) { 
     151        if ($this->isSSL() === true) { 
    153152            $sslMode = 'yes'; 
    154153        } 
     
    302301 
    303302        $sslMode = 'no'; 
    304         if ($this->request->validateValue(new stubEqualValidator(443), 'SERVER_PORT', stubRequest::SOURCE_HEADER) === true) { 
     303        if ($this->isSSL() === true) { 
    305304            $sslMode = 'yes'; 
    306305        } 
  • trunk/src/main/php/net/stubbles/websites/processors/stubAbstractProcessor.php

    r1231 r1247  
    88 */ 
    99stubClassLoader::load('net::stubbles::websites::processors::stubProcessor', 
     10                      'net::stubbles::util::validators::stubEqualValidator', 
    1011                      'net::stubbles::util::validators::stubRegexValidator' 
    1112); 
     
    4849     */ 
    4950    protected $interceptorDescriptor = 'interceptors'; 
     51    /** 
     52     * switch whether we are running in ssl mode or not 
     53     * 
     54     * @var  bool 
     55     */ 
     56    private $ssl                    = null; 
    5057 
    5158    /** 
     
    8390    { 
    8491        return $this->interceptorDescriptor; 
     92    } 
     93 
     94    /** 
     95     * checks whether the request is ssl or not 
     96     * 
     97     * @return  bool 
     98     */ 
     99    public function isSSL() 
     100    { 
     101        if (null === $this->ssl) { 
     102            $this->ssl = false; 
     103            if ($this->request->validateValue(new stubEqualValidator(443), 'SERVER_PORT', stubRequest::SOURCE_HEADER) === true) { 
     104                $this->ssl = true; 
     105            } 
     106        } 
     107         
     108        return $this->ssl; 
    85109    } 
    86110 
  • trunk/src/main/php/net/stubbles/websites/processors/stubProcessor.php

    r1231 r1247  
    4545 
    4646    /** 
     47     * checks whether the request is ssl or not 
     48     * 
     49     * @return  bool 
     50     */ 
     51    public function isSSL(); 
     52 
     53    /** 
    4754     * processes the request 
    4855     *  
  • trunk/src/test/php/net/stubbles/websites/memphis/stubMemphisProcessorTestCase.php

    r1231 r1247  
    740740        $this->mockMemphisTemplate->expectAt(1, 'addVar', array('frame', 'META_keywords', 'keyword1, keyword2')); 
    741741        $this->mockMemphisTemplate->expectNever('addGlobalVars'); 
    742         $this->mockRequest->setReturnValue('validateValue', false); 
    743742        $this->mockSession->setReturnValue('hasValue', false); 
    744743        $this->mockSession->setReturnValue('getName', 'sessionid'); 
     
    765764        $this->mockMemphisTemplate->expectAt(6, 'addGlobalVar', array('SESSION_NAME', '$SESSION_NAME')); 
    766765        $this->mockMemphisTemplate->expectAt(7, 'addGlobalVar', array('SESSION_ID', '$SESSION_ID')); 
    767         $this->mockMemphisTemplate->expectAt(8, 'addGlobalVar', array('SSL_MODE', 'yes')); 
     766        $this->mockMemphisTemplate->expectAt(8, 'addGlobalVar', array('SSL_MODE', 'no')); 
    768767        $this->mockMemphisTemplate->expectNever('addVar'); 
    769768        $this->mockMemphisTemplate->expectOnce('addGlobalVars', array(array('name' => 'mikey'), 'USER_')); 
    770         $this->mockRequest->setReturnValue('validateValue', true); 
    771769        $this->mockSession->setReturnValue('hasValue', true); 
    772770        $this->mockSession->setReturnValueAt(0, 'getValue', 'variant');