all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
To: emacs-devel@gnu.org
Subject: [disumu@x3y2z1.net: url-retrieve-synchronously kills random buffers when redirected]
Date: Mon, 03 Sep 2007 14:26:02 -0400	[thread overview]
Message-ID: <E1ISGcc-00066t-3r@fencepost.gnu.org> (raw)

Would someone please install this, then ack?

------- Start of forwarded message -------
X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY 
	autolearn=failed version=3.1.0
Date: Sun, 02 Sep 2007 02:07:31 +0200
From: Diane Murray <disumu@x3y2z1.net>
To: emacs-devel@gnu.org
Subject: url-retrieve-synchronously kills random buffers when redirected

When using `url-retrieve-synchronously' for http URLs, and requests
are redirected, the *scratch* buffer and others can get killed by
`url-gc-dead-buffers'.  Changing `url-http-parse-headers' to bind the
current buffer to the process buffer fixes this.


2007-09-02  Diane Murray  <disumu@x3y2z1.net>

	* url-http.el (url-http-parse-headers): Bind the current buffer
	rather than calling `url-mark-buffer-as-dead' with
	`current-buffer', so that the correct buffer is killed if
	`url-retrieve-synchronously' gets redirected to a new URL.


Index: url-http.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-http.el,v
retrieving revision 1.53.2.1
diff -u -r1.53.2.1 url-http.el
- --- url-http.el	25 Jul 2007 04:18:21 -0000	1.53.2.1
+++ url-http.el	1 Sep 2007 23:33:46 -0000
@@ -429,7 +429,8 @@
       (when (and connection
 		 (string= (downcase connection) "close"))
 	(delete-process url-http-process)))))
- -  (let ((class nil)
+  (let ((buffer (current-buffer))
+	(class nil)
 	(success nil))
     (setq class (/ url-http-response-status 100))
     (url-http-debug "Parsed HTTP headers: class=%d status=%d" class url-http-response-status)
@@ -447,7 +448,7 @@
        ;; 100 = Continue with request
        ;; 101 = Switching protocols
        ;; 102 = Processing (Added by DAV)
- -       (url-mark-buffer-as-dead (current-buffer))
+       (url-mark-buffer-as-dead buffer)
        (error "HTTP responses in class 1xx not supported (%d)" url-http-response-status))
       (2				; Success
        ;; 200 Ok
@@ -461,14 +462,14 @@
        (case url-http-response-status
 	 ((204 205)
 	  ;; No new data, just stay at the same document
- -	  (url-mark-buffer-as-dead (current-buffer))
+	  (url-mark-buffer-as-dead buffer)
 	  (setq success t))
 	 (otherwise
 	  ;; Generic success for all others.  Store in the cache, and
 	  ;; mark it as successful.
 	  (widen)
 	  (if (and url-automatic-caching (equal url-http-method "GET"))
- -	      (url-store-in-cache (current-buffer)))
+	      (url-store-in-cache buffer))
 	  (setq success t))))
       (3				; Redirection
        ;; 300 Multiple choices
@@ -584,7 +585,7 @@
 			(url-retrieve-internal
 			 redirect-uri url-callback-function
 			 url-callback-arguments))
- -		   (url-mark-buffer-as-dead (current-buffer)))
+		   (url-mark-buffer-as-dead buffer))
 	       ;; We hit url-max-redirections, so issue an error and
 	       ;; stop redirecting.
 	       (url-http-debug "Maximum redirections reached")
@@ -625,7 +626,7 @@
 	  (url-http-handle-authentication nil))
 	 (402
 	  ;; This code is reserved for future use
- -	  (url-mark-buffer-as-dead (current-buffer))
+	  (url-mark-buffer-as-dead buffer)
 	  (error "Somebody wants you to give them money"))
 	 (403
 	  ;; The server understood the request, but is refusing to
@@ -780,7 +781,7 @@
        (error "Unknown class of HTTP response code: %d (%d)"
 	      class url-http-response-status)))
     (if (not success)
- -	(url-mark-buffer-as-dead (current-buffer)))
+	(url-mark-buffer-as-dead buffer))
     (url-http-debug "Finished parsing HTTP headers: %S" success)
     (widen)
     success))


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
------- End of forwarded message -------

             reply	other threads:[~2007-09-03 18:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-03 18:26 Richard Stallman [this message]
2007-09-03 19:29 ` [disumu@x3y2z1.net: url-retrieve-synchronously kills random buffers when redirected] Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1ISGcc-00066t-3r@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.