Page 2 of 2

Re: calling 'append' on JSONP-RPC

Posted: 08 Mar 2015, 08:45
by hugbug
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.

Re: calling 'append' on JSONP-RPC

Posted: 08 Mar 2015, 10:54
by BreeeZe
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 :)

Re: calling 'append' on JSONP-RPC

Posted: 16 Mar 2015, 20:50
by hugbug
Fixed URL parsing in r1232.

Re: calling 'append' on JSONP-RPC

Posted: 16 Mar 2015, 21:04
by BreeeZe
hugbug wrote:Fixed URL parsing in r1232.
Nice :)