public function testIsSecureChecksScheme()
 {
     $request = new Request('GET', '/resource/123', 'http://example.com');
     $this->assertFalse($request->isSecure());
     $request = new Request('GET', '/resource/123', 'https://example.com');
     $this->assertTrue($request->isSecure());
 }
示例#2
0
文件: Cookie.php 项目: kingsj/core
 /**
  * Returns true if the current cookie matches the supplied request.
  *
  * @return boolean
  */
 public function matchesRequest(Message\Request $request)
 {
     // domain
     if (!$this->matchesDomain(parse_url($request->getHost(), PHP_URL_HOST))) {
         return false;
     }
     // path
     if (!$this->matchesPath($request->getResource())) {
         return false;
     }
     // secure
     if ($this->hasAttribute(static::ATTR_SECURE) && !$request->isSecure()) {
         return false;
     }
     return true;
 }