Subject: Re: bug#17959: support accessing FTP services via HTTP proxies

From: Ivan Shmakov <[email-masked]>
Date: Tue, 16 Dec 2014 20:09:24 +0000

>>>>> Ivan Shmakov <[email-masked]> writes:

[…]

 > Given that the only thing that EWW has to do to support ftp_proxy is
 > to ensure the user configuration specifies an HTTP proxy to use for
 > the target ftp: URI, it just seems like to simple a feature to omit
 > it.

	The patch MIMEd seems to resolve the issue.

 > When no HTTP proxy is specified for the URI, EWW should indeed
 > somehow invoke the Emacs native FTP client instead.

 > I guess the same approach may be applied to the other URI schemes
 > just as well (gopher:, perhaps?)

	FTR, – I’ve tried to access [1] via Squid, and it just worked.

[1] gopher://gopher.docfile.org/1/world/monitoring/uptime

[…]

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A
--- a/lisp/net/eww.el	2014-12-09 03:21:57 +0000
+++ b/lisp/net/eww.el	2014-12-16 19:59:32 +0000
@@ -252,8 +238,15 @@
   (setq url (string-trim url))
   (cond ((string-match-p "\\`file:/" url))
 	;; Don't mangle file: URLs at all.
-        ((string-match-p "\\`ftp://" url)
-         (user-error "FTP is not supported."))
+	((let* ((parsed (url-generic-parse-url url))
+		(loader (url-scheme-get-property (url-type parsed) 'loader))
+		(proxy  (and (url-host parsed)
+			     (url-find-proxy-for-url
+			      parsed (url-host parsed)))))
+	   (and (eq 'url-ftp loader)
+		(or (not proxy)
+		    (not (string-match-p "^https?://" proxy)))))
+	 (user-error "Direct FTP is not supported."))
         (t
          (if (and (= (length (split-string url)) 1)
 		  (or (and (not (string-match-p "\\`[\"\'].*[\"\']\\'" url))