iOS: fix Node.JS JS API call from WebView
@@ -27,6 +27,7 @@ static bool is_net_trace() {
extern int rho_http_started();
extern int rho_http_get_port();
+extern int rho_nodejs_get_port();
const char* rho_http_direct_request( const char* method, const char* uri, const char* query, const void* headers, const char* body, int bodylen, int* responseLength );
void rho_http_free_response( const char* data );
@@ -506,8 +507,16 @@ int on_http_cb(http_parser* parser) { return 0; }
int rhoPort = rho_http_get_port();
+ // path for Rhodes JS API from WebView in case of Node.js application
+ int rhoNodeJSPort = rho_nodejs_get_port();
+ NSString* path = [url path];
+ if (![@"/system/js_api_entrypoint" isEqualToString:path]) {
+ rhoNodeJSPort= -521;
+ }
+
+
BOOL ret = (
- ((port == rhoPort))
+ ((port == rhoPort) || (port == rhoNodeJSPort))
&& ( (strcmp(host,"127.0.0.1")==0) || (strcmp(host,"localhost")==0) )
);
if (is_net_trace()) {
