This repository has been archived by the owner on Jan 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/uri-validation' of https://github.com/Maks3w/zf2 …
…into hotfix/uri-ipv6
- Loading branch information
65 parents
b6ad313
+
f726ae3
+
7ad284f
+
93b2293
+
6b9f3a9
+
8651985
+
ed49c8f
+
861b59b
+
ab368b3
+
42e779e
+
e446b23
+
a77df97
+
83bebb3
+
fac5fe1
+
0ecf55e
+
6c9ab93
+
d1576fd
+
452dcfd
+
a5c8053
+
47591a8
+
4632b67
+
93389c9
+
59d4a69
+
6d7b139
+
d060759
+
a69361e
+
65d2077
+
ab34f04
+
16dc336
+
5ee0e7c
+
a3c5b47
+
0482e7d
+
7349022
+
870fdc6
+
41980d5
+
8191f6d
+
28e1f24
+
c13913c
+
a787df2
+
700bec3
+
6279a0a
+
59e1371
+
384145a
+
2186cf3
+
266dd39
+
58cda5f
+
6880bda
+
9c58077
+
f0a7ffa
+
af9ffb6
+
3a4f745
+
f6ee3fa
+
ab1f64f
+
37055aa
+
785b6c6
+
965cde0
+
b50b4db
+
cdc3a1d
+
d0638c2
+
d2d69cb
+
f47f0b9
+
c9b215a
+
29a471c
+
0110db8
+
d8fbbe0
commit 1914f43
Showing
3 changed files
with
66 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ class HttpTest extends TestCase | |
* | ||
* @return array | ||
*/ | ||
static public function validSchemeProvider() | ||
public function validSchemeProvider() | ||
{ | ||
return array( | ||
array('http'), | ||
|
@@ -55,12 +55,39 @@ static public function validSchemeProvider() | |
); | ||
} | ||
|
||
public function validHostProvider() | ||
{ | ||
return array( | ||
array('', false), | ||
array('http', true), | ||
array('http:', false), | ||
array('http:/', false), | ||
array('http://', false), | ||
array('http:///', false), | ||
array('http://www.example.org/', false), | ||
array('www.example.org:80', false), | ||
array('www.example.org', true), | ||
array('http://foo', false), | ||
array('foo', true), | ||
array('ftp://user:[email protected]/', false), | ||
array('www.fi/', false), | ||
array('http://1.1.1.1/', false), | ||
array('1.1.1.1', true), | ||
array('1.256.1.1', true), // Hostnames can be only numbers | ||
array('http://[::1]/', false), | ||
array('[::1]', true), | ||
array('http://[2620:0:1cfe:face:b00c::3]/', false), | ||
array('[2620:0:1cfe:face:b00c::3]:80', false), | ||
array('[2620:0:1cfe:face:b00c::3]', true), | ||
); | ||
} | ||
|
||
/** | ||
* Invalid HTTP schemes | ||
* | ||
* @return array | ||
*/ | ||
static public function invalidSchemeProvider() | ||
public function invalidSchemeProvider() | ||
{ | ||
return array( | ||
array('file'), | ||
|
@@ -70,7 +97,7 @@ static public function invalidSchemeProvider() | |
); | ||
} | ||
|
||
static public function portNormalizationTestsProvider() | ||
public function portNormalizationTestsProvider() | ||
{ | ||
return array( | ||
array('http://www.example.com:80/foo/bar', 'http://www.example.com/foo/bar'), | ||
|
@@ -123,6 +150,19 @@ public function testValidateSchemeInvalid($scheme) | |
$this->assertFalse(HttpUri::validateScheme($scheme)); | ||
} | ||
|
||
/** | ||
* Test the validity of the hosts | ||
* | ||
* @param string $host | ||
* @param boolean $expected | ||
* @return void | ||
* @dataProvider validHostProvider | ||
*/ | ||
public function testValidateHost($host, $expected) | ||
{ | ||
$this->assertEquals($expected, HttpUri::validateHost($host), "Wrong Host validation $host"); | ||
} | ||
|
||
/** | ||
* Test that normalizing an HTTP URL removes the port depending on scheme | ||
* | ||
|