Subject: bug#14372: 24.3; url package http end of headers false positive

From: Ben Anhalt <[email-masked]>
Date: Wed, 08 May 2013 16:15:05 -0500

In url-http.el in url-http-wait-for-headers-change-function the regular
expression for detecting the end of HTTP headers is "^\r*$" which can
result in false positives if a partial response (with more headers to
come) is received that ends in a newline. That is, "HTTP/1.1 200
OK\r\nSome-header: foo\r\n" matches at the end as an empty line even
though there is no way to tell if more headers will arrive.

It needs to detect a line that contains nothing but "\r", so a RE like
"^\r+$" or simply "^\r$" would be more appropriate.

In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2)
 of 2013-04-14 on chindi10, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11103000
System Description:	Ubuntu 12.04.2 LTS

Configured using:
 `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-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/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk3' '--with-toolkit-scroll-bars'
 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Wformat-security
 -Werror=format-security -Wall' 'LDFLAGS=-Wl,-Bsymbolic-functions
 -Wl,-z,relro' 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  elisp-slime-nav-mode: t
  eldoc-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  global-rainbow-delimiters-mode: t
  rainbow-delimiters-mode: t
  which-function-mode: t
  show-paren-mode: t
  winner-mode: t
  global-auto-revert-mode: t
  my-keys-minor-mode: t
  ido-everywhere: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<return> y M-x r e v e r <tab> t <tab> <return> y C-x 
k <return> C-x C-f . a u <return> C-x k <return> C-x 
k <return> C-x o C-x 0 M-x r e p <tab> o r <tab> <
return>

Recent messages:
465
Sending...
Save auth info to file ~/.authinfo? [y/n/N/e/?] y
Saved new authentication information to ~/.authinfo
Sending email 
Sending email done
Sending...done
Making completion list...
Revert buffer from file /home/ben/.emacs.d/custom.el? (y or n)  y
Making completion list...

Load-path shadows:
/home/ben/.emacs.d/elpa/markdown-mode-20130328.918/markdown-mode hides /usr/share/emacs24/site-lisp/emacs-goodies-el/markdown-mode
/usr/share/emacs/24.3/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/home/ben/.emacs.d/custom hides /usr/share/emacs/24.3/lisp/custom
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.3/lisp/textmodes/flyspell
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.3/lisp/textmodes/ispell
/home/ben/.emacs.d/elpa/magit-20130502.1609/.dir-locals hides /usr/share/emacs/24.3/lisp/gnus/.dir-locals

Features:
(rfc2104 rmail mail-hist mailalias epa-mail epa derived epg epg-config
apropos dired tramp-cache tramp tramp-compat tramp-loaddefs gnutls
smtpmail cus-edit cus-start cus-load wid-edit shadow sort mail-extr
emacsbug message rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mailabbrev gmm-utils mailheader sendmail python-mode info-look info
compile visual-regexp pcase hippie-exp edebug pp thingatpt misearch
multi-isearch jka-compr mail-utils timezone parse-time pcmpl-unix shell
debug ace-jump-mode network-stream starttls url-cache url-http tls
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums url-gw url-auth specify
json url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util url-parse auth-source eieio gnus-util
mm-util mail-prsvr password-cache url-vars mailcap add-log vc-git
elisp-slime-nav help-mode etags eldoc zenburn-theme server undo-tree
diff rainbow-delimiters which-func imenu paren winner autorevert
ob-python org byte-opt warnings bytecomp byte-compile cconv ob-tangle
ob-ref ob-lob ob-table org-footnote org-src ob-comint ob-keys
org-pcomplete pcomplete comint ansi-color ring org-list org-faces
org-entities noutline outline org-version ob-emacs-lisp ob org-compat
org-macs ob-eval org-loaddefs format-spec find-func cal-menu easymenu
calendar cal-loaddefs uniquify advice help-fns advice-preload
key-bindings edmacro kmacro setup-package ace-jump-mode-autoloads
coffee-mode-autoloads elisp-slime-nav-autoloads expand-region-autoloads
fill-column-indicator-autoloads flymake-cursor-autoloads
js2-mode-autoloads jump-char-autoloads lua-mode-autoloads
magit-autoloads mark-multiple-autoloads markdown-mode-autoloads
php-mode-autoloads rainbow-delimiters-autoloads restclient-autoloads
slime-autoloads undo-tree-autoloads visual-regexp-autoloads finder-inf
zenburn-theme-autoloads package setup-hippie ido cl-macs gv cl cl-lib
emacs-goodies-el emacs-goodies-custom emacs-goodies-loaddefs easy-mmode
time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face macroexp files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)