Page MenuHomePhabricator

D20155.diff
No OneTemporary

D20155.diff

diff --git a/src/auth/PhutilAmazonAuthAdapter.php b/src/auth/PhutilAmazonAuthAdapter.php
--- a/src/auth/PhutilAmazonAuthAdapter.php
+++ b/src/auth/PhutilAmazonAuthAdapter.php
@@ -63,7 +63,7 @@
protected function loadOAuthAccountData() {
$uri = new PhutilURI('https://api.amazon.com/user/profile');
- $uri->setQueryParam('access_token', $this->getAccessToken());
+ $uri->replaceQueryParam('access_token', $this->getAccessToken());
$future = new HTTPSFuture($uri);
list($body) = $future->resolvex();
diff --git a/src/auth/PhutilDisqusAuthAdapter.php b/src/auth/PhutilDisqusAuthAdapter.php
--- a/src/auth/PhutilDisqusAuthAdapter.php
+++ b/src/auth/PhutilDisqusAuthAdapter.php
@@ -63,8 +63,8 @@
protected function loadOAuthAccountData() {
$uri = new PhutilURI('https://disqus.com/api/3.0/users/details.json');
- $uri->setQueryParam('api_key', $this->getClientID());
- $uri->setQueryParam('access_token', $this->getAccessToken());
+ $uri->replaceQueryParam('api_key', $this->getClientID());
+ $uri->replaceQueryParam('access_token', $this->getAccessToken());
$uri = (string)$uri;
$future = new HTTPSFuture($uri);
diff --git a/src/auth/PhutilFacebookAuthAdapter.php b/src/auth/PhutilFacebookAuthAdapter.php
--- a/src/auth/PhutilFacebookAuthAdapter.php
+++ b/src/auth/PhutilFacebookAuthAdapter.php
@@ -84,8 +84,8 @@
);
$uri = new PhutilURI('https://graph.facebook.com/me');
- $uri->setQueryParam('access_token', $this->getAccessToken());
- $uri->setQueryParam('fields', implode(',', $fields));
+ $uri->replaceQueryParam('access_token', $this->getAccessToken());
+ $uri->replaceQueryParam('fields', implode(',', $fields));
list($body) = id(new HTTPSFuture($uri))->resolvex();
$data = null;
diff --git a/src/auth/PhutilGitHubAuthAdapter.php b/src/auth/PhutilGitHubAuthAdapter.php
--- a/src/auth/PhutilGitHubAuthAdapter.php
+++ b/src/auth/PhutilGitHubAuthAdapter.php
@@ -51,7 +51,7 @@
protected function loadOAuthAccountData() {
$uri = new PhutilURI('https://api.github.com/user');
- $uri->setQueryParam('access_token', $this->getAccessToken());
+ $uri->replaceQueryParam('access_token', $this->getAccessToken());
$future = new HTTPSFuture($uri);
diff --git a/src/auth/PhutilGoogleAuthAdapter.php b/src/auth/PhutilGoogleAuthAdapter.php
--- a/src/auth/PhutilGoogleAuthAdapter.php
+++ b/src/auth/PhutilGoogleAuthAdapter.php
@@ -36,7 +36,7 @@
// a 100x100px image.
if ($uri !== null) {
$uri = new PhutilURI($uri);
- $uri->setQueryParam('sz', 100);
+ $uri->replaceQueryParam('sz', 100);
$uri = (string)$uri;
}
@@ -82,7 +82,7 @@
protected function loadOAuthAccountData() {
$uri = new PhutilURI('https://www.googleapis.com/userinfo/v2/me');
- $uri->setQueryParam('access_token', $this->getAccessToken());
+ $uri->replaceQueryParam('access_token', $this->getAccessToken());
$future = new HTTPSFuture($uri);
list($status, $body) = $future->resolve();
diff --git a/src/auth/PhutilJIRAAuthAdapter.php b/src/auth/PhutilJIRAAuthAdapter.php
--- a/src/auth/PhutilJIRAAuthAdapter.php
+++ b/src/auth/PhutilJIRAAuthAdapter.php
@@ -142,19 +142,21 @@
}
public function newJIRAFuture($path, $method, $params = array()) {
- $uri = new PhutilURI($this->getJIRAURI($path));
if ($method == 'GET') {
- $uri->setQueryParams($params);
- $params = array();
+ $uri_params = $params;
+ $body_params = array();
} else {
// For other types of requests, JIRA expects the request body to be
// JSON encoded.
- $params = json_encode($params);
+ $uri_params = array();
+ $body_params = phutil_json_encode($params);
}
+ $uri = new PhutilURI($this->getJIRAURI($path), $uri_params);
+
// JIRA returns a 415 error if we don't provide a Content-Type header.
- return $this->newOAuth1Future($uri, $params)
+ return $this->newOAuth1Future($uri, $body_params)
->setMethod($method)
->addHeader('Content-Type', 'application/json');
}
diff --git a/src/auth/PhutilOAuth1AuthAdapter.php b/src/auth/PhutilOAuth1AuthAdapter.php
--- a/src/auth/PhutilOAuth1AuthAdapter.php
+++ b/src/auth/PhutilOAuth1AuthAdapter.php
@@ -154,7 +154,7 @@
$this->readTokenAndTokenSecret($data);
$authorize_token_uri = new PhutilURI($this->getAuthorizeTokenURI());
- $authorize_token_uri->setQueryParam('oauth_token', $this->getToken());
+ $authorize_token_uri->replaceQueryParam('oauth_token', $this->getToken());
return (string)$authorize_token_uri;
}
diff --git a/src/auth/PhutilOAuthAuthAdapter.php b/src/auth/PhutilOAuthAuthAdapter.php
--- a/src/auth/PhutilOAuthAuthAdapter.php
+++ b/src/auth/PhutilOAuthAuthAdapter.php
@@ -21,13 +21,13 @@
public function getAuthenticateURI() {
$uri = new PhutilURI($this->getAuthenticateBaseURI());
- $uri->setQueryParam('client_id', $this->getClientID());
- $uri->setQueryParam('scope', $this->getScope());
- $uri->setQueryParam('redirect_uri', $this->getRedirectURI());
- $uri->setQueryParam('state', $this->getState());
+ $uri->replaceQueryParam('client_id', $this->getClientID());
+ $uri->replaceQueryParam('scope', $this->getScope());
+ $uri->replaceQueryParam('redirect_uri', $this->getRedirectURI());
+ $uri->replaceQueryParam('state', $this->getState());
foreach ($this->getExtraAuthenticateParameters() as $key => $value) {
- $uri->setQueryParam($key, $value);
+ $uri->replaceQueryParam($key, $value);
}
return (string)$uri;
diff --git a/src/auth/PhutilPhabricatorAuthAdapter.php b/src/auth/PhutilPhabricatorAuthAdapter.php
--- a/src/auth/PhutilPhabricatorAuthAdapter.php
+++ b/src/auth/PhutilPhabricatorAuthAdapter.php
@@ -80,7 +80,7 @@
protected function loadOAuthAccountData() {
$uri = id(new PhutilURI($this->getPhabricatorURI('api/user.whoami')))
- ->setQueryParam('access_token', $this->getAccessToken());
+ ->replaceQueryParam('access_token', $this->getAccessToken());
list($body) = id(new HTTPSFuture($uri))->resolvex();
try {
diff --git a/src/auth/PhutilTwitterAuthAdapter.php b/src/auth/PhutilTwitterAuthAdapter.php
--- a/src/auth/PhutilTwitterAuthAdapter.php
+++ b/src/auth/PhutilTwitterAuthAdapter.php
@@ -55,11 +55,13 @@
private function getUserInfo() {
if ($this->userInfo === null) {
- $uri = new PhutilURI('https://api.twitter.com/1.1/users/show.json');
- $uri->setQueryParams(
- array(
- 'user_id' => $this->getAccountID(),
- ));
+ $params = array(
+ 'user_id' => $this->getAccountID(),
+ );
+
+ $uri = new PhutilURI(
+ 'https://api.twitter.com/1.1/users/show.json',
+ $params);
$data = $this->newOAuth1Future($uri)
->setMethod('GET')
diff --git a/src/future/aws/PhutilAWSFuture.php b/src/future/aws/PhutilAWSFuture.php
--- a/src/future/aws/PhutilAWSFuture.php
+++ b/src/future/aws/PhutilAWSFuture.php
@@ -98,9 +98,8 @@
$path = $this->getPath();
$data = $this->getData();
- $uri = id(new PhutilURI("https://{$host}/"))
- ->setPath($path)
- ->setQueryParams($params);
+ $uri = id(new PhutilURI("https://{$host}/", $params))
+ ->setPath($path);
$future = id(new HTTPSFuture($uri, $data))
->setMethod($method);
diff --git a/src/future/oauth/PhutilOAuth1Future.php b/src/future/oauth/PhutilOAuth1Future.php
--- a/src/future/oauth/PhutilOAuth1Future.php
+++ b/src/future/oauth/PhutilOAuth1Future.php
@@ -183,7 +183,7 @@
$sign_uri = clone $this->uri;
$sign_uri->setFragment('');
- $sign_uri->setQueryParams(array());
+ $sign_uri->removeAllQueryParams();
$sign_uri->setProtocol(phutil_utf8_strtolower($sign_uri->getProtocol()));
$protocol = $sign_uri->getProtocol();
diff --git a/src/future/slack/PhutilSlackFuture.php b/src/future/slack/PhutilSlackFuture.php
--- a/src/future/slack/PhutilSlackFuture.php
+++ b/src/future/slack/PhutilSlackFuture.php
@@ -48,7 +48,7 @@
$uri = new PhutilURI('https://slack.com/');
$uri->setPath('/api/'.$this->action);
- $uri->setQueryParam('token', $this->accessToken);
+ $uri->replaceQueryParam('token', $this->accessToken);
$future = new HTTPSFuture($uri);
$future->setData($this->params);
diff --git a/src/future/twitch/PhutilTwitchFuture.php b/src/future/twitch/PhutilTwitchFuture.php
--- a/src/future/twitch/PhutilTwitchFuture.php
+++ b/src/future/twitch/PhutilTwitchFuture.php
@@ -48,7 +48,7 @@
$uri = new PhutilURI('https://api.twitch.tv/');
$uri->setPath('/kraken/'.ltrim($this->action, '/'));
- $uri->setQueryParam('oauth_token', $this->accessToken);
+ $uri->replaceQueryParam('oauth_token', $this->accessToken);
$future = new HTTPSFuture($uri);
$future->setData($this->params);

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 12:54 AM (19 h, 59 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6905261
Default Alt Text
D20155.diff (8 KB)

Event Timeline