2

I am using emacs behind a firewall in Windows. I configured the access to proxy and I worked with no problems for a week. But now I can't upgrade emacs packages using Melpa, because the proxy refuses to download packages ("Bad request"). Any clue to what may happened?

This is the result of emacs with --init-debug:

Debugger entered--Lisp error: (file-error "http://melpa.milkbox.net/packages/archive-contents" "Bad Request")
  signal(file-error ("http://melpa.milkbox.net/packages/archive-contents" "Bad Request"))
  url-insert-file-contents("http://melpa.milkbox.net/packages/archive-contents")
  package--download-one-archive(("melpa" . "http://melpa.milkbox.net/packages/") "archive-contents")
  #[0 "\301\300\302\"\207" [("melpa" . "http://melpa.milkbox.net/packages/") package--download-one-archive "archive-contents"] 3 "\n\n(fn)"]()
  funcall(#[0 "\301\300\302\"\207" [("melpa" . "http://melpa.milkbox.net/packages/") package--download-one-archive "archive-contents"] 3 "\n\n(fn)"])
  package-refresh-contents()
  eval-buffer(#<buffer  *load*> nil "c:/Users/sergio.bacelar/.emacs.d/init.el" nil t)  ; Reading at buffer position 8124
  load-with-code-conversion("c:/Users/sergio.bacelar/.emacs.d/init.el" "c:/Users/sergio.bacelar/.emacs.d/init.el" t t)
  load("c:/Users/sergio.bacelar/.emacs.d/init" t t)
  #[0 "\205\262
sbac
  • 399
  • 4
  • 13
  • @lunaryorn: Please consider posting that as an answer. The question is good (helpful), as is the answer. – Drew Aug 17 '16 at 14:51
  • @Drew Ok, I'll replace my comment with an answer. –  Aug 17 '16 at 14:53
  • I have the same problem, and it persists even after changing to `https://melpa.org/packages/`. It appears that Emacs is sending a `GET https://...` request to the proxy, which gets a 400 Bad Request response. On the other hand, wget sends a `CONNECT melpa.org:443` request to the proxy, and manages to download the files. – legoscia Aug 18 '16 at 12:35

1 Answers1

2

The URL you're using is outdated; MELPA now serves from https://melpa.org. Please replace ("melpa" . "http://melpa.milkbox.net/packages/") in your package-archives with ("melpa" . "https://melpa.org/packages/"). Then restart Emacs and try again.

Should the error still occur, please try curl https://melpa.org/packages/archive-contents or wget https://melpa.org/packages/archive-contents to check whether the error comes from Emacs' or from the proxy server. If curl/wget return a bad request as well please contact the administrator of the proxy server.

Also note that MELPA had some downtime recently so you may want to try again in a couple of days if you're still getting the error after changing the URLs.

  • Solved, after changing (in my Windows Emacs version) http://melpa.milkbox.net to http://melpa.org. What I am failing to understand is why the old address (melpa.milkbox.net) works in OSX (not behind a firewall) but not in Windows (behind a firewall)... – sbac Aug 17 '16 at 15:12
  • @sbac I don't know either, but MELPA is still having issues currently so unless you tried at the very same time it might as well have been a connection issue. Maybe MELPA timed out and the (misconfigured) proxy turned it into a 400? Hard to say with so little information. –  Aug 17 '16 at 15:27