I have read this and this question. In both they say Emacs can deal with authentication, but it does not work for me.
The question is: What is wrong?
The Emacs version is 24.0.97-1, and it is running on 64-bit Linux.
At work I have to use proxy server for any Internet connection. So I set the following environment variables:
http_proxy="http://username:password@ip:port
https_proxy="https://username:password@ip:port
ftp_proxy="ftp://username:password@ip:port
This works. I can download packages without any problem.
When I run M-x package-refresh-contents
in Emacs it asks me for login and password for the proxy server, but it can not connect to the server. It even does not try to connect, i.e. after I type password and press Enter
Emacs instantly reports:
Failed to download 'marmalade' archive
The same happens if I remove username and password from http_proxy
variable or if I set url-proxy-services
in Emacs (even if I unset the system variable).
Emacs uses only HOST
and PORT
part from http_proxy
.
I get authorization working without user interaction by:
(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")))))
This works for Emacs 24.3. It is based on non-public API tricks, so might not work is another Emacs versions...
Replace LOGIN
and PASSWORD
with your auth info...
Also there is url-http-proxy-digest-auth-storage
. Just fill prompt with authentication data and check which var used by Emacs (by M-:
var RET
)...