[PATCH phosphor-rest-server] Add support for serving jsonp

Brad Bishop bradleyb at fuzziesquirrel.com
Thu Apr 14 23:48:40 AEST 2016


Hi Andrew

JSONP lets you bypass cross-domain policies in web browsers.  That sounds hacky and unsafe, and some people think it is, but the concerns with it are all on the client side.

One use case would be writing some javascript on a PC ( so the “origin” is the PC ).  The browser running the script would not allow xmlhttprequests to the BMC.  We have a web developer writing an application doing exactly this:

https://github.com/LRRoberts0122/openbmc <https://github.com/LRRoberts0122/openbmc>

thx - brad

> On Mar 31, 2016, at 6:27 PM, Andrew Jeffery <andrew at aj.id.au> wrote:
> 
> Hi Brad,
> 
> On Tue, 2016-03-29 at 10:40 -0500, OpenBMC Patches wrote:
>> Jsonp adds a javascript wrapper to json responses.  It allows client
>> applications to work around cross domain restrictions imposed by some
>> browsers.  For more information on jsonp:
>> https://en.wikipedia.org/wiki/JSONP
>> 
>> To get a jsonp response, an application adds a callback url parameter
>> with the desired name of the wrapper:
>> https://192.168.252.1/list?callback=my_callback
> 
> This description covers the what and the how, but I'm not clear on the
> why. Can you add some words describing the motivation for the change
> and/or use-cases this enables? Maybe it's my ignorance of web
> development shining through :)
> 
> Cheers,
> 
> Andrew
> 
>> 
>> <!-- Reviewable:start -->
>> ---
>> This change is [<img src="https://reviewable.io/review_button.svg"
>> height="35" align="absmiddle" alt="Reviewable"/>](
>> https://reviewable.io/reviews/openbmc/phosphor-rest-server/17)
>> <!-- Reviewable:end -->
>> 
>> 
>> https://github.com/openbmc/phosphor-rest-server/pull/17
>> 
>> Brad Bishop (1):
>>  Add support for serving jsonp
>> 
>> obmc-rest | 30 ++++++++++++++++++++++++++++--
>> 1 file changed, 28 insertions(+), 2 deletions(-)
> _______________________________________________
> openbmc mailing list
> openbmc at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/openbmc


More information about the openbmc mailing list