Changeset 1247
- Timestamp:
- 01/16/08 17:22:25 (8 months ago)
- Files:
-
- trunk/src/main/php/net/stubbles/websites/memphis/stubMemphisProcessor.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/websites/processors/stubAbstractProcessor.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/websites/processors/stubProcessor.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/websites/memphis/stubMemphisProcessorTestCase.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/websites/memphis/stubMemphisProcessor.php
r1246 r1247 13 13 'net::stubbles::lang::stubMode', 14 14 'net::stubbles::util::stubRegistry', 15 'net::stubbles::util::validators::stubEqualValidator',16 15 'net::stubbles::util::validators::stubPreSelectValidator', 17 16 'net::stubbles::websites::cache::stubCachableProcessor', … … 150 149 $this->cache->addCacheVar('variant', $this->session->getValue('net.stubbles.websites.variantmanager.variant', '')); 151 150 $sslMode = 'no'; 152 if ($this-> request->validateValue(new stubEqualValidator(443), 'SERVER_PORT', stubRequest::SOURCE_HEADER) === true) {151 if ($this->isSSL() === true) { 153 152 $sslMode = 'yes'; 154 153 } … … 302 301 303 302 $sslMode = 'no'; 304 if ($this-> request->validateValue(new stubEqualValidator(443), 'SERVER_PORT', stubRequest::SOURCE_HEADER) === true) {303 if ($this->isSSL() === true) { 305 304 $sslMode = 'yes'; 306 305 } trunk/src/main/php/net/stubbles/websites/processors/stubAbstractProcessor.php
r1231 r1247 8 8 */ 9 9 stubClassLoader::load('net::stubbles::websites::processors::stubProcessor', 10 'net::stubbles::util::validators::stubEqualValidator', 10 11 'net::stubbles::util::validators::stubRegexValidator' 11 12 ); … … 48 49 */ 49 50 protected $interceptorDescriptor = 'interceptors'; 51 /** 52 * switch whether we are running in ssl mode or not 53 * 54 * @var bool 55 */ 56 private $ssl = null; 50 57 51 58 /** … … 83 90 { 84 91 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; 85 109 } 86 110 trunk/src/main/php/net/stubbles/websites/processors/stubProcessor.php
r1231 r1247 45 45 46 46 /** 47 * checks whether the request is ssl or not 48 * 49 * @return bool 50 */ 51 public function isSSL(); 52 53 /** 47 54 * processes the request 48 55 * trunk/src/test/php/net/stubbles/websites/memphis/stubMemphisProcessorTestCase.php
r1231 r1247 740 740 $this->mockMemphisTemplate->expectAt(1, 'addVar', array('frame', 'META_keywords', 'keyword1, keyword2')); 741 741 $this->mockMemphisTemplate->expectNever('addGlobalVars'); 742 $this->mockRequest->setReturnValue('validateValue', false);743 742 $this->mockSession->setReturnValue('hasValue', false); 744 743 $this->mockSession->setReturnValue('getName', 'sessionid'); … … 765 764 $this->mockMemphisTemplate->expectAt(6, 'addGlobalVar', array('SESSION_NAME', '$SESSION_NAME')); 766 765 $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')); 768 767 $this->mockMemphisTemplate->expectNever('addVar'); 769 768 $this->mockMemphisTemplate->expectOnce('addGlobalVars', array(array('name' => 'mikey'), 'USER_')); 770 $this->mockRequest->setReturnValue('validateValue', true);771 769 $this->mockSession->setReturnValue('hasValue', true); 772 770 $this->mockSession->setReturnValueAt(0, 'getValue', 'variant');
