[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
url-retrieve-synchronously randomly fails on https URLs (patch included)
From: |
Riccardo Murri |
Subject: |
url-retrieve-synchronously randomly fails on https URLs (patch included) |
Date: |
Sat, 27 Oct 2007 12:47:16 +0200 (CEST) |
To trigger the error just try a few times::
(url-retrieve-synchronously "https://www.google.com/")
Error backtrace::
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
url-http-wait-for-headers-change-function(1 199 198)
url-http-generic-filter(#<process www.google.com>
"EF344D7E1950942DBA877D79DDD8100A21A2592D03A210A4109\n Key-Arg : None\n
Start Time: 1193480981\n Timeout : 300 (sec)\n Verify return code: 20
(unable to get local issuer certificate)\n---\n")
accept-process-output(#<process www.google.com>)
byte-code("=8c2=8c3 !)=87" [inhibit-quit proc nil
accept-process-output] 2)
url-retrieve-synchronously("https://www.google.com/")
(kill-buffer (url-retrieve-synchronously "https://www.google.com/"))
eval((kill-buffer (url-retrieve-synchronously "https://www.google.com/")))
eval-last-sexp-1(t)
eval-last-sexp(t)
eval-print-last-sexp()
call-interactively(eval-print-last-sexp)
Sample contents of the URL retrieve buffer after a failed request::
EF344D7E1950942DBA877D79DDD8100A21A2592D03A210A4109
Key-Arg : None
Start Time: 1193480981
Timeout : 300 (sec)
Verify return code: 20 (unable to get local issuer certificate)
---
HTTP/1.1 302 Found
Location: http://www.google.com
Date: Sat, 27 Oct 2007 10:29:41 GMT
Content-Type: text/html; charset=UTF-8
Server: GFE/1.3
Content-Length: 218
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.com">here</A>.
</BODY></HTML>
read:errno=0
I traced down the bug to `open-tls-stream', which returns immediately
after having seen the regexp `tls-success' in the buffer. However,
both `openssl s_client' and `gnutls' print more information after that
line, thus `open-tls-stream' may occasionally return the buffer to the
caller when point is still amidst openssl/gnutls output.
A solution is to have `open-tls-stream' wait a little more to accept
output; after applying the patch below I cannot trigger the error
anymore.
--- src/emacs22/lisp/net/tls.el 2007-08-05 21:06:12.000000000 +0200
+++ emacs/lisp/tls.el 2007-10-27 12:23:47.000000000 +0200
@@ -154,9 +154,14 @@
(sit-for 1)))
(message "Opening TLS connection with `%s'...%s" cmd
(if done "done" "failed"))
- (if done
- (setq done process)
- (delete-process process))))
+ (if (not done)
+ (delete-process process)
+ ;; both `openssl s_client' and `gnutls' print some more info
+ ;; after the line matched by regexp `tls-success'; wait here
+ ;; a bit more, so we can be sure that point is at the end of
+ ;; it all, before handing the buffer back to caller
+ (accept-process-output process 1)
+ (setq done process))))
(message "Opening TLS connection to `%s'...%s"
host (if done "done" "failed"))
(when use-temp-buffer
Riccardo
In GNU Emacs 22.1.1 (powerpc-unknown-linux-gnu, GTK+ Version 2.10.13)
of 2007-08-22 on voltaire, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure '--build=powerpc-linux-gnu'
'--host=powerpc-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib'
'--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info'
'--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs22:/etc/emacs:/usr/local/share/emacs/22.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.1/leim'
'--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
'build_alias=powerpc-linux-gnu' 'host_alias=powerpc-linux-gnu' 'CFLAGS=-DDEBIAN
-g -O2''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: it_IT.UTF-8
locale-coding-system: utf-8
default-enable-multibyte-characters: t
Major mode: Text
Minor modes in effect:
tooltip-mode: t
tool-bar-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
auto-compression-mode: t
line-number-mode: t
Recent input:
<down> <down> <right> <right> C-SPC C-e <escape> w
C-x 4 b <return> C-y C-j <left> <backspace> C-x C-e
C-x C-e C-x C-e C-x C-e C-x C-e C-x C-e C-x C-e C-x
0 <help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <menu-bar> <help-menu> <report-emacs-b
ug>
Recent messages:
t
Contacting host: www.google.com:443
Reading [text/html; charset=UTF-8]... 226 bytes of 218 bytes (104%)
Reading... done.
Reading [text/html]... 227 bytes of 218 bytes (104%)
www.google.it tried to set a cookie for domain .google.it - rejected.
t
Loading emacsbug...
Loading regexp-opt...done
Loading emacsbug...done
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- url-retrieve-synchronously randomly fails on https URLs (patch included),
Riccardo Murri <=