4 messages in com.googlegroups.opensocial-orkut[orkut-developer] Signed POST makeReq...| From | Sent On | Attachments |
|---|---|---|
| jfahrenkrug | 26 May 2008 02:33 | |
| jfahrenkrug | 28 May 2008 01:01 | |
| Jason | 02 Jun 2008 18:23 | |
| jfahrenkrug | 09 Jul 2008 01:34 |
| Subject: | [orkut-developer] Signed POST makeRequest calls fail with url-encoded special chars![]() |
|---|---|
| From: | jfahrenkrug (jfah...@gmail.com) |
| Date: | 05/26/2008 02:33:26 AM |
| List: | com.googlegroups.opensocial-orkut |
Hi guys,
I have a problem with signed makeRequest calls using POST data and special chars like quotation marks. I have a form that lets a user enter a url and a description. I use jQuery for serializing the form. this is my code:
var params = {};
params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED; params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON; params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST; var data = $('#transload_form').formSerialize(); if (DEBUG) console.log(data); params[gadgets.io.RequestParameters.POST_DATA] = data + '&action=transload';
makeCachedRequest(INTERFACE_URL, transloadCallback, params, 0);
makeCachedRequest looks like this:
function makeCachedRequest(url, callback, params, refreshInterval) { var ts = new Date().getTime(); var sep = "?"; if (refreshInterval && refreshInterval > 0) { ts = Math.floor(ts / (refreshInterval * 1000)); } if (url.indexOf("?") > -1) { sep = "&"; } //network_name is a global var containing either "myspace" or "orkut" url = [ url, sep, "network=", network_name, "&nocache=", ts ].join(""); gadgets.io.makeRequest(url, callback, params); }
now all this works like a charm with ASCII only characters, ie when the file description reads My great file
but when it reads A picture of my cute cat "Darth Vader"
the oauth validation fails.
jQuery's formSerialize urlencodes special chars so that " becomes %22.
I've tracked this down this far: in the console.log firebug output the field value of bla"blubb becomes bla%22blubb which seems right. The request sent to the gmodules gadgets proxy is the same (tldesc=bla%22blubb), so that seems fine, too. When I output the $_REQUEST on my server like this:
$payload['orig_request'] = implode("&", $_REQUEST); print(json_encode($payload));
I get this back in my json response string: bla\\\\\\\"blubb
A couple of backslashes too many, I guess.
Is this related to this issue:
http://code.google.com/p/opensocial-resources/issues/detail?id=2
??
Am I missing something here?
Thanks for your help!
- Johannes
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Orkut
Developer Forum" group.
To post to this group, send email to open...@googlegroups.com
To unsubscribe from this group, send email to
open...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/opensocial-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---




