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

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



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

> 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....

JDE 方面からも同じ話が出ていましたが、w3m-url-to-file-name() で
単に "localhost" などを削るだけで良いでしょうか?

--- w3m.el~	2003-10-06 11:12:46 +0000
+++ w3m.el	2003-10-07 02:13:52 +0000
@@ -1917,10 +1917,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

ちなみに w3m は file://localhost/ だけを有効にしているように見え
ます。
-- 
Katsumi Yamaoka <yamaoka@jpl.org>