all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Race condition in url-http.el
@ 2006-04-22 16:20 Andreas Seltenreich
  2006-04-22 16:45 ` Andreas Seltenreich
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Seltenreich @ 2006-04-22 16:20 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

Hi,

url-http.el seems to attempt reusing connections despite the presence
of a "Connection: close" header if the server didn't close the
connection fast enough. This is easily triggered when url-http is
following redirects, in which case it just returns an empty buffer.

The attached patch seems to fix it. I'm not sure if it is the right
way to fix it, but the sentinel seems to do proper cleanup after the
delete-process on the network connection.

Thanks,
andreas

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: url-http.patch --]
[-- Type: text/x-patch, Size: 654 bytes --]

Index: url-http.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/url/url-http.el,v
retrieving revision 1.28
diff -c -r1.28 url-http.el
*** url-http.el	7 Mar 2006 17:21:16 -0000	1.28
--- url-http.el	22 Apr 2006 15:39:45 -0000
***************
*** 386,391 ****
--- 386,393 ----
    (url-http-parse-response)
    (mail-narrow-to-head)
    ;;(narrow-to-region (point-min) url-http-end-of-headers)
+   (if (string= (downcase (mail-fetch-field "Connection")) "close")
+       (delete-process url-http-process))
    (let ((class nil)
  	(success nil))
      (setq class (/ url-http-response-status 100))

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

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

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

* Re: Race condition in url-http.el
  2006-04-22 16:20 Race condition in url-http.el Andreas Seltenreich
@ 2006-04-22 16:45 ` Andreas Seltenreich
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Seltenreich @ 2006-04-22 16:45 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 329 bytes --]

Andreas Seltenreich schrob:

> The attached patch seems to fix it. I'm not sure if it is the right
> way to fix it, but the sentinel seems to do proper cleanup after the
> delete-process on the network connection.

Oops, this will break if there's no "Connection" header at
all. Attached is an updated version.

Thanks,
andreas


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: url-http.patch --]
[-- Type: text/x-patch, Size: 712 bytes --]

Index: url-http.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/url/url-http.el,v
retrieving revision 1.28
diff -c -r1.28 url-http.el
*** url-http.el	7 Mar 2006 17:21:16 -0000	1.28
--- url-http.el	22 Apr 2006 16:38:32 -0000
***************
*** 386,391 ****
--- 386,395 ----
    (url-http-parse-response)
    (mail-narrow-to-head)
    ;;(narrow-to-region (point-min) url-http-end-of-headers)
+   (let ((connection (mail-fetch-field "Connection")))
+     (if (and connection
+ 	     (string= (downcase connection) "close"))
+ 	(delete-process url-http-process)))
    (let ((class nil)
  	(success nil))
      (setq class (/ url-http-response-status 100))

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

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

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

end of thread, other threads:[~2006-04-22 16:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-22 16:20 Race condition in url-http.el Andreas Seltenreich
2006-04-22 16:45 ` Andreas Seltenreich

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.