Server geändert
This commit is contained in:
@ -10,18 +10,18 @@ class HTMLPurifier_AttrDef_CSS_URITest extends HTMLPurifier_AttrDefHarness
|
||||
$this->assertDef('', false);
|
||||
|
||||
// we could be nice but we won't be
|
||||
$this->assertDef('http://www.example.com/', false);
|
||||
$this->assertDef('https://www.example.com/', false);
|
||||
|
||||
$this->assertDef('url(', false);
|
||||
$this->assertDef('url("")', true);
|
||||
$result = 'url("http://www.example.com/")';
|
||||
$this->assertDef('url(http://www.example.com/)', $result);
|
||||
$this->assertDef('url("http://www.example.com/")', $result);
|
||||
$this->assertDef("url('http://www.example.com/')", $result);
|
||||
$result = 'url("https://www.example.com/")';
|
||||
$this->assertDef('url(https://www.example.com/)', $result);
|
||||
$this->assertDef('url("https://www.example.com/")', $result);
|
||||
$this->assertDef("url('https://www.example.com/')", $result);
|
||||
$this->assertDef(
|
||||
' url( "http://www.example.com/" ) ', $result);
|
||||
$this->assertDef("url(http://www.example.com/foo,bar\)\'\()",
|
||||
'url("http://www.example.com/foo,bar%29%27%28")');
|
||||
' url( "https://www.example.com/" ) ', $result);
|
||||
$this->assertDef("url(https://www.example.com/foo,bar\)\'\()",
|
||||
'url("https://www.example.com/foo,bar%29%27%28")');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class HTMLPurifier_AttrDef_URI_HostTest extends HTMLPurifier_AttrDefHarness
|
||||
$this->assertDef('.test', false);
|
||||
$this->assertDef('ff');
|
||||
$this->assertDef('1f'); // per RFC 1123
|
||||
// See also http://serverfault.com/questions/638260/is-it-valid-for-a-hostname-to-start-with-a-digit
|
||||
// See also https://serverfault.com/questions/638260/is-it-valid-for-a-hostname-to-start-with-a-digit
|
||||
$this->assertDef('-f', false);
|
||||
$this->assertDef('f1');
|
||||
$this->assertDef('f-', false);
|
||||
|
@ -14,9 +14,9 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
|
||||
|
||||
public function testIntegration()
|
||||
{
|
||||
$this->assertDef('http://www.google.com/');
|
||||
$this->assertDef('http:', '');
|
||||
$this->assertDef('http:/foo', '/foo');
|
||||
$this->assertDef('https://www.google.com/');
|
||||
$this->assertDef('https:', '');
|
||||
$this->assertDef('https:/foo', '/foo');
|
||||
$this->assertDef('javascript:bad_stuff();', false);
|
||||
$this->assertDef('ftp://www.example.com/');
|
||||
$this->assertDef('news:rec.alt');
|
||||
@ -28,15 +28,15 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
|
||||
public function testIntegrationWithPercentEncoder()
|
||||
{
|
||||
$this->assertDef(
|
||||
'http://www.example.com/%56%fc%GJ%5%FC',
|
||||
'http://www.example.com/V%FC%25GJ%255%FC'
|
||||
'https://www.example.com/%56%fc%GJ%5%FC',
|
||||
'https://www.example.com/V%FC%25GJ%255%FC'
|
||||
);
|
||||
}
|
||||
|
||||
public function testPercentEncoding()
|
||||
{
|
||||
$this->assertDef(
|
||||
'http:colon:mercenary',
|
||||
'https:colon:mercenary',
|
||||
'colon%3Amercenary'
|
||||
);
|
||||
}
|
||||
@ -44,23 +44,23 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
|
||||
public function testPercentEncodingPreserve()
|
||||
{
|
||||
$this->assertDef(
|
||||
'http://www.example.com/abcABC123-_.!~*()\''
|
||||
'https://www.example.com/abcABC123-_.!~*()\''
|
||||
);
|
||||
}
|
||||
|
||||
public function testEmbeds()
|
||||
{
|
||||
$this->def = new HTMLPurifier_AttrDef_URI(true);
|
||||
$this->assertDef('http://sub.example.com/alas?foo=asd');
|
||||
$this->assertDef('https://sub.example.com/alas?foo=asd');
|
||||
$this->assertDef('mailto:foo@example.com', false);
|
||||
}
|
||||
|
||||
public function testConfigMunge()
|
||||
{
|
||||
$this->config->set('URI.Munge', 'http://www.google.com/url?q=%s');
|
||||
$this->config->set('URI.Munge', 'https://www.google.com/url?q=%s');
|
||||
$this->assertDef(
|
||||
'http://www.example.com/',
|
||||
'http://www.google.com/url?q=http%3A%2F%2Fwww.example.com%2F'
|
||||
'https://www.example.com/',
|
||||
'https://www.google.com/url?q=http%3A%2F%2Fwww.example.com%2F'
|
||||
);
|
||||
$this->assertDef('index.html');
|
||||
$this->assertDef('javascript:foobar();', false);
|
||||
@ -68,17 +68,17 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
|
||||
|
||||
public function testDefaultSchemeRemovedInBlank()
|
||||
{
|
||||
$this->assertDef('http:', '');
|
||||
$this->assertDef('https:', '');
|
||||
}
|
||||
|
||||
public function testDefaultSchemeRemovedInRelativeURI()
|
||||
{
|
||||
$this->assertDef('http:/foo/bar', '/foo/bar');
|
||||
$this->assertDef('https:/foo/bar', '/foo/bar');
|
||||
}
|
||||
|
||||
public function testDefaultSchemeNotRemovedInAbsoluteURI()
|
||||
{
|
||||
$this->assertDef('http://example.com/foo/bar');
|
||||
$this->assertDef('https://example.com/foo/bar');
|
||||
}
|
||||
|
||||
public function testDefaultSchemeNull()
|
||||
@ -106,7 +106,7 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
|
||||
public function testURIDefinitionValidation()
|
||||
{
|
||||
$parser = new HTMLPurifier_URIParser();
|
||||
$uri = $parser->parse('http://example.com');
|
||||
$uri = $parser->parse('https://example.com');
|
||||
$this->config->set('URI.DefinitionID', 'HTMLPurifier_AttrDef_URITest->testURIDefinitionValidation');
|
||||
|
||||
generate_mock_once('HTMLPurifier_URIDefinition');
|
||||
@ -132,7 +132,7 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
|
||||
HTMLPurifier_DefinitionCacheFactory::instance($factory_mock);
|
||||
$factory_mock->returns('create', $cache_mock);
|
||||
|
||||
$this->assertDef('http://example.com');
|
||||
$this->assertDef('https://example.com');
|
||||
|
||||
HTMLPurifier_DefinitionCacheFactory::instance($old);
|
||||
}
|
||||
@ -155,10 +155,10 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
|
||||
$this->config->set('URI.HostPolicy', 'DenyAll');
|
||||
$this->config->set('URI.HostWhitelist', array(null, 'google.com'));
|
||||
|
||||
$this->assertDef('http://example.com/fo/google.com', false);
|
||||
$this->assertDef('https://example.com/fo/google.com', false);
|
||||
$this->assertDef('server.txt');
|
||||
$this->assertDef('ftp://www.google.com/?t=a');
|
||||
$this->assertDef('http://google.com.tricky.spamsite.net', false);
|
||||
$this->assertDef('https://google.com.tricky.spamsite.net', false);
|
||||
|
||||
}
|
||||
*/
|
||||
|
Reference in New Issue
Block a user