[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#18116: 24.3.92; url-http calls CALLBACK recursively with malformed C
bug#18116: 24.3.92; url-http calls CALLBACK recursively with malformed CBARGS if the former calls `delete-process'
Tue, 09 Sep 2014 22:24:46 -0400
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)
> (require 'url-http)
> (defvar uht-counter 0)
> (defun uht-callback (status)
> (declare (special url-http-process))
> (message "%s %s" uht-counter status)
> (delete-process url-http-process))
> (defun uht-test ()
> (setq uht-counter (1+ uht-counter))
> ;; The port must not be open.
> (url-http (url-generic-parse-url "http://localhost:3333") #'uht-callback
> (list 'foo)))
[ Thanks a lot Óscar for bisecting this one. ]
Dmitry, could you explain a bit more of the context?
The problem is that calling `delete-process' may run the sentinel (and
since this is code run from the sentinel, it may end up calling the
So if you don't want the sentinel to be called recursively, you'll want
to (set-process-sentinel url-http-process nil) before calling
delete-process (or refrain from calling delete-process).
> If the callback expects STATUS to contain some specific data structure,
> that can cause breakage, see https://github.com/marijnh/tern/issues/350
> for an example.
The format looks normal: the STATUS is expected to be a plist holding
the "history" of the connection. It can contain various ":error FOO"
and ":redirect BAR" entries.
I think the problem comes from a doc error, where url-http points to
url-retrieve for the doc of CBARGS, whereas it uses the format of
- bug#18116: 24.3.92; url-http calls CALLBACK recursively with malformed CBARGS if the former calls `delete-process',
Stefan Monnier <=