cpitclaudel/biblio.el

can only do one lookup; successive lookups fail with 406 error

Closed this issue · 10 comments

Hello,
I am using the biblio package and I really appreciate the functionality it gives me. However, for some reason, I am unable to do more than one lookup. Any subsequent lookup gives me this error:

Fetching http://api.crossref.org/works?query=fraga%20beck%20brandani
Contacting host: api.crossref.org:80
Error while processing request: (biblio--url-error http . 406)

This is with emacs version 25.0.92.1 (emacs-snapshot on Debian testing).

If I quit emacs and start again, I can do a lookup but then the second attempt fails.

Please let me know what I can do to try to debug this.

Thanks,
eric

Thanks for spotting this! I can't reproduce it immediately, but I'll investigate and report :)

Ok, I've looked a bit more into this. My guess is that biblio.el is passing a weird header to CrossRef, and CrossRef is refusing to answer that; hence the 406. Other parts of biblio.el expect 406s, but not from CrossRef.

A debugging trace would help a lot, if you have time :) Could you try setting url-debug to t in a fresh Emacs session? Something like M-: (setq url-debug t). Then run two searches, and post the contents of the *URL-DEBUG* buffer.

With that, I should be able to reproduce CrossRef's response. Thanks!

Thanks for looking into this!

As requested, attached is a file with the contents of the URL-DEBUG
buffer after doing two searches with CrossRef, the second of which
failed.

urldebug.txt

Thanks; that's very helpful. The issue is connected to something that I raised recently on emacs-devel, namely that the fact that the url library doesn't handle the Accept header properly.

Your example reveals that there is a bug in my workaround; thanks! I'll have a look tonight.

One more quick thing: which version of Emacs are you using?

In his first message, he said that he is using "25.0.92.1 (emacs-snapshot on Debian testing)".

Urgh, thanks! (and sorry!)

Still investigating this. I need to look at this trace more closely. It seems that a global variable is not being reset properly, but I'm not sure why yet.

Steps to reproduce this:

  1. Insert a BibTeX for doi: M-x doi-insert-bibtex "10.1145/2489828.2489830" RET
  2. Use crossref-lookup: M-x crossref-lookup "Matthew Might" RET

This happens becuase biblio-doi.el set url-mime-accept-string and doesn't cleanup back to nil so in the next request to crossref.org sends the header: Accept: text/bibliography;style=bibtex, application/x-bibtex and returns 406 Not Acceptable

Emacs version: 25.0.94.3 (git branch emacs-25)

@marsam Thanks for the repro! This variable is the one I was referring to in my previous message, but I had trouble reproducing the issue.