Пример #1
0
 public function testRemoteURIForFetch()
 {
     $map = array('http://example.com/' => true, '' => false, 'http://' => false, 'evil.com' => false, '//evil.com' => false, 'javascript://evil.com/' => false, 'file:///etc/shadow' => false, 'http://u1VcxwUp368SIFzl7rkWWg23KM5JPB2kTHHngxjXCQc.zzz/' => false, 'http://127.0.0.1/' => false, 'http://169.254.169.254/latest/meta-data/hostname' => false, 'http://localhost/' => false);
     $protocols = array('http', 'https');
     foreach ($map as $uri => $expect) {
         $this->assertEqual($expect, PhabricatorEnv::isValidRemoteURIForFetch($uri, $protocols), pht('Valid fetchable remote URI: %s', $uri));
     }
 }