GNU bug report logs - #35927
26.2; url-http-end-of-headers sets to 1 when cache is working

Previous Next

Package: emacs;

Reported by: Xu Chunyang <mail <at> xuchunyang.me>

Date: Mon, 27 May 2019 14:48:02 UTC

Severity: normal

Tags: notabug

Found in version 26.2

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35927 in the body.
You can then email your comments to 35927 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#35927; Package emacs. (Mon, 27 May 2019 14:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Xu Chunyang <mail <at> xuchunyang.me>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 27 May 2019 14:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Xu Chunyang <mail <at> xuchunyang.me>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.2; url-http-end-of-headers sets to 1 when cache is working
Date: Mon, 27 May 2019 22:47:15 +0800
Today I enable URL cache via

    (setq url-automatic-caching t
          url-cache-expire-time (* 6 3600))

and I notice url-http-end-of-headers isn't the end of the headers when
cache is working. This breaks some of my code, I assume it is the end of
the header so I use (goto-char url-http-end-of-headers) before parsing
the response body. Is this expected or a bug?

    (with-current-buffer (url-retrieve-synchronously "http://example.com")
      (message "=> %S" url-http-end-of-headers))
    "=> #<marker at 347 in  *http example.com:80*>"
    
    (with-current-buffer (url-retrieve-synchronously "http://example.com")
      (message "=> %S" url-http-end-of-headers))
    "=> #<marker at 1 in  *http example.com:80*-325608>"
    
    (with-current-buffer (url-retrieve-synchronously "http://example.com")
      (message "=> %S" url-http-end-of-headers))
    "=> #<marker at 1 in  *http example.com:80*-887290>"




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35927; Package emacs. (Mon, 27 May 2019 15:23:02 GMT) Full text and rfc822 format available.

Message #8 received at 35927 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Xu Chunyang <mail <at> xuchunyang.me>
Cc: 35927 <at> debbugs.gnu.org
Subject: Re: bug#35927: 26.2;
 url-http-end-of-headers sets to 1 when cache is working
Date: Mon, 27 May 2019 16:21:48 +0100
Xu Chunyang <mail <at> xuchunyang.me> writes:

> Today I enable URL cache via
>
>     (setq url-automatic-caching t
>           url-cache-expire-time (* 6 3600))
>
> and I notice url-http-end-of-headers isn't the end of the headers when
> cache is working. This breaks some of my code, I assume it is the end of
> the header so I use (goto-char url-http-end-of-headers) before parsing
> the response body. Is this expected or a bug?
>
>     (with-current-buffer (url-retrieve-synchronously "http://example.com")
>       (message "=> %S" url-http-end-of-headers))
>     "=> #<marker at 347 in  *http example.com:80*>"
>     
>     (with-current-buffer (url-retrieve-synchronously "http://example.com")
>       (message "=> %S" url-http-end-of-headers))
>     "=> #<marker at 1 in  *http example.com:80*-325608>"
>     
>     (with-current-buffer (url-retrieve-synchronously "http://example.com")
>       (message "=> %S" url-http-end-of-headers))
>     "=> #<marker at 1 in  *http example.com:80*-887290>"

I can't seem to reproduce this on emacs-26 or master:

0. HOME=$(mktemp -d) emacs -Q
1. (let ((get (lambda ()
                (with-current-buffer
                    (url-retrieve-synchronously "https://gnu.org")
                  (message "%s" url-http-end-of-headers)))))
     (dotimes (_ 3) (funcall get))
     (setq url-automatic-caching t
           url-cache-expire-time (* 6 3600))
     (dotimes (_ 3) (funcall get)))
2. C-x C-e

Contacting host: gnu.org:443
#<marker at 470 in  *http www.gnu.org:443*>
Contacting host: gnu.org:443
#<marker at 469 in  *http www.gnu.org:443*-93923>
#<marker at 469 in  *http www.gnu.org:443*-669963>
Contacting host: gnu.org:443
#<marker at 469 in  *http www.gnu.org:443*-843863>
#<marker at 469 in  *http www.gnu.org:443*-298952>
#<marker at 469 in  *http www.gnu.org:443*-323128>

