Hey Chris,

The reason I had not been running the body through
gadgets.json.parse() for ContentType.FEED was because the feed object
my patch was sending back was not being escaped as a string when being
placed in response.body.

Since the feed JSON object is being constructed by our own server side
components, it seemed unnecessary to escape it in the response like we
do for 3rd party ContentType.JSON responses.  So it seemed like
unnecessary overhead to require the client javascript
gadgets.json.parse().

With my latest version of the java patch, I changed the behavior to be
consistent with your implementation and escape the feed JSON object as
a string when setting it in response.body.  So it will now function
correctly with this version of io.js.

Maybe the best long term approach would be to set the feed JSON object
(unescaped) directly in response.data on the server side (so we don't
have differing return types in response.body -- sometimes text
sometimes JSON) in order to avoid the additional client side parse.
Or am I missing any potential security issues for ContentType.FEED
requests?  It seems to me like any escaping of 3rd party content will
already happen in construction the feed JSON object.

--gh

On Fri, May 9, 2008 at 12:26 PM,  <[EMAIL PROTECTED]> wrote:
> Author: chabotc
>  Date: Fri May  9 09:26:59 2008
>  New Revision: 654875
>
>  URL: http://svn.apache.org/viewvc?rev=654875&view=rev
>  Log:
>  When applying [EMAIL PROTECTED]'s sugested change from the orignal patch
>  from:
>   else {
>    // Straight into the Feed object - override usual resp structure
>    resp = data.body;
>  too:
>  } else {
>   resp.data = data.body;
>  }
>
>  We missed changing the gadgets.json.parse bit, which broke the feed support.
>  After this change it's working correctly again for the php part, and i fully
>  expect the java side's feed support patch requires this change too to 
> function.
>
>
>  Modified:
>     incubator/shindig/trunk/features/core.io/io.js
>
>  Modified: incubator/shindig/trunk/features/core.io/io.js
>  URL: 
> http://svn.apache.org/viewvc/incubator/shindig/trunk/features/core.io/io.js?rev=654875&r1=654874&r2=654875&view=diff
>  
> ==============================================================================
>  --- incubator/shindig/trunk/features/core.io/io.js (original)
>  +++ incubator/shindig/trunk/features/core.io/io.js Fri May  9 09:26:59 2008
>  @@ -133,21 +133,13 @@
>      };
>      switch (params.CONTENT_TYPE) {
>        case "JSON":
>  -        // Same as before, but specific to JSON (not FEED)
>  +      case "FEED":
>          resp.data = gadgets.json.parse(resp.text);
>          if (!resp.data) {
>            resp.errors.push("failed to parse JSON");
>            resp.data = null;
>          }
>          break;
>  -      case "FEED":
>  -        if (!data.body) {
>  -          resp.errors.push("failed to parse JSON");
>  -          resp.data = null;
>  -        } else {
>  -          resp.data = data.body;
>  -        }
>  -        break;
>        case "DOM":
>          var dom;
>          if (window.ActiveXObject) {
>
>
>

Reply via email to