[gnus git] branch master updated: m0-7-85-gf51a121 =1= Get the base URL right when being redirected

Lars Magne Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  f51a1216b43c84bd148fb6f08ff986581f0fca8c (commit)
      from  da1e2660b13733368e61aec91a1af315ad26df4a (commit)


- Log -----------------------------------------------------------------
commit f51a1216b43c84bd148fb6f08ff986581f0fca8c
Author: Lars Magne Ingebrigtsen <[email protected]>
Date:   Sun Jun 16 16:03:31 2013 +0200

    Get the base URL right when being redirected
    
    (eww-render): When being redirected, use the redirect URL as the new
    base URL.
    
    * shr.el (shr-expand-url): Respect // URLs.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index be54368..7a1d4b1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,7 +1,11 @@
 2013-06-16  Lars Magne Ingebrigtsen  <[email protected]>
 
+	* shr.el (shr-expand-url): Respect // URLs.
+
 	* eww.el (eww-tag-body): Override the shr body rendering so that we can
 	put a background colour onto the entire buffer.
+	(eww-render): When being redirected, use the redirect URL as the new
+	base URL.
 
 	* shr.el (shr-parse-base): Fix parsing error.
 
diff --git a/lisp/eww.el b/lisp/eww.el
index 7014003..ddc4edd 100644
--- a/lisp/eww.el
+++ b/lisp/eww.el
@@ -53,6 +53,9 @@
 	     (match-string 1)))))
 
 (defun eww-render (status url &optional point)
+  (let ((redirect (plist-get status :redirect)))
+    (when redirect
+      (setq url redirect)))
   (let* ((headers (eww-parse-headers))
 	 (content-type
 	  (mail-header-parse-content-type
diff --git a/lisp/shr.el b/lisp/shr.el
index a8996bc..7ed5778 100644
--- a/lisp/shr.el
+++ b/lisp/shr.el
@@ -495,8 +495,9 @@ size, and full-buffer size."
     (when (and (not (zerop (length local)))
 	       (not (eq (aref local (1- (length local))) ?/)))
       (setq local (concat local "/")))
-    (cons (url-recreate-url parsed)
-	  local)))
+    (list (url-recreate-url parsed)
+	  local
+	  (url-type parsed))))
 
 (defun shr-expand-url (url &optional base)
   (setq base
@@ -510,11 +511,15 @@ size, and full-buffer size."
 	 ;; Absolute URL.
 	 (or url (car base)))
 	((eq (aref url 0) ?/)
+	 (if (and (> (length url) 1)
+		  (eq (aref url 1) ?/))
+	     ;; //host...; just use the protocol
+	     (concat (nth 2 base) ":" url)
 	 ;; Just use the host name part.
-	 (concat (car base) url))
+	   (concat (car base) url)))
 	(t
 	 ;; Totally relative.
-	 (concat (car base) (cdr base) url))))
+	 (concat (car base) (cadr base) url))))
 
 (defun shr-ensure-newline ()
   (unless (zerop (current-column))

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog |    4 ++++
 lisp/eww.el    |    3 +++
 lisp/shr.el    |   15 ++++++++++-----
 3 files changed, 17 insertions(+), 5 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.