calling 'append' on JSONP-RPC

Get help, report and discuss bugs.
hugbug
Developer & Admin
Posts: 7529
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: calling 'append' on JSONP-RPC

Post by hugbug » 08 Mar 2015, 08:45

BreeeZe wrote:It expects a valid "Access-Control-Allow-Origin" response which I suspect isn't provided by NZBGet
It actually is. Not sure if it meets Safari requirements but it's worth a try.
Should you need to debug it it's in WebServer.cpp.

BreeeZe
Posts: 12
Joined: 06 Mar 2015, 22:19

Re: calling 'append' on JSONP-RPC

Post by BreeeZe » 08 Mar 2015, 10:54

hugbug wrote:
BreeeZe wrote:It expects a valid "Access-Control-Allow-Origin" response which I suspect isn't provided by NZBGet
It actually is. Not sure if it meets Safari requirements but it's worth a try.
Should you need to debug it it's in WebServer.cpp.
Well it turns out that I made a javascript scoping error (using 'this' in a closure :oops: ) which caused safari to call NZBGet without an authentication header :)
And it seems that safari also expects the "Access-Control-Allow-Origin" to be present when it receives a "401" or else it will complain about the cross-domain request instead of complaining about authentication !

So, all in all, calling the json api using 'POST' DOES indeed work cross domain, but if you make an error with authentication, the actual error message is lost by a header bug :)

If you would add the "Access-Control-Allow-Origin" header to the response created in the "void WebProcessor::SendAuthResponse()" in WebServer.cpp it should be fine.
(and also probably add it to : "void WebProcessor::SendErrorResponse(const char* szErrCode)" )

So now I can continue on what I actually wanted to do, which is porting the "SABConnect" extension (http://www.kalenhansen.com/?page_id=78) to support NZBGet :)

hugbug
Developer & Admin
Posts: 7529
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: calling 'append' on JSONP-RPC

Post by hugbug » 16 Mar 2015, 20:50

Fixed URL parsing in r1232.

BreeeZe
Posts: 12
Joined: 06 Mar 2015, 22:19

Re: calling 'append' on JSONP-RPC

Post by BreeeZe » 16 Mar 2015, 21:04

hugbug wrote:Fixed URL parsing in r1232.
Nice :)

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 5 guests