You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by an...@apache.org on 2013/08/29 19:31:35 UTC
git commit: JCLOUDS-257: Removing special handling for URL decoding
"magic"
Updated Branches:
refs/heads/fix-fgcp-tests [created] 126116ed8
JCLOUDS-257: Removing special handling for URL decoding "magic"
Decoding "magic" was removed in https://github.com/jclouds/jclouds/commit/12f29fd8a9e50203acc12ccf794cf73c0abf5703
Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/commit/126116ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/tree/126116ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/diff/126116ed
Branch: refs/heads/fix-fgcp-tests
Commit: 126116ed8ac3700a846fc056153e75a1a3419ba7
Parents: 14fbe2d
Author: Andrew Phillips <de...@yahoo.co.uk>
Authored: Thu Aug 29 13:26:56 2013 -0400
Committer: Andrew Phillips <an...@apache.org>
Committed: Thu Aug 29 13:31:05 2013 -0400
----------------------------------------------------------------------
.../fujitsu/fgcp/filters/RequestAuthenticator.java | 10 ----------
.../fujitsu/fgcp/filters/RequestAuthenticatorTest.java | 6 ++----
2 files changed, 2 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/126116ed/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/filters/RequestAuthenticator.java
----------------------------------------------------------------------
diff --git a/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/filters/RequestAuthenticator.java b/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/filters/RequestAuthenticator.java
index ff50524..dac21a5 100644
--- a/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/filters/RequestAuthenticator.java
+++ b/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/filters/RequestAuthenticator.java
@@ -155,22 +155,12 @@ public class RequestAuthenticator implements HttpRequestFilter, RequestSigner {
@VisibleForTesting
HttpRequest addQueryParamsToRequest(HttpRequest request, String accessKeyId, String signature, String lang) {
- // url encode "+" (which comes from base64 encoding) or else it may be
- // converted into a %20 (space) which the API endpoint doesn't
- // expect/accept.
- accessKeyId = accessKeyId.replace("+", "%2B");
- signature = signature.replace("+", "%2B");
-
Multimap<String, String> decodedParams = queryParser().apply(request.getEndpoint().getRawQuery());
Builder<?> builder = request.toBuilder().endpoint(request.getEndpoint()).method(request.getMethod());
if (!decodedParams.containsKey("Version")) {
builder.addQueryParam(RequestParameters.VERSION, apiVersion);
}
builder.addQueryParam(RequestParameters.LOCALE, lang).addQueryParam(RequestParameters.ACCESS_KEY_ID, accessKeyId)
- // the addition of another param causes %2B's in prev. params to
- // convert to %20. Needs to be addressed if there are cases where
- // accessKeyId contains %2B's.
- // So signature should be added last:
.addQueryParam(RequestParameters.SIGNATURE, signature);
return builder.build();
http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/126116ed/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/filters/RequestAuthenticatorTest.java
----------------------------------------------------------------------
diff --git a/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/filters/RequestAuthenticatorTest.java b/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/filters/RequestAuthenticatorTest.java
index 42511cf..58e29e3 100644
--- a/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/filters/RequestAuthenticatorTest.java
+++ b/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/filters/RequestAuthenticatorTest.java
@@ -139,9 +139,7 @@ public class RequestAuthenticatorTest {
.build();
HttpRequest newRequest = a.addQueryParamsToRequest(request, accessKeyId, signature, lang);
assertEquals(newRequest.getRequestLine(),
- // NOTE: AccessKeyId's "=" becomes a %20 (space) as explained in
- // addQueryParamsToRequest().
- "GET https://api.globalcloud.fujitsu.com.au/ovissapi/endpoint?Version=2012-02-18&Locale=en&AccessKeyId=accessKey%20Id&Signature=sign%2Bature HTTP/1.1");
+ "GET https://api.globalcloud.fujitsu.com.au/ovissapi/endpoint?Version=2012-02-18&Locale=en&AccessKeyId=accessKey%2BId&Signature=sign%2Bature HTTP/1.1");
}
@Test
@@ -158,6 +156,6 @@ public class RequestAuthenticatorTest {
HttpRequest newRequest = a.addQueryParamsToRequest(request, accessKeyId, signature, lang);
assertEquals(
newRequest.getRequestLine(),
- "GET https://api.globalcloud.fujitsu.com.au/ovissapi/endpoint?Version=2012-02-18&Locale=en&AccessKeyId=accessKeyId%0AWith/And%20And%3D&Signature=signature%0AWith/And%2BAnd%3D HTTP/1.1");
+ "GET https://api.globalcloud.fujitsu.com.au/ovissapi/endpoint?Version=2012-02-18&Locale=en&AccessKeyId=accessKeyId%0AWith/And%2BAnd%3D&Signature=signature%0AWith/And%2BAnd%3D HTTP/1.1");
}
}