emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HTTP redirects make url-retrieve-synchronously asynchronous


From: Mark Plaksin
Subject: Re: HTTP redirects make url-retrieve-synchronously asynchronous
Date: Sun, 15 Jan 2006 21:16:37 -0500
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.51 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> It might not be elegant but the attached patch works for me.  If
>> url-retrieve sees :redirect in cbargs, it calls url-retrieve-synchronously
>> and then calls the callback with cbargs.
>
> That wasn't what the attached patch did,

Oops.  The right patch is attached to this note.

> but in any case that'd be a workaround, not a fix.

Yup.  A workaround works for me for the moment :)

--- /home/happy/src/emacs/multi-tty-arch/lisp/url/url.el        2006-01-14 
20:43:24.000000000 -0500
+++ url.el      2006-01-15 15:29:14.000000000 -0500
@@ -146,12 +146,19 @@
     (if url-using-proxy
        (setq asynch t
              loader 'url-proxy))
-    (if asynch
-       (setq buffer (funcall loader url callback cbargs))
-      (setq buffer (funcall loader url))
-      (if buffer
-         (with-current-buffer buffer
-           (apply callback cbargs))))
+    ;; If it's a redirect, force it to be synchronous.
+    (if (member ':redirect cbargs)
+        (progn
+          (setq buffer (url-retrieve-synchronously url))
+          (if buffer
+              (with-current-buffer buffer
+                (apply callback cbargs))))
+      (if asynch
+          (setq buffer (funcall loader url callback cbargs))
+        (setq buffer (funcall loader url))
+        (if buffer
+            (with-current-buffer buffer
+              (apply callback cbargs)))))
     (if url-history-track
        (url-history-update-url url (current-time)))
     buffer))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]