]> code.delx.au - gnu-emacs/blobdiff - lisp/url/url-gw.el
Use declare forms, where possible, to mark obsolete functions.
[gnu-emacs] / lisp / url / url-gw.el
index 40dd738a68a6eeaf59b26ea860af2352cc254745..c475fb05c9c957aaca5cef286846f774eb7a5169 100644 (file)
@@ -1,7 +1,6 @@
 ;;; url-gw.el --- Gateway munging for URL loading
 
-;; Copyright (C) 1997, 1998, 2004, 2005, 2006, 2007, 2008
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2004-2012  Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <wmperry@gnu.org>
 ;; Keywords: comm, data, processes
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'url-vars)
 
 ;; Fixme: support SSH explicitly or via a url-gateway-rlogin-program?
 
 (autoload 'socks-open-network-stream "socks")
-(autoload 'open-ssl-stream "ssl")
-(autoload 'open-tls-stream "tls")
 
 (defgroup url-gateway nil
   "URL gateway variables."
   :group 'url)
 
 (defcustom url-gateway-local-host-regexp nil
-  "*A regular expression specifying local hostnames/machines."
+  "A regular expression specifying local hostnames/machines."
   :type '(choice (const nil) regexp)
   :group 'url-gateway)
 
 (defcustom url-gateway-prompt-pattern
   "^[^#$%>;]*[#$%>;] *" ;; "bash\\|\$ *\r?$\\|> *\r?"
-  "*A regular expression matching a shell prompt."
+  "A regular expression matching a shell prompt."
   :type 'regexp
   :group 'url-gateway)
 
 (defcustom url-gateway-rlogin-host nil
-  "*What hostname to actually rlog into before doing a telnet."
+  "What hostname to actually rlog into before doing a telnet."
   :type '(choice (const nil) string)
   :group 'url-gateway)
 
 (defcustom url-gateway-rlogin-user-name nil
-  "*Username to log into the remote machine with when using rlogin."
+  "Username to log into the remote machine with when using rlogin."
   :type '(choice (const nil) string)
   :group 'url-gateway)
 
 (defcustom url-gateway-rlogin-parameters '("telnet" "-8")
-  "*Parameters to `url-open-rlogin'.
+  "Parameters to `url-open-rlogin'.
 This list will be used as the parameter list given to rsh."
   :type '(repeat string)
   :group 'url-gateway)
 
 (defcustom url-gateway-telnet-host nil
-  "*What hostname to actually login to before doing a telnet."
+  "What hostname to actually login to before doing a telnet."
   :type '(choice (const nil) string)
   :group 'url-gateway)
 
 (defcustom url-gateway-telnet-parameters '("exec" "telnet" "-8")
-  "*Parameters to `url-open-telnet'.
+  "Parameters to `url-open-telnet'.
 This list will be executed as a command after logging in via telnet."
   :type '(repeat string)
   :group 'url-gateway)
 
 (defcustom url-gateway-telnet-login-prompt "^\r*.?login:"
-  "*Prompt that tells us we should send our username when loggin in w/telnet."
+  "Prompt that tells us we should send our username when logging in w/telnet."
   :type 'regexp
   :group 'url-gateway)
 
 (defcustom url-gateway-telnet-password-prompt "^\r*.?password:"
-  "*Prompt that tells us we should send our password when loggin in w/telnet."
+  "Prompt that tells us we should send our password when logging in w/telnet."
   :type 'regexp
   :group 'url-gateway)
 
@@ -95,7 +91,7 @@ This list will be executed as a command after logging in via telnet."
   :group 'url-gateway)
 
 (defcustom url-gateway-broken-resolution nil
-  "*Whether to use nslookup to resolve hostnames.
+  "Whether to use nslookup to resolve hostnames.
 This should be used when your version of Emacs cannot correctly use DNS,
 but your machine can.  This usually happens if you are running a statically
 linked Emacs under SunOS 4.x."
@@ -103,7 +99,7 @@ linked Emacs under SunOS 4.x."
   :group 'url-gateway)
 
 (defcustom url-gateway-nslookup-program "nslookup"
-  "*If non-nil then a string naming nslookup program."
+  "If non-nil then a string naming nslookup program."
   :type '(choice (const :tag "None" :value nil) string)
   :group 'url-gateway)
 
@@ -220,13 +216,6 @@ Might do a non-blocking connection; use `process-status' to check."
                               host))
                         'native
                       url-gateway-method))
-;;;    ;; This hack is for OS/2 Emacs so that it will not do bogus CRLF
-;;;    ;; conversions while trying to be 'helpful'
-;;;    (tcp-binary-process-output-services (if (stringp service)
-;;;                                            (list service)
-;;;                                          (list service
-;;;                                                (int-to-string service))))
-
          ;; An attempt to deal with denied connections, and attempt
          ;; to reconnect
          (cur-retries 0)
@@ -243,35 +232,27 @@ Might do a non-blocking connection; use `process-status' to check."
          ;; right coding systems in both Emacs and XEmacs.
          (let ((coding-system-for-read 'binary)
                (coding-system-for-write 'binary))
-           (setq conn (case gw-method
-                        (tls
-                         (open-tls-stream name buffer host service))
-                        (ssl
-                         (open-ssl-stream name buffer host service))
-                        ((native)
-                         ;; Use non-blocking socket if we can.
-                         (make-network-process :name name :buffer buffer
-                                               :host host :service service
-                                               :nowait
-                                               (featurep 'make-network-process '(:nowait t))))
-                        (socks
+           (setq conn (pcase gw-method
+                        ((or `tls `ssl `native)
+                         (if (eq gw-method 'native)
+                             (setq gw-method 'plain))
+                         (open-network-stream
+                          name buffer host service
+                          :type gw-method
+                          ;; Use non-blocking socket if we can.
+                          :nowait (featurep 'make-network-process
+                                            '(:nowait t))))
+                        (`socks
                          (socks-open-network-stream name buffer host service))
-                        (telnet
+                        (`telnet
                          (url-open-telnet name buffer host service))
-                        (rlogin
+                        (`rlogin
                          (url-open-rlogin name buffer host service))
-                        (otherwise
+                        (_
                          (error "Bad setting of url-gateway-method: %s"
-                                url-gateway-method)))))
-        ;; Ignoring errors here seems wrong.  E.g. it'll throw away the
-        ;; error signaled two lines above.  It was also found inconvenient
-        ;; during debugging.
-       ;; (error
-       ;;  (setq conn nil))
-       )
+                                url-gateway-method))))))
       conn)))
 
 (provide 'url-gw)
 
-;; arch-tag: 1c4c0317-6d03-45b8-b3f3-838bd8f9d838
 ;;; url-gw.el ends here