(eww-render): When being redirected, use the redirect URL as the new
base URL.
* shr.el (shr-expand-url): Respect // URLs.
2013-06-16 Lars Magne Ingebrigtsen <larsi@gnus.org>
2013-06-16 Lars Magne Ingebrigtsen <larsi@gnus.org>
+ * 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.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.
* shr.el (shr-parse-base): Fix parsing error.
(match-string 1)))))
(defun eww-render (status url &optional point)
(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
(let* ((headers (eww-parse-headers))
(content-type
(mail-header-parse-content-type
(when (and (not (zerop (length local)))
(not (eq (aref local (1- (length local))) ?/)))
(setq local (concat local "/")))
(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
(defun shr-expand-url (url &optional base)
(setq base
;; Absolute URL.
(or url (car base)))
((eq (aref url 0) ?/)
;; Absolute URL.
(or url (car base)))
((eq (aref url 0) ?/)
- ;; Just use the host name part.
- (concat (car base) url))
+ (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) (cdr base) url))))
+ (concat (car base) (cadr base) url))))
(defun shr-ensure-newline ()
(unless (zerop (current-column))
(defun shr-ensure-newline ()
(unless (zerop (current-column))