我想使用url.el(特别是url-http.el)以编程方式进行一些REST调用。
用户已经通过其他方式指定了凭据(但这只是适度相关-我也希望对未经身份验证的调用也具有相同的行为),但是在某些查询上我仍然可以获得401(未经授权)响应。
我希望url.el顺其自然,并返回401响应给我,而无需经历询问用户的所有繁琐操作(只会烦恼再次询问用户)。
注意:我是手动创建初始授权标头的,所以我没有使用url-auth.el中的任何功能(或所谓的任何功能)。
编辑:这似乎为我工作(由Sacha提供的解决方案):
(defvar *foobar-within-call* nil
"Helper variable to indicate if we are withing a foobar call and thus won't want the authentication mechanisms to kick in")
(defadvice url-http-handle-authentication (around foobar-fix)
(unless *foobar-within-call*
ad-do-it))
(ad-activate 'url-http-handle-authentication)
最佳答案
我想您可以在url-http-handle-authentication周围添加一些建议...
关于emacs - 如何在不询问用户401(未经授权)响应的情况下使用Emacs的url.el lib?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1486801/