emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/with-url b4ee883 4/7: Get the HTML redirect right


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] scratch/with-url b4ee883 4/7: Get the HTML redirect right (for duck duck go).
Date: Sat, 21 Jan 2017 23:08:22 +0000 (UTC)

branch: scratch/with-url
commit b4ee883cd7c609d2e4afd17e240b0c264399a1b3
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Get the HTML redirect right (for duck duck go).
---
 lisp/net/eww.el |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 46f16a8..85d7a8d 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -283,7 +283,7 @@ word(s) will be searched for via `eww-search-prefix'."
   (eww-setup-buffer)
   (eww--fetch-url url))
 
-(cl-defun eww--fetch-url (url &key method data)
+(cl-defun eww--fetch-url (url &key (method "GET") data)
   ;; Check whether the domain only uses "Highly Restricted" Unicode
   ;; IDNA characters.  If not, transform to punycode to indicate that
   ;; there may be funny business going on.
@@ -357,11 +357,12 @@ Currently this means either text/html or 
application/xhtml+xml."
     (cond
      ((url-errorp)
       (with-current-buffer buffer
-        (erase-buffer)
-        (insert (format "Error when fetching %s:\n%s %s\n"
-                        url (car (url-status 'response))
-                        (cadr (url-status 'response))))
-        (goto-char (point-min))))
+        (let ((inhibit-read-only t))
+          (erase-buffer)
+          (insert (format "Error when fetching '%s':\n%s %s\n"
+                          url (car (url-status 'response))
+                          (cadr (url-status 'response))))
+          (goto-char (point-min)))))
      ((and eww-use-external-browser-for-content-type
            (string-match-p eww-use-external-browser-for-content-type
                            (car content-type)))
@@ -490,7 +491,7 @@ Currently this means either text/html or 
application/xhtml+xml."
   (when (and (cl-equalp (dom-attr dom 'http-equiv) "refresh")
              (< eww-redirect-level 5))
     (when-let (refresh (dom-attr dom 'content))
-      (when (or (string-match "^\\([0-9]+\\) *;.*url=\"\\([^\"]+\\)\"" refresh)
+      (when (or (string-match "^\\([0-9]+\\) *;.*url=[\"']\\([^\"']+\\)[\"']" 
refresh)
                 (string-match "^\\([0-9]+\\) *;.*url=\\([^ ]+\\)" refresh))
         (let ((timeout (match-string 1 refresh))
               (url (match-string 2 refresh))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]