unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Federico Tedin <federicotedin@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 33002@debbugs.gnu.org, John Smith <winston@ml1.net>
Subject: bug#33002: 26.1; EWW sends unspecific "Accept: */*" header
Date: Sun, 4 Nov 2018 15:29:49 -0300	[thread overview]
Message-ID: <CAA8GjPn4d1fxZM-gVVPawe2woQwVGN7mGKUJriiOrJS4=sa7LQ@mail.gmail.com> (raw)
In-Reply-To: <838t28eosw.fsf@gnu.org>

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

> Does it really make sense to make this a customizable option?  How
> would an average user choose a value for this option?
>
> I think EWW should decide by itself what header to send.

I agree, it is not something most people will want to change. If they
really want to change it though, they can just do (setq
eww-accept-content-types ...). I've changed the patch to use defvar
instead of defcustom.

[-- Attachment #2: eww.patch --]
[-- Type: text/x-patch, Size: 1858 bytes --]

From e6730701f320cf65ab02c8d550a442d3e4ea3c25 Mon Sep 17 00:00:00 2001
From: Federico Tedin <federicotedin@gmail.com>
Date: Sun, 4 Nov 2018 15:24:36 -0300
Subject: [PATCH 1/1] Adds variable 'eww-accept-content-types'

* lisp/net/eww.el (eww-accept-content-types): New variable.
  (eww): Use it (Bug#33002).
  (eww-reload): Use it.
---
 lisp/net/eww.el | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 64cc1a51f6..0c3fe8f7b3 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -223,6 +223,10 @@ eww-prompt-history
 (defvar eww-local-regex "localhost"
   "When this regex is found in the URL, it's not a keyword but an address.")
 
+(defvar eww-accept-content-types
+  "text/html, text/plain, text/sgml, text/css, application/xhtml+xml, */*;q=0.01"
+  "Value used for the HTTP 'Accept' header.")
+
 (defvar eww-link-keymap
   (let ((map (copy-keymap shr-map)))
     (define-key map "\r" 'eww-follow-link)
@@ -282,8 +286,9 @@ eww
   (let ((inhibit-read-only t))
     (insert (format "Loading %s..." url))
     (goto-char (point-min)))
-  (url-retrieve url 'eww-render
-                (list url nil (current-buffer))))
+  (let ((url-mime-accept-string eww-accept-content-types))
+    (url-retrieve url 'eww-render
+                  (list url nil (current-buffer)))))
 
 (defun eww--dwim-expand-url (url)
   (setq url (string-trim url))
@@ -944,8 +949,9 @@ eww-reload
 	    (error "No current HTML data")
 	  (eww-display-html 'utf-8 url (plist-get eww-data :dom)
 			    (point) (current-buffer)))
-      (url-retrieve url 'eww-render
-		    (list url (point) (current-buffer) encode)))))
+      (let ((url-mime-accept-string eww-accept-content-types))
+        (url-retrieve url 'eww-render
+		      (list url (point) (current-buffer) encode))))))
 
 ;; Form support.
 
-- 
2.17.1


  reply	other threads:[~2018-11-04 18:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10  5:11 bug#33002: 26.1; EWW sends unspecific "Accept: */*" header Winston Weinert
2018-10-13 21:59 ` Federico Tedin
2018-11-04  3:15   ` Federico Tedin
2018-11-04 17:27     ` Eli Zaretskii
2018-11-04 18:29       ` Federico Tedin [this message]
2018-11-13 21:26         ` Federico Tedin
2018-11-14  3:31           ` Eli Zaretskii
2019-05-13 18:08             ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA8GjPn4d1fxZM-gVVPawe2woQwVGN7mGKUJriiOrJS4=sa7LQ@mail.gmail.com' \
    --to=federicotedin@gmail.com \
    --cc=33002@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=winston@ml1.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).