What am I doing wrong?

-- 
Basil

In GNU Emacs 26.2.50 (build 8, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2019-05-27 built on thunk
Repository revision: c4d4dcf17e407a3c68e150f22b9756ef6c943070
Windowing system distributor 'The X.Org Foundation', version 11.0.12003000
System Description:	Debian GNU/Linux 10 (buster)

Configured using:
 'configure 'CC=ccache gcc' 'CFLAGS=-O0 -g3 -ggdb -gdwarf-4'
 --config-cache --prefix=/home/blc/.local --program-suffix=26
 --enable-checking=yes,glyphs --enable-check-lisp-object-type
 --with-mailutils --with-x-toolkit=lucid --with-modules
 --with-file-notification=yes --with-x'

Configured features:
XAW3D XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS
GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT
ZLIB TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM MODULES THREADS LIBSYSTEMD
LCMS2

Important settings:
  value of $LANG: en_IE.UTF-8
  locale-coding-system: utf-8-unix


In GNU Emacs 27.0.50 (build 6, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2019-05-25 built on thunk
Repository revision: ec4b2c888ad12c255accf1bccdac12f173c96047
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12003000
System Description: Debian GNU/Linux 10 (buster)

Configured using:
 'configure 'CC=ccache gcc' 'CFLAGS=-O2 -march=native' --config-cache
 --prefix=/home/blc/.local --with-mailutils --with-x-toolkit=lucid
 --with-modules --with-file-notification=yes --with-x'

Configured features:
XAW3D XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
PDUMPER LCMS2 GMP




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35927; Package emacs. (Mon, 27 May 2019 15:44:01 GMT) Full text and rfc822 format available.

Message #11 received at 35927 <at> debbugs.gnu.org (full text, mbox):

From: xuchunyang <mail <at> xuchunyang.me>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 35927 <at> debbugs.gnu.org
Subject: Re: bug#35927: 26.2;
  url-http-end-of-headers sets to 1 when cache is working
Date: Mon, 27 May 2019 23:43:46 +0800

On Mon, May 27, 2019, at 11:21 PM, Basil L. Contovounesios wrote:
> Xu Chunyang <mail <at> xuchunyang.me> writes:
> 
> > Today I enable URL cache via
> >
> >     (setq url-automatic-caching t
> >           url-cache-expire-time (* 6 3600))
> >
> > and I notice url-http-end-of-headers isn't the end of the headers when
> > cache is working. This breaks some of my code, I assume it is the end of
> > the header so I use (goto-char url-http-end-of-headers) before parsing
> > the response body. Is this expected or a bug?
> >
> >     (with-current-buffer (url-retrieve-synchronously "http://example.com")
> >       (message "=> %S" url-http-end-of-headers))
> >     "=> #<marker at 347 in  *http example.com:80*>"
> >     
> >     (with-current-buffer (url-retrieve-synchronously "http://example.com")
> >       (message "=> %S" url-http-end-of-headers))
> >     "=> #<marker at 1 in  *http example.com:80*-325608>"
> >     
> >     (with-current-buffer (url-retrieve-synchronously "http://example.com")
> >       (message "=> %S" url-http-end-of-headers))
> >     "=> #<marker at 1 in  *http example.com:80*-887290>"
> 
> I can't seem to reproduce this on emacs-26 or master:
> 
> 0. HOME=$(mktemp -d) emacs -Q
> 1. (let ((get (lambda ()
>                 (with-current-buffer
>                     (url-retrieve-synchronously "https://gnu.org")
>                   (message "%s" url-http-end-of-headers)))))
>      (dotimes (_ 3) (funcall get))
>      (setq url-automatic-caching t
>            url-cache-expire-time (* 6 3600))
>      (dotimes (_ 3) (funcall get)))
> 2. C-x C-e
> 
> Contacting host: gnu.org:443
> #<marker at 470 in  *http www.gnu.org:443*>
> Contacting host: gnu.org:443
> #<marker at 469 in  *http www.gnu.org:443*-93923>
> #<marker at 469 in  *http www.gnu.org:443*-669963>
> Contacting host: gnu.org:443
> #<marker at 469 in  *http www.gnu.org:443*-843863>
> #<marker at 469 in  *http www.gnu.org:443*-298952>
> #<marker at 469 in  *http www.gnu.org:443*-323128>
> 
> What am I doing wrong?

Can you give http://example.com a try? It seems it's  fine with https://gnu.org.

> -- 
> Basil
> 
> In GNU Emacs 26.2.50 (build 8, x86_64-pc-linux-gnu, X toolkit, Xaw3d 
> scroll bars)
>  of 2019-05-27 built on thunk
> Repository revision: c4d4dcf17e407a3c68e150f22b9756ef6c943070
> Windowing system distributor 'The X.Org Foundation', version 
> 11.0.12003000
> System Description:	Debian GNU/Linux 10 (buster)
> 
> Configured using:
>  'configure 'CC=ccache gcc' 'CFLAGS=-O0 -g3 -ggdb -gdwarf-4'
>  --config-cache --prefix=/home/blc/.local --program-suffix=26
>  --enable-checking=yes,glyphs --enable-check-lisp-object-type
>  --with-mailutils --with-x-toolkit=lucid --with-modules
>  --with-file-notification=yes --with-x'
> 
> Configured features:
> XAW3D XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS
> GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT
> ZLIB TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM MODULES THREADS LIBSYSTEMD
> LCMS2
> 
> Important settings:
>   value of $LANG: en_IE.UTF-8
>   locale-coding-system: utf-8-unix
> 
> 
> In GNU Emacs 27.0.50 (build 6, x86_64-pc-linux-gnu, X toolkit, Xaw3d 
> scroll bars)
>  of 2019-05-25 built on thunk
> Repository revision: ec4b2c888ad12c255accf1bccdac12f173c96047
> Repository branch: master
> Windowing system distributor 'The X.Org Foundation', version 
> 11.0.12003000
> System Description: Debian GNU/Linux 10 (buster)
> 
> Configured using:
>  'configure 'CC=ccache gcc' 'CFLAGS=-O2 -march=native' --config-cache
>  --prefix=/home/blc/.local --with-mailutils --with-x-toolkit=lucid
>  --with-modules --with-file-notification=yes --with-x'
> 
> Configured features:
> XAW3D XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY
> INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
> TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
> PDUMPER LCMS2 GMP
>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35927; Package emacs. (Tue, 24 Sep 2019 08:47:01 GMT) Full text and rfc822 format available.

Message #14 received at 35927 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Xu Chunyang <mail <at> xuchunyang.me>
Cc: 35927 <at> debbugs.gnu.org
Subject: Re: bug#35927: 26.2; url-http-end-of-headers sets to 1 when cache
 is working
Date: Tue, 24 Sep 2019 10:46:53 +0200
Xu Chunyang <mail <at> xuchunyang.me> writes:

> and I notice url-http-end-of-headers isn't the end of the headers when
> cache is working. This breaks some of my code, I assume it is the end of
> the header so I use (goto-char url-http-end-of-headers) before parsing
> the response body. Is this expected or a bug?
>
>     (with-current-buffer (url-retrieve-synchronously "http://example.com")
>       (message "=> %S" url-http-end-of-headers))
>     "=> #<marker at 347 in  *http example.com:80*>"

It's expected, I think.  url-http-end-of-headers is an internal variable
that url-http.el uses to keep track of things, and is not meant to be
used by the callers.

To find the end of the headers, you have to search for a blank line.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) notabug. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 24 Sep 2019 08:48:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 35927 <at> debbugs.gnu.org and Xu Chunyang <mail <at> xuchunyang.me> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 24 Sep 2019 08:48:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 22 Oct 2019 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 181 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.