GNU bug report logs - #15911
24.3.50; [PATCH] eww: can not handle hostname "localhost"

Previous Next

Package: emacs;

Reported by: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>

Date: Sat, 16 Nov 2013 12:58:02 UTC

Severity: normal

Tags: patch

Found in version 24.3.50

Fixed in version 24.4

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15911 in the body.
You can then email your comments to 15911 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15911; Package emacs. (Sat, 16 Nov 2013 12:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 16 Nov 2013 12:58:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; [PATCH] eww: can not handle hostname "localhost"
Date: Sat, 16 Nov 2013 21:56:52 +0900
With M-x eww RET and "localhost" RET, eww searches "localhost" via ddg ("https://duckduckgo.com/html/?q=localhost"), so it does not handle "localhost" as "http://localhost/".

This patch is not only to solve it but also becoming possible to open the non-extension files by eww-open-file.
(Current eww-open-file can browse "exampleFile.html" but can't browse non-extension files like "exampleFile".)
I know I should send sepalately, but the former problem should modify with the latter one at the same time since it is using same logic.

Signed-off-by: Kenjiro Nakayama <nakayamakenjiro <at> gmail.com>
---
 lisp/net/eww.el | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 573715e..6accf60 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -107,17 +107,20 @@
 If the input doesn't look like an URL or a domain name, the
 word(s) will be searched for via `eww-search-prefix'."
   (interactive "sEnter URL or keywords: ")
-  (if (and (= (length (split-string url)) 1)
-           (> (length (split-string url "\\.")) 1))
-      (progn
-        (unless (string-match-p "\\`[a-zA-Z][-a-zA-Z0-9+.]*://" url)
-          (setq url (concat "http://" url)))
-        ;; some site don't redirect final /
-        (when (string= (url-filename (url-generic-parse-url url)) "")
-          (setq url (concat url "/"))))
-    (unless (string-match-p "\\'file:" url)
-      (setq url (concat eww-search-prefix
-                        (replace-regexp-in-string " " "+" url)))))
+  (cond ((string-match-p "\\`file:" url))
+       (t
+        (if (and (= (length (split-string url)) 1)
+                 (or (> (length (split-string url "\\.")) 1)
+                     (string-match "localhost" url)))
+            (progn
+              (unless (string-match-p "\\`[a-zA-Z][-a-zA-Z0-9+.]*://" url)
+                (setq url (concat "http://" url)))
+              ;; some site don't redirect final /
+              (when (string= (url-filename (url-generic-parse-url url)) "")
+                (setq url (concat url "/"))))
+          (setq url (concat eww-search-prefix
+                            (replace-regexp-in-string " " "+" url))))
+        ))
   (url-retrieve url 'eww-render (list url)))

 ;;;###autoload
-- 
1.8.3.1




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15911; Package emacs. (Thu, 21 Nov 2013 16:43:01 GMT) Full text and rfc822 format available.

Message #8 received at 15911 <at> debbugs.gnu.org (full text, mbox):

From: Ted Zlatanov <tzz <at> lifelogs.com>
To: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
Cc: 15911 <at> debbugs.gnu.org
Subject: Re: bug#15911: 24.3.50;
 [PATCH] eww: can not handle hostname "localhost"
Date: Thu, 21 Nov 2013 11:43:11 -0500
On Sat, 16 Nov 2013 21:56:52 +0900 Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com> wrote: 

KN> With M-x eww RET and "localhost" RET, eww searches "localhost" via
KN> ddg ("https://duckduckgo.com/html/?q=localhost"), so it does not
KN> handle "localhost" as "http://localhost/".  This patch is not only
KN> to solve it but also becoming possible to open the non-extension
KN> files by eww-open-file.  (Current eww-open-file can browse
KN> "exampleFile.html" but can't browse non-extension files like
KN> "exampleFile".)  I know I should send sepalately, but the former
KN> problem should modify with the latter one at the same time since it
KN> is using same logic.

KN> Signed-off-by: Kenjiro Nakayama <nakayamakenjiro <at> gmail.com>

Installed as "tiny change" with a small modification.

Thanks
Ted




bug marked as fixed in version 24.4, send any further explanations to 15911 <at> debbugs.gnu.org and Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 21 Nov 2013 17:21:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15911; Package emacs. (Thu, 21 Nov 2013 18:53:01 GMT) Full text and rfc822 format available.

Message #13 received at 15911-done <at> debbugs.gnu.org (full text, mbox):

From: Ted Zlatanov <tzz <at> lifelogs.com>
To: Kenjiro NAKAYAMA <nakayamakenjiro <at> gmail.com>
Cc: 15911-done <at> debbugs.gnu.org
Subject: Re: bug#15911: 24.3.50;
 [PATCH] eww: can not handle hostname "localhost"
Date: Thu, 21 Nov 2013 13:52:56 -0500
Marking as done.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 20 Dec 2013 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 242 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.