Convert consecutive FSF copyright years to ranges.
[bpt/emacs.git] / lisp / net / socks.el
index fd8e7ec..d792077 100644 (file)
@@ -1,7 +1,6 @@
 ;;; socks.el --- A Socks v5 Client for Emacs
 
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002,
-;;   2007 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2000, 2002, 2007-2011 Free Software Foundation, Inc.
 
 ;; Author: William M. Perry <wmperry@gnu.org>
 ;;         Dave Love <fx@gnu.org>
@@ -9,10 +8,10 @@
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,9 +19,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -100,6 +97,7 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (defgroup socks nil
   "SOCKS Support"
+  :version "22.2"
   :prefix "socks-"
   :group 'processes)
 
@@ -335,6 +333,19 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
     )
   )
 
+(declare-function socks-original-open-network-stream "socks") ; fset
+
+(defvar socks-override-functions nil
+  "*Whether to overwrite the open-network-stream function with the SOCKSified
+version.")
+
+(if (fboundp 'socks-original-open-network-stream)
+    nil                                ; Do nothing, we've been here already
+  (defalias 'socks-original-open-network-stream
+    (symbol-function 'open-network-stream))
+  (if socks-override-functions
+      (defalias 'open-network-stream 'socks-open-network-stream)))
+
 (defun socks-open-connection (server-info)
   (interactive)
   (save-excursion
@@ -375,7 +386,7 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
         ((= authtype socks-authentication-null)
          (and socks-debug (message "No authentication necessary")))
         ((= authtype socks-authentication-failure)
-         (error "No acceptable authentication methods found."))
+         (error "No acceptable authentication methods found"))
         (t
          (let* ((auth-type (gethash 'authtype info))
                 (auth-handler (assoc auth-type socks-authentication-methods))
@@ -423,27 +434,29 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
                              (error "Unsupported address type for HTTP: %d" atype)))
                            port)))
      ((equal version 4)
-      (setq request (format
-                    "%c%c%c%c%s%s%c"
-                    version            ; version
-                    command            ; command
-                    (lsh port -8)      ; port, high byte
-                    (- port (lsh (lsh port -8) 8)) ; port, low byte
-                    addr               ; address
-                    (user-full-name)   ; username
-                    0                  ; terminate username
-                    )))
+      (setq request (string-make-unibyte
+                    (format
+                     "%c%c%c%c%s%s%c"
+                     version           ; version
+                     command           ; command
+                     (lsh port -8)     ; port, high byte
+                     (- port (lsh (lsh port -8) 8)) ; port, low byte
+                     addr              ; address
+                     (user-full-name)  ; username
+                     0                 ; terminate username
+                     ))))
      ((equal version 5)
-      (setq request (format
-                    "%c%c%c%c%s%c%c"
-                    version            ; version
-                    command            ; command
-                    0                  ; reserved
-                    atype              ; address type
-                    addr               ; address
-                    (lsh port -8)      ; port, high byte
-                    (- port (lsh (lsh port -8) 8)) ; port, low byte
-                    )))
+      (setq request (string-make-unibyte
+                    (format
+                     "%c%c%c%c%s%c%c"
+                     version           ; version
+                     command           ; command
+                     0                 ; reserved
+                     atype             ; address type
+                     addr              ; address
+                     (lsh port -8)     ; port, high byte
+                     (- port (lsh (lsh port -8) 8)) ; port, low byte
+                     ))))
      (t
       (error "Unknown protocol version: %d" version)))
     (process-send-string proc request)
@@ -473,17 +486,6 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
       (setq noproxy (cdr noproxy)))
     route))
 
-(defvar socks-override-functions nil
-  "*Whether to overwrite the open-network-stream function with the SOCKSified
-version.")
-
-(if (fboundp 'socks-original-open-network-stream)
-    nil                                ; Do nothing, we've been here already
-  (defalias 'socks-original-open-network-stream
-    (symbol-function 'open-network-stream))
-  (if socks-override-functions
-      (defalias 'open-network-stream 'socks-open-network-stream)))
-
 (defvar socks-services-file "/etc/services")
 (defvar socks-tcp-services (make-hash-table :size 13 :test 'equal))
 (defvar socks-udp-services (make-hash-table :size 13 :test 'equal))
@@ -643,5 +645,4 @@ version.")
 
 (provide 'socks)
 
-;; arch-tag: 67aef0d9-f4f7-4056-89c3-b4c9bf93ce7f
 ;;; socks.el ends here