Subject: bug#16543: Newsticker retrieve method and https

From: Ulf Jasper <[email-masked]>
Date: Sun, 28 Sep 2014 19:35:22 +0200

> Symbol's function definition is void: lexical-let

My mistake.  Sorry.

After studying the stack trace and doing some tests I found out that the
problem occurs only if

  * `url-retrieve' is called from timers, 
  * the first url is of type https, the second of type http (as you mentioned)
  * gnutls-cli is used for https retrieval (libgnutls works fine)

Here is a recipe for reproducing the error.  I am preparing a fix now.

(defun debbug-16543-callback (status url)
  "Dummy callback method for url-retrieve which ignores STATUS, shows URL.
Show also the current value of `url-gateway-method'."
  (message "debbug-16543-callback url=%s url-gateway-method=%s"
           url url-gateway-method))

(defun debbug-16543-call-url-retreive (url)
  "Call `url-retrieve' for URL.
Forces the gnutls cli to be used."
  (let ((old-gnutls-available-p (symbol-function 'gnutls-available-p)))
    (unwind-protect
        (ignore-errors
          ;; force usage of command line tls
          (setf (symbol-function 'gnutls-available-p)
                #'(lambda () nil))
          ;; call url-retrieve for the url
          (url-retrieve url 'debbug-16543-callback (list url)))
      ;; restore original functions
      (setf (symbol-function 'gnutls-available-p)
            old-gnutls-available-p))))

(defun debbug-16543-check ()
  "Try to reproduce bug#16543.
If bug occurs then the linuxfr.org is fetched via tls which will
cause Emacs to hang."
  (interactive)
  (mapc (lambda (url)
          (run-at-time 0 nil 'debbug-16543-call-url-retreive url))
        '("https://www.archlinux.org/feeds/news/"
          "http://linuxfr.org/news.atom")))