Skip to content

Commit 1ed79a4

Browse files
committed
Revert "Do not prepend 'http' to URLs without schemes. #46."
This reverts commit 00bdb37.
1 parent 6a7609b commit 1ed79a4

File tree

3 files changed

+2
-33
lines changed

3 files changed

+2
-33
lines changed

src/Pdp/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function parseUrl($url)
6363
);
6464

6565
if (preg_match(self::SCHEME_PATTERN, $url) === 0) {
66-
$url = '//' . preg_replace('#^//#', '', $url, 1);
66+
$url = 'http://' . preg_replace('#^//#', '', $url, 1);
6767
}
6868

6969
$parts = pdp_parse_url($url);

tests/src/Pdp/ParserTest.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -153,30 +153,6 @@ public function testpdp_parse_urlCanReturnCorrectHost($url, $publicSuffix, $regi
153153
);
154154
}
155155

156-
/**
157-
* @group issue46
158-
*
159-
* Don't add a scheme to schemeless URLs
160-
*
161-
* @see https://github.com/jeremykendall/php-domain-parser/issues/46
162-
*/
163-
public function testDoNotPrependSchemeToSchemelessUrls()
164-
{
165-
$schemeless = 'www.graphstory.com';
166-
$expected = 'www.graphstory.com';
167-
$url = $this->parser->parseUrl($schemeless);
168-
$actual = $url->__toString();
169-
170-
$this->assertEquals($expected, $actual);
171-
172-
$schemeless = '//www.graphstory.com';
173-
$expected = 'www.graphstory.com';
174-
$url = $this->parser->parseUrl($schemeless);
175-
$actual = $url->__toString();
176-
177-
$this->assertEquals($expected, $actual);
178-
}
179-
180156
public function parseDataProvider()
181157
{
182158
return array(

tests/src/Pdp/Uri/UrlTest.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,13 @@ public function testFtpUrlToString()
128128
}
129129

130130
/**
131-
* This test fixes #29. It has been updated due to a change suggested in #46.
132-
* The original $expected value was 'http://яндекс.рф', as parsing would add
133-
* 'http://' to URLs that did not have a scheme. That behavior has been removed.
134-
* The new $expected result is 'яндекс.рф'.
135-
*
136131
* @group issue29
137-
* @group issue46
138132
* @see https://github.com/jeremykendall/php-domain-parser/issues/29
139-
* @see https://github.com/jeremykendall/php-domain-parser/issues/46
140133
*/
141134
public function testIdnToAscii()
142135
{
143136
$idn = 'Яндекс.РФ';
144-
$expected = 'яндекс.рф';
137+
$expected = 'http://яндекс.рф';
145138
$url = $this->parser->parseUrl($idn);
146139
$actual = $url->__toString();
147140

0 commit comments

Comments
 (0)