Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318373 - org.eclipse.ecf.remoteservice.rest.client.RestClientService encodes the parameter name/value pairs twice
Summary: org.eclipse.ecf.remoteservice.rest.client.RestClientService encodes the param...
Status: RESOLVED FIXED
Alias: None
Product: ECF
Classification: RT
Component: ecf.remoteservices (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Scott Lewis CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-29 15:19 EDT by Nicolas Rouquette CLA
Modified: 2010-06-30 12:41 EDT (History)
1 user (show)

See Also:


Attachments
Patch for RestClientService::toNameValuePairs() to remove the redundant encoding of the name/value pairs. (2.20 KB, patch)
2010-06-29 15:20 EDT, Nicolas Rouquette CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Rouquette CLA 2010-06-29 15:19:23 EDT
There is a subtle bug in the ECF framework that results in a double encoding of HTTP post/get/put requests.

The methods RestClientService::prepare[X]Method for X = Post, Get, Put follow the same pattern to set the request query string from the request parameters:

		HttpMethod result =...

		NameValuePair[] params = toNameValuePairs(uri, call, callable);
		if (params != null)
			result.setQueryString(params);
		return result;
		
According to doc, org.apache.commons.httpclient.HttpMethod.setQueryString(NameValuePair[]) already encodes the name value pairs.
This is on top of the encoding that RestClientService::toNameValuePairs() currently does, resulting in doubly encoded name/value pairs in the query string.

The suggested fix is to simply remove the encoding in RestClientService::toNameValuePairs() as shown in the attached patch.
Comment 1 Nicolas Rouquette CLA 2010-06-29 15:20:22 EDT
Created attachment 173037 [details]
Patch for RestClientService::toNameValuePairs() to remove the redundant encoding of the name/value pairs.
Comment 2 Scott Lewis CLA 2010-06-29 16:06:41 EDT
Thanks for the report and the patch Nicolas.  I'll review the patch and apply/release to HEAD as soon as I can.
Comment 3 Scott Lewis CLA 2010-06-30 10:55:47 EDT
Patch applied and released to HEAD.  Thanks again Nicolas for the report and the fix.
Comment 4 Scott Lewis CLA 2010-06-30 12:41:40 EDT
Also applied patch to Release_3_3 stream (for 3.3.1 service release).