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

Re: Cannot find URL: in file://localhost/ URLs



Hi,

Thanks for your report.  I tried solution of your problem.  The
emacs-w3m CVS repository has already been changed.  If you are
using the released version of emacs-w3m (v1.3.6), please use the
attached patch in the end of this message.

>>>>> In [emacs-w3m : No.05889]
>>>>>	Charles Sutton <casutton@cs.umass.edu> wrote:

> Greetings all,

> I've noticed some strange behavior in emacs-w3m, and I wonder
> if you can help me with it.  Suppose that I have a file called
> /tmp/foo.html

> In emacs-w3m, I do M-x w3m-browse-url with the URL

>    file://localhost/tmp/foo.html

> I get an error

>    Cannot retrieve URL: file://localhost/tmp/foo.html

> But if I go to a Unix command line and do

>    w3m file://localhost/tmp/foo.html

> Then I can view the file properly.

[...]
--- emacs-w3m-1.3.6/w3m.el~	2003-07-18 04:59:39 +0000
+++ emacs-w3m-1.3.6/w3m.el	2003-10-08 00:00:57 +0000
@@ -1643,10 +1643,17 @@
   "Return the file name which is pointed by URL.
 When URL does not point any local files, it returns nil."
   ;; Remove scheme part and net_loc part.  NOTE: This function accepts
-  ;; only urls whose net_loc part is empty or NULL string.
+  ;; only urls whose net_loc part is empty, NULL string or the localhost
+  ;; name.
   (cond
-   ((string-match "\\`\\(file:\\(//\\)?\\|about://dtree\\)/" url)
+   ((string-match "\\`\\(\\(file:\\(//\\)?\\)\\|about://dtree\\)/" url)
     (setq url (substring url (match-end 1)))
+    ;; Strip the localhost name.
+    (when (and (match-beginning 2) ;; file:
+	       (string-match (concat "\\`//\\(localhost\\|127\\.0\\.0\\.1\\|"
+				     (regexp-quote (system-name)) "\\)/")
+			     url))
+      (setq url (substring url (match-end 1))))
     ;; Process abs_path part in Windows.
     (setq url
 	  (if (and w3m-treat-drive-letter