Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAAW导出不支持带密码的rpc地址 #27

Open
bearqq opened this issue Jun 2, 2013 · 9 comments
Open

YAAW导出不支持带密码的rpc地址 #27

bearqq opened this issue Jun 2, 2013 · 9 comments

Comments

@bearqq
Copy link

bearqq commented Jun 2, 2013

设置密码后用如下地址无法正常添加
http://name:[email protected]:6800/jsonrpc

取消密码后可正常添加

@binux
Copy link
Owner

binux commented Jun 3, 2013

firefox?

@bearqq
Copy link
Author

bearqq commented Jun 3, 2013

是的,firefox-。- FF21,linux。囧~

@jarvisc
Copy link

jarvisc commented Jun 26, 2013

把586行,url.oepn中提供的url参数里面的 用户名/密码部份去掉就可以支持了. firefox对于http://user:pass@xxx的url似乎做了某些限制

@jarvisc
Copy link

jarvisc commented Jun 26, 2013

var ARIA2 = (function() {
var jsonrpc_version = '2.0';

function get_auth(url) {
return url.match(/^(?:(?![^:@]+:[^:@\/]@)[^:\/?#.]+:)?(?://)?(?:([^:@](?::[^:@]*)?)?@)?/)[1];
};

function request(jsonrpc_path,auth, method, params) {
var request_obj = {
jsonrpc: jsonrpc_version,
method: method,
id: (new Date()).getTime().toString(),
};
if (params) request_obj['params'] = params;
var xhr = new XMLHttpRequest();
xhr.open("POST", jsonrpc_path+"?tm="+(new Date()).getTime().toString(), true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
if (auth) xhr.setRequestHeader("Authorization", "Basic "+btoa(auth));
xhr.send(JSON.stringify(request_obj));
};

return function(jsonrpc_path) {
this.auth = get_auth(jsonrpc_path);
if (this.auth) jsonrpc_path = jsonrpc_path.replace(//[^@]*@/g,"//");
this.jsonrpc_path = jsonrpc_path;
this.addUri = function (uri, options) {
request(this.jsonrpc_path,this.auth, 'aria2.addUri', [[uri, ], options]);
};
return this;
}
})();
} // end of wrapper

这么改一下,在firefox中通过了,其他的没测试

@Aelanord
Copy link

似乎在目前最新的commit 629496c3a4里也存在这个问题,当RPC需要密码验证时,Chrome下使用YAAW导出无效。

@binux
Copy link
Owner

binux commented Apr 28, 2014

@jsntay 什么密码?token?

@Aelanord
Copy link

不好意思,没有说清楚。就是当ARIA2中设置了JSON-RPC的用户名和密码的时候,使用形如http://name:[email protected]:6800/jsonrpc的地址并不能添加YAAW任务,而取消用户名和密码设置后就是正常的。

@binux
Copy link
Owner

binux commented Apr 28, 2014

aria2版本是什么?

@Aelanord
Copy link

1.18.3,webui-aria2等客户端均可使用用户名和密码与aria2正常连接

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants