gpt4 book ai didi

authentication - 在需要身份验证的代理后面使用 ELPA (Emacs)

转载 作者:行者123 更新时间:2023-12-03 01:09:59 25 4
gpt4 key购买 nike

我已阅读thisthis问题。他们都说 Emacs 可以处理身份验证,但它对我不起作用。

问题是:出了什么问题?

Emacs 版本是 24.0.97-1,它在 64 位 Linux 上运行。

在工作中,我必须使用代理服务器进行任何互联网连接。所以我设置了以下环境变量:

http_proxy="http://username:password@ip:port"
https_proxy="https://username:password@ip:port"
ftp_proxy="ftp://username:password@ip:port"

这有效,我可以毫无问题地下载软件包。

当我在 Emacs 中运行 M-x package-refresh-contents 时,它要求我输入代理服务器的登录名和密码,但无法连接到服务器。它甚至不尝试连接,即在我输入密码并按 Enter Emacs 立即 报告后:无法下载“marmalade”存档

如果我从 http_proxy 变量中删除用户名和密码,或者在 Emacs 中设置 url-proxy-services (即使我取消设置系统变量),也会发生同样的情况。

最佳答案

Emacs 仅使用 http_proxy 中的 HOSTPORT 部分。

我通过以下方式获得授权,无需用户交互即可工作:

(setq url-proxy-services
'(("no_proxy" . "^\\(localhost\\|10.*\\)")
("http" . "proxy.com:8080")
("https" . "proxy.com:8080")))

(setq url-http-proxy-basic-auth-storage
(list (list "proxy.com:8080"
(cons "Input your LDAP UID !"
(base64-encode-string "LOGIN:PASSWORD")))))

这适用于 Emacs 24.3。它基于非公共(public) API 技巧,因此其他 Emacs 版本可能不起作用...

LOGINPASSWORD 替换为您的身份验证信息...

还有url-http-proxy-digest-auth-storage。只需用身份验证数据填充提示并检查 Emacs 使用哪个 var(通过 M-: var RET)...

关于authentication - 在需要身份验证的代理后面使用 ELPA (Emacs),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10787087/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com