Page MenuHomePhabricator

D16009.diff
No OneTemporary

D16009.diff

diff --git a/src/parser/PhutilURI.php b/src/parser/PhutilURI.php
--- a/src/parser/PhutilURI.php
+++ b/src/parser/PhutilURI.php
@@ -76,10 +76,10 @@
$auth = '';
if (strlen($this->user) && strlen($this->pass)) {
- $auth = phutil_escape_uri($this->user).':'.
- phutil_escape_uri($this->pass).'@';
+ $auth = rawurlencode($this->user).':'.
+ rawurlencode($this->pass).'@';
} else if (strlen($this->user)) {
- $auth = phutil_escape_uri($this->user).'@';
+ $auth = rawurlencode($this->user).'@';
}
$prefix = $protocol.'://'.$auth.$this->domain;
diff --git a/src/parser/__tests__/PhutilURITestCase.php b/src/parser/__tests__/PhutilURITestCase.php
--- a/src/parser/__tests__/PhutilURITestCase.php
+++ b/src/parser/__tests__/PhutilURITestCase.php
@@ -65,6 +65,11 @@
$this->assertEqual('@', $uri->getPass());
$this->assertEqual('http://%40:%40@domain.com/', (string)$uri);
+ $uri = new PhutilURI('http://%2F:%2F@domain.com/');
+ $this->assertEqual('/', $uri->getUser());
+ $this->assertEqual('/', $uri->getPass());
+ $this->assertEqual('http://%2F:%2F@domain.com/', (string)$uri);
+
// These tests are covering cases where cURL and parse_url() behavior
// may differ in potentially dangerous ways. See T6755 for discussion.

File Metadata

Mime Type
text/plain
Expires
Tue, Mar 25, 5:07 AM (3 d, 15 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7705864
Default Alt Text
D16009.diff (1 KB)

Event Timeline