changeset 106284:894b96ba4f65

(socks-send-command): Convert binary request to unibyte before sending. This fixes mishandling of some port numbers such as 129.
author Daiki Ueno <ueno@unixuser.org>
date Fri, 27 Nov 2009 07:35:14 +0000
parents 85d22dbf4301
children 4248d7c5bed0
files lisp/ChangeLog lisp/net/socks.el
diffstat 2 files changed, 28 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Nov 27 04:24:47 2009 +0000
+++ b/lisp/ChangeLog	Fri Nov 27 07:35:14 2009 +0000
@@ -1,3 +1,9 @@
+2009-11-27  Daiki Ueno  <ueno@unixuser.org>
+
+	* net/socks.el (socks-send-command): Convert binary request to
+	unibyte before sending.  This fixes mishandling of some port
+	numbers such as 129.
+
 2009-11-27  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* help.el (describe-bindings-internal): Remove `interactive'.
--- a/lisp/net/socks.el	Fri Nov 27 04:24:47 2009 +0000
+++ b/lisp/net/socks.el	Fri Nov 27 07:35:14 2009 +0000
@@ -435,27 +435,29 @@
 			      (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)