unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [vivek@zeus.com: url libraries can reult in destruction of wrong buffer after 401]
@ 2004-10-17  7:24 Richard Stallman
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Stallman @ 2004-10-17  7:24 UTC (permalink / raw)


Could someone take a look at what to do here?  I am not sure
whether this is still relevant--his suggestion seems to assume that
url-http-handle-authentication returns a new buffer, but it does not
appear to do that now.

Would someone please DTRT and ack to me?


------- Start of forwarded message -------
To: bug-gnu-emacs@gnu.org
From: Vivek Dasmohapatra <vivek@zeus.com>
Date: Tue, 28 Sep 2004 16:13:13 +0100
X-Scanner: exiscan *1CCJfG-0000T2-00*YBhr5NphPPU* (Zeus Technology Ltd)
Subject: url libraries can reult in destruction of wrong buffer after 401
Sender: bug-gnu-emacs-bounces+rms=gnu.org@gnu.org
X-Spam-Status: No, hits=0.5 required=5.0
	tests=RCVD_IN_ORBS
	version=2.55
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.3.1 (i386-pc-linux-gnu, X toolkit)
 of 2004-08-26 on nessus, modified by Debian
configured using `configure '--build=i386-linux' '--host=i386-linux' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--with-x=yes' '--with-x-toolkit=athena' '--without-toolkit-scroll-bars' 'CFLAGS=-DDEBIAN -g -O2' 'build_alias=i386-linux' 'host_alias=i386-linux''
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: ja_JP
  value of $LC_CTYPE: ja_JP
  value of $LC_MESSAGES: en_GB
  value of $LC_MONETARY: en_GB
  value of $LC_NUMERIC: en_GB
  value of $LC_TIME: en_GB
  value of $LANG: ja_JP
  locale-coding-system: japanese-iso-8bit
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

Fetching a url with url-retrieve can reult in an anrbitrary buffer
being killed if a 401 (or possibly a 407) result is encountered:

url-http-parse-headers calls url-http-handle-authentication, 
which can call url-retrieve. 

This results in the current buffer being killed, and a new http buffer 
being generated. However, when the old http buffer is killed, emacs 
picks the top buffer from the list as the new current buffer, so by the 
time we get to the end of url-http-parse-headers, _that_ buffer is marked 
as dead even though it is not necessarily a url buffer, so next time the 
url libraries reap their dead buffers, an innocent bystander buffer is 
killed instead (and an obsolete http buffer may be left lying around too).

A possible fix (which I am currently using) is to call set-buffer
on the return value of url-http-parse-headers:

      (case url-http-response-status
	(401
	 ;; The request requires user authentication.  The response
	 ;; MUST include a WWW-Authenticate header field containing a
	 ;; challenge applicable to the requested resource.  The
	 ;; client MAY repeat the request with a suitable
	 ;; Authorization header field.
	 (url-mark-buffer-as-dead (current-buffer))
	 (set-buffer (url-http-handle-authentication nil)))
etc ....

which makes sure that it is the right http buffer that is current when 
we come to mark the http buffers as dead.


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [vivek@zeus.com: url libraries can reult in destruction of wrong buffer after 401]
@ 2004-11-01  7:23 Richard Stallman
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Stallman @ 2004-11-01  7:23 UTC (permalink / raw)


[I sent this message a few week ago but did not get a response.
This needs to be looked at]


Could someone take a look at what to do here?  I am not sure
whether this is still relevant--his suggestion seems to assume that
url-http-handle-authentication returns a new buffer, but it does not
appear to do that now.

Would someone please DTRT and ack to me?


------- Start of forwarded message -------
To: bug-gnu-emacs@gnu.org
From: Vivek Dasmohapatra <vivek@zeus.com>
Date: Tue, 28 Sep 2004 16:13:13 +0100
X-Scanner: exiscan *1CCJfG-0000T2-00*YBhr5NphPPU* (Zeus Technology Ltd)
Subject: url libraries can reult in destruction of wrong buffer after 401
Sender: bug-gnu-emacs-bounces+rms=gnu.org@gnu.org
X-Spam-Status: No, hits=0.5 required=5.0
	tests=RCVD_IN_ORBS
	version=2.55
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.3.1 (i386-pc-linux-gnu, X toolkit)
 of 2004-08-26 on nessus, modified by Debian
configured using `configure '--build=i386-linux' '--host=i386-linux' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--with-x=yes' '--with-x-toolkit=athena' '--without-toolkit-scroll-bars' 'CFLAGS=-DDEBIAN -g -O2' 'build_alias=i386-linux' 'host_alias=i386-linux''
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: ja_JP
  value of $LC_CTYPE: ja_JP
  value of $LC_MESSAGES: en_GB
  value of $LC_MONETARY: en_GB
  value of $LC_NUMERIC: en_GB
  value of $LC_TIME: en_GB
  value of $LANG: ja_JP
  locale-coding-system: japanese-iso-8bit
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

Fetching a url with url-retrieve can reult in an anrbitrary buffer
being killed if a 401 (or possibly a 407) result is encountered:

url-http-parse-headers calls url-http-handle-authentication, 
which can call url-retrieve. 

This results in the current buffer being killed, and a new http buffer 
being generated. However, when the old http buffer is killed, emacs 
picks the top buffer from the list as the new current buffer, so by the 
time we get to the end of url-http-parse-headers, _that_ buffer is marked 
as dead even though it is not necessarily a url buffer, so next time the 
url libraries reap their dead buffers, an innocent bystander buffer is 
killed instead (and an obsolete http buffer may be left lying around too).

A possible fix (which I am currently using) is to call set-buffer
on the return value of url-http-parse-headers:

      (case url-http-response-status
	(401
	 ;; The request requires user authentication.  The response
	 ;; MUST include a WWW-Authenticate header field containing a
	 ;; challenge applicable to the requested resource.  The
	 ;; client MAY repeat the request with a suitable
	 ;; Authorization header field.
	 (url-mark-buffer-as-dead (current-buffer))
	 (set-buffer (url-http-handle-authentication nil)))
etc ....

which makes sure that it is the right http buffer that is current when 
we come to mark the http buffers as dead.


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-11-01  7:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-01  7:23 [vivek@zeus.com: url libraries can reult in destruction of wrong buffer after 401] Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2004-10-17  7:24 Richard Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